summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2020-11-17 23:08:57 +0100
committerpgen <p.gen.progs@gmail.com>2020-11-17 23:08:57 +0100
commit975d1b899c0df617375fa4cfb41fbe299378a686 (patch)
treee6a284b34510ae67ce0a2fa57b8c8da7d02ccaa1
parentb319d74caa3c8f7080585aca27ca9102398e886d (diff)
Sync with github's ctxopt commit f779fb8
-rw-r--r--ctxopt.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/ctxopt.c b/ctxopt.c
index ed76918..9b13548 100644
--- a/ctxopt.c
+++ b/ctxopt.c
@@ -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);