enum {
CLI_ST_INIT = 0, /* initial state, must leave to zero ! */
CLI_ST_END, /* final state, let's close */
- CLI_ST_GETREQ, /* wait for a request */
- CLI_ST_PARSEREQ, /* parse a request */
+ CLI_ST_PARSE_CMDLINE, /* wait for a full command line */
+ CLI_ST_PROCESS_CMDLINE, /* process all commands on the command line */
CLI_ST_OUTPUT, /* all states after this one are responses */
CLI_ST_PROMPT, /* display the prompt (first output, same code) */
CLI_ST_PRINT, /* display const message in cli->msg */
appctx->cli_severity_output = bind_conf->severity_output;
applet_reset_svcctx(appctx);
- appctx->st0 = CLI_ST_GETREQ;
+ appctx->st0 = CLI_ST_PARSE_CMDLINE;
appctx->cli_level = bind_conf->level;
appctx->cli_payload = NULL;
appctx->chunk = NULL;
}
if (!(appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)) {
- appctx->st0 = CLI_ST_PARSEREQ;
+ appctx->st0 = CLI_ST_PROCESS_CMDLINE;
break;
}
}
appctx->st0 = CLI_ST_PROMPT;
end:
- if (appctx->st0 != CLI_ST_GETREQ)
+ if (appctx->st0 != CLI_ST_PARSE_CMDLINE)
ret = 1;
return ret;
}
applet_set_eos(appctx);
break;
}
- else if (appctx->st0 == CLI_ST_GETREQ) {
+ else if (appctx->st0 == CLI_ST_PARSE_CMDLINE) {
if (cli_parse_cmdline(appctx) == 0)
break;
}
- else if (appctx->st0 == CLI_ST_PARSEREQ) {
+ else if (appctx->st0 == CLI_ST_PROCESS_CMDLINE) {
/* ensure we have some output room left in the event we
* would want to return some info right after parsing.
*/
if (applet_putstr(appctx, prompt) != -1) {
applet_reset_svcctx(appctx);
- appctx->st0 = (appctx->st1 & APPCTX_CLI_ST1_PAYLOAD) ? CLI_ST_GETREQ : CLI_ST_PARSEREQ;
+ appctx->st0 = (appctx->st1 & APPCTX_CLI_ST1_PAYLOAD) ? CLI_ST_PARSE_CMDLINE : CLI_ST_PROCESS_CMDLINE;
}
}
/* reactivate the \n at the end of the response for the next command */
appctx->st1 &= ~APPCTX_CLI_ST1_NOLF;
- /* switch state back to GETREQ to read next requests in interactove mode, otherwise close */
+ /* switch state back to PARSE_CMDLINE to read next requests in interactove mode, otherwise close */
if (appctx->st1 & APPCTX_CLI_ST1_LASTCMD) {
applet_reset_svcctx(appctx);
free_trash_chunk(appctx->chunk);
appctx->chunk = NULL;
appctx->st1 &= ~APPCTX_CLI_ST1_LASTCMD;
if (appctx->st1 & APPCTX_CLI_ST1_PROMPT) {
- appctx->st0 = CLI_ST_GETREQ;
+ appctx->st0 = CLI_ST_PARSE_CMDLINE;
applet_will_consume(appctx);
applet_expect_data(appctx);
}
}
}
- if ((b_data(&appctx->inbuf) && appctx->st0 == CLI_ST_GETREQ) || appctx->st0 == CLI_ST_PARSEREQ)
+ if ((b_data(&appctx->inbuf) && appctx->st0 == CLI_ST_PARSE_CMDLINE) || appctx->st0 == CLI_ST_PROCESS_CMDLINE)
appctx_wakeup(appctx);
/* this forces us to yield between pipelined commands and