From fc9a2d0e6f3270dc86f84749ad10dd79d97c8392 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 9 Jan 2010 00:55:41 -0800 Subject: 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 --- src/server/httpd.c | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'src/server/httpd.c') 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 = "", + .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 = " ", + .usage = "parameter_name filename", .help = "Writes a form value to a file.", }, COMMAND_REGISTRATION_DONE -- cgit v1.2.3