From 9180a40f1fca680b02747b69795d565073bced42 Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Sun, 21 Aug 2016 16:41:57 +0200 Subject: [PATCH] adjust optstring for GNU getopt() --- bin/main.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/main.cc b/bin/main.cc index e5aef91..257e168 100644 --- a/bin/main.cc +++ b/bin/main.cc @@ -922,9 +922,18 @@ read_command_options(register int argc, register char **argv) extern char *optarg; extern int optind, opterr, optopt; +// Apparently, the semantics of a leading '-' in the optstring differ +// between Solaris and GNU libc. +// Also, the '+' is probably a good idea for GNU libc to avoid +// reording of arguments. +#if defined(sun) || defined(__sun) #define SUNPRO_CMD_OPTS "-~Bbc:Ddef:g:ij:K:kM:m:NnO:o:PpqRrSsTtuVvwx:" +#define SVR4_CMD_OPTS "-c:ef:g:ij:km:nO:o:pqrsTtVv" +#else +#define SUNPRO_CMD_OPTS "+~Bbc:Ddef:g:ij:K:kM:m:NnO:o:PpqRrSsTtuVvwx:" +#define SVR4_CMD_OPTS "+c:ef:g:ij:km:nO:o:pqrsTtVv" +#endif -# define SVR4_CMD_OPTS "-c:ef:g:ij:km:nO:o:pqrsTtVv" /* * Added V in SVR4_CMD_OPTS also, which is going to be a hidden