]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli: use pcli_flags for prompt activation
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 11 Dec 2018 15:10:58 +0000 (16:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Dec 2018 16:05:40 +0000 (17:05 +0100)
Instead of using a variable to activate the prompt, we just use a flag.

include/types/stream.h
src/cli.c
src/stream.c

index 8eb51158f9126a4e9ee35b3e921d6dd4cf4171c5..6dee43214462a95a860434a6944ee4868adc4679 100644 (file)
@@ -163,7 +163,6 @@ struct stream {
                          struct stream_interface *si);
 
        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 */
 
        char *unique_id;                        /* custom unique ID */
index 9d210dd360d0a04aab45804f37fd4039415db67e..c41a8b5a1f7c3ddd26617d190d705960fa14d0d3 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1658,7 +1658,7 @@ void pcli_write_prompt(struct stream *s)
        struct buffer *msg = get_trash_chunk();
        struct channel *oc = si_oc(&s->si[0]);
 
-       if (!s->pcli_prompt)
+       if (!(s->pcli_flags & APPCTX_CLI_ST1_PROMPT))
                return;
 
        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;
                return 1;
        } 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 */
 
        } else if (!strcmp("quit", args[0])) {
index 24df70af35c992c6604e64b0329e8a2c596fedc7..d79f86c72784a52637d28007b0a4845c1d5fc3e8 100644 (file)
@@ -201,7 +201,6 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin)
 
        s->flags |= SF_INITIALIZED;
        s->pcli_next_pid = 0;
-       s->pcli_prompt = 0;
        s->pcli_flags = 0;
        s->unique_id = NULL;