diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2010-01-09 00:55:41 -0800 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2010-01-09 00:55:41 -0800 |
commit | fc9a2d0e6f3270dc86f84749ad10dd79d97c8392 (patch) | |
tree | 1c0c8a706ab6fee0f098ec6118a72c9057e33e85 /src/server | |
parent | aafd3877e6fbc1745dbfc5d4f54a2c7efe8cc3d6 (diff) | |
download | openocd+libswd-fc9a2d0e6f3270dc86f84749ad10dd79d97c8392.tar.gz openocd+libswd-fc9a2d0e6f3270dc86f84749ad10dd79d97c8392.tar.bz2 openocd+libswd-fc9a2d0e6f3270dc86f84749ad10dd79d97c8392.tar.xz openocd+libswd-fc9a2d0e6f3270dc86f84749ad10dd79d97c8392.zip |
src/server: usage/help/doc updates
Make "usage" messages use the same EBNF as the User's Guide;
no angle brackets. Improve and correct various helptexts.
Specifically for the port commands, clarify that the number
is optional, and omitting it causes the current number to be
displayed.
Don't use "&function"; a function's name is its address.
Remove a couple instances of pointless whitespace; shrink a
few overlong lines.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/gdb_server.c | 31 | ||||
-rw-r--r-- | src/server/httpd.c | 54 | ||||
-rw-r--r-- | src/server/tcl_server.c | 9 | ||||
-rw-r--r-- | src/server/telnet_server.c | 11 |
4 files changed, 53 insertions, 52 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 96b9dbf1..08daa68a 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2412,7 +2412,7 @@ COMMAND_HANDLER(handle_gdb_breakpoint_override_command) static const struct command_registration gdb_command_handlers[] = { { .name = "gdb_sync", - .handler = &handle_gdb_sync_command, + .handler = handle_gdb_sync_command, .mode = COMMAND_ANY, .help = "next stepi will return immediately allowing " "GDB to fetch register state without affecting " @@ -2420,40 +2420,41 @@ static const struct command_registration gdb_command_handlers[] = { }, { .name = "gdb_port", - .handler = &handle_gdb_port_command, + .handler = handle_gdb_port_command, .mode = COMMAND_ANY, - .help = "daemon configuration command gdb_port. No arguments reports " - "GDB port.", - .usage = "<port>", + .help = "Display or specify base port on which to listen " + "for incoming GDB connections. " + "No arguments reports GDB port; zero disables.", + .usage = "[port_num]", }, { .name = "gdb_memory_map", - .handler = &handle_gdb_memory_map_command, + .handler = handle_gdb_memory_map_command, .mode = COMMAND_CONFIG, .help = "enable or disable memory map", - .usage = "enable|disable" + .usage = "('enable'|'disable')" }, { .name = "gdb_flash_program", - .handler = &handle_gdb_flash_program_command, + .handler = handle_gdb_flash_program_command, .mode = COMMAND_CONFIG, .help = "enable or disable flash program", - .usage = "enable|disable" + .usage = "('enable'|'disable')" }, { .name = "gdb_report_data_abort", - .handler = &handle_gdb_report_data_abort_command, + .handler = handle_gdb_report_data_abort_command, .mode = COMMAND_CONFIG, .help = "enable or disable reporting data aborts", - .usage = "enable|disable" + .usage = "('enable'|'disable')" }, { .name = "gdb_breakpoint_override", - .handler = &handle_gdb_breakpoint_override_command, + .handler = handle_gdb_breakpoint_override_command, .mode = COMMAND_EXEC, - .help = "force type of breakpoint " - "used by gdb 'break' commands.", - .usage = "hard|soft|disable", + .help = "Display or specify type of breakpoint " + "to be used by gdb 'break' commands.", + .usage = "('hard'|'soft'|'disable')" }, COMMAND_REGISTRATION_DONE }; diff --git a/src/server/httpd.c b/src/server/httpd.c index 9554ff0e..af8c3c8b 100644 --- a/src/server/httpd.c +++ b/src/server/httpd.c @@ -118,11 +118,11 @@ static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc, // Find length const char *data; int actual; - int retcode; - - const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val", + const char *script = alloc_printf( + "set dummy_val $httppostdata(%s); set dummy_val", name); + retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); free((void *) script); if (retcode != JIM_OK) @@ -154,27 +154,25 @@ httpd_Jim_Command_formfetch(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - if (argc != 2) - { - Jim_WrongNumArgs(interp, 1, argv, "method ?CMD_ARGV ...?"); - return JIM_ERR; - } - char *name = (char*)Jim_GetString(argv[1], NULL); - - - const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val", - name); - int retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); - free((void *) script); - if (retcode != JIM_OK) - { - Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); - } else - { - Jim_SetResult(interp, Jim_GetResult(interp)); - } - - return JIM_OK; + if (argc != 2) + { + Jim_WrongNumArgs(interp, 1, argv, "method ?CMD_ARGV ...?"); + return JIM_ERR; + } + + char *name = (char*)Jim_GetString(argv[1], NULL); + const char *script = alloc_printf( + "set dummy_val $httppostdata(%s); set dummy_val", + name); + int retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); + + free((void *) script); + if (retcode != JIM_OK) + Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); + else + Jim_SetResult(interp, Jim_GetResult(interp)); + + return JIM_OK; } struct httpd_request @@ -467,16 +465,16 @@ static struct MHD_Daemon * d; static const struct command_registration httpd_command_handlers[] = { { .name = "formfetch", - .jim_handler = &httpd_Jim_Command_formfetch, + .jim_handler = httpd_Jim_Command_formfetch, .mode = COMMAND_EXEC, - .usage = "<parameter_name>", + .usage = "parameter_name", .help = "Reads a posted form value.", }, { .name = "writeform", - .jim_handler = &httpd_Jim_Command_writeform, + .jim_handler = httpd_Jim_Command_writeform, .mode = COMMAND_EXEC, - .usage = "<parameter_name> <file>", + .usage = "parameter_name filename", .help = "Writes a form value to a file.", }, COMMAND_REGISTRATION_DONE diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index a772c0ac..a88c4365 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -181,11 +181,12 @@ COMMAND_HANDLER(handle_tcl_port_command) static const struct command_registration tcl_command_handlers[] = { { .name = "tcl_port", - .handler = &handle_tcl_port_command, + .handler = handle_tcl_port_command, .mode = COMMAND_CONFIG, - .help = "port on which to listen " - "for incoming TCL syntax", - .usage = "<port>", + .help = "Specify port on which to listen " + "for incoming Tcl syntax. " + "No arguments reports Tcl port; zero disables.", + .usage = "[port_num]", }, COMMAND_REGISTRATION_DONE }; diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 92e7480b..6f26f0ac 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -619,17 +619,18 @@ COMMAND_HANDLER(handle_exit_command) static const struct command_registration telnet_command_handlers[] = { { .name = "exit", - .handler = &handle_exit_command, + .handler = handle_exit_command, .mode = COMMAND_EXEC, .help = "exit telnet session", }, { .name = "telnet_port", - .handler = &handle_telnet_port_command, + .handler = handle_telnet_port_command, .mode = COMMAND_ANY, - .help = "port on which to listen " - "for incoming telnet connections", - .usage = "<port>", + .help = "Specify port on which to listen " + "for incoming telnet connections. " + "No arguments reports telnet port; zero disables.", + .usage = "[port_num]", }, COMMAND_REGISTRATION_DONE }; |