diff options
Diffstat (limited to 'src/piesctl.c')
-rw-r--r-- | src/piesctl.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/piesctl.c b/src/piesctl.c index d10bd0e..71efbcd 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -54,8 +54,8 @@ int dump; struct grecs_sockaddr_hints hints = { .flags = GRECS_AH_PASSIVE }; -#define EX_OK 0 -#define EX_NOTFOUND 1 +#define EX_OK 0 +#define EX_PIES_NOTFOUND 1 int exit_status = EX_OK; @@ -1006,7 +1006,7 @@ shttp_process (struct shttp_connection *conn, int method, char const *uri) case 404: /* Not found */ case 409: /* Conflict */ - exit_status = EX_NOTFOUND; + exit_status = EX_PIES_NOTFOUND; shttp_print_error (conn); return; @@ -1484,11 +1484,24 @@ parse_condition_to_uri (char const *base, struct cmdline_parser_state *state, return ret; } +/* Provide default condition if there are no more arguments */ +static struct cmdline_parser_state * +default_cond (struct cmdline_parser_state *state) +{ + if (!peek_token (state)) + { + static char *dfl[] = { "type", "component", NULL }; + state->argc = sizeof (dfl) / sizeof (dfl[0]); + state->argv = dfl; + } + return state; +} + static void com_list (struct cmdline_parser_state *state) { struct shttp_connection *conn = state->conn; - char *uri = parse_condition_to_uri ("/programs", state, 0); + char *uri = parse_condition_to_uri ("/programs", default_cond (state), 0); shttp_io_init (&conn->req); shttp_process (conn, METH_GET, uri); @@ -1583,19 +1596,6 @@ shttp_print_response_status (struct shttp_connection *conn) } } -/* Provide default condition if there are no more arguments */ -static struct cmdline_parser_state * -default_cond (struct cmdline_parser_state *state) -{ - if (!peek_token (state)) - { - static char *dfl[] = { "type", "component", NULL }; - state->argc = sizeof (dfl) / sizeof (dfl[0]); - state->argv = dfl; - } - return state; -} - static void com_stop (struct cmdline_parser_state *state) { |