MINOR: cli: use pcli_flags for prompt activation

Instead of using a variable to activate the prompt, we just use a flag.
This commit is contained in:
William Lallemand 2018-12-11 16:10:58 +01:00 committed by Willy Tarreau
parent ebf61804ef
commit 459e18e9e7
3 changed files with 2 additions and 4 deletions

View File

@ -163,7 +163,6 @@ struct stream {
struct stream_interface *si); struct stream_interface *si);
int pcli_next_pid; /* next target PID to use for the CLI proxy */ int pcli_next_pid; /* next target PID to use for the CLI proxy */
int pcli_prompt; /* is there a prompt ?! */
int pcli_flags; /* flags for CLI proxy */ int pcli_flags; /* flags for CLI proxy */
char *unique_id; /* custom unique ID */ char *unique_id; /* custom unique ID */

View File

@ -1658,7 +1658,7 @@ void pcli_write_prompt(struct stream *s)
struct buffer *msg = get_trash_chunk(); struct buffer *msg = get_trash_chunk();
struct channel *oc = si_oc(&s->si[0]); struct channel *oc = si_oc(&s->si[0]);
if (!s->pcli_prompt) if (!(s->pcli_flags & APPCTX_CLI_ST1_PROMPT))
return; return;
if (s->pcli_flags & APPCTX_CLI_ST1_PAYLOAD) { if (s->pcli_flags & APPCTX_CLI_ST1_PAYLOAD) {
@ -1790,7 +1790,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg
*next_pid = target_pid; *next_pid = target_pid;
return 1; return 1;
} else if (!strcmp("prompt", args[0])) { } else if (!strcmp("prompt", args[0])) {
s->pcli_prompt ^= 1; s->pcli_flags ^= APPCTX_CLI_ST1_PROMPT;
return argl; /* return the number of elements in the array */ return argl; /* return the number of elements in the array */
} else if (!strcmp("quit", args[0])) { } else if (!strcmp("quit", args[0])) {

View File

@ -201,7 +201,6 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin)
s->flags |= SF_INITIALIZED; s->flags |= SF_INITIALIZED;
s->pcli_next_pid = 0; s->pcli_next_pid = 0;
s->pcli_prompt = 0;
s->pcli_flags = 0; s->pcli_flags = 0;
s->unique_id = NULL; s->unique_id = NULL;