diff options
author | pgen <p.gen.progs@gmail.com> | 2020-11-17 23:08:57 +0100 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2020-11-17 23:08:57 +0100 |
commit | 975d1b899c0df617375fa4cfb41fbe299378a686 (patch) | |
tree | e6a284b34510ae67ce0a2fa57b8c8da7d02ccaa1 | |
parent | b319d74caa3c8f7080585aca27ca9102398e886d (diff) |
Sync with github's ctxopt commit f779fb8
-rw-r--r-- | ctxopt.c | 35 |
1 files changed, 24 insertions, 11 deletions
@@ -3630,20 +3630,33 @@ ctxopt_analyze(int nb_words, char ** words, int * nb_rem_args, if (*user_string2 != '\0') { char * help_msg; + int count = 0; + + count = strchrcount(user_string2, '\n'); if (flags.display_usage_on_error) - help_msg = "see below.\n"; + help_msg = ", see below"; + else + help_msg = ""; + + if (count == 0) /* Only one context involved. */ + errmsg = strappend( + errmsg, + "\nThis parameter is only valid in the following " + "context:\n", + user_string2, + "\n\nFirst switch to this context using the appropriate " + "parameter", + help_msg, ".\n", (char *)0); else - help_msg = "\nrefer to the manual for more information.\n"; - - errmsg = strappend( - errmsg, - "\nThis parameter is only valid in one of the following " - "contexts:\n", - user_string2, - "\n\nSwitch to one of them first using the appropriate " - "parameter, ", - help_msg, (char *)0); + errmsg = strappend( + errmsg, + "\nThis parameter is only valid in one of the following " + "contexts:\n", + user_string2, + "\n\nFirst switch to one of them using the appropriate " + "parameter", + help_msg, ".\n", (char *)0); } fatal(CTXOPTUNKPAR, errmsg); |