[PATCH 5/5] optutils.h: don't print non-graph characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no eloquent way to exclude/include arch dependent arguments
from the ul_excl_t array. So when an arch dependent argument is left
undefined err_exclusive_options() was printing out-of-bounds values.
This commit cause them to be skipped instead.

err_exclusive_options() shouldn't be printing out-of-bounds values
in any case.

Also change the error massage from 'options' to 'arguments' as some
programs, like hwclock, distinguish between options and functions.

Signed-off-by: J William Piggott <elseifthen@xxxxxxx>
---
 include/optutils.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/optutils.h b/include/optutils.h
index 325cb88..0dc127b 100644
--- a/include/optutils.h
+++ b/include/optutils.h
@@ -5,6 +5,7 @@
 
 #include "c.h"
 #include "nls.h"
+#include "cctype.h"
 
 static inline const char *option_to_longopt(int c, const struct option *opts)
 {
@@ -81,8 +82,8 @@ static inline void err_exclusive_options(
 			else if (status[e] != c) {
 				size_t ct = 0;
 
-				fprintf(stderr, _("%s: these options are "
-						  "mutually exclusive:"),
+				fprintf(stderr, _("%s: mutually exclusive "
+						  "arguments:"),
 						program_invocation_short_name);
 
 				for (op = excl[e];
@@ -91,7 +92,7 @@ static inline void err_exclusive_options(
 					const char *n = option_to_longopt(*op, opts);
 					if (n)
 						fprintf(stderr, " --%s", n);
-					else
+					else if (c_isgraph(*op))
 						fprintf(stderr, " -%c", *op);
 				}
 				fputc('\n', stderr);
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux