summaryrefslogtreecommitdiff
path: root/lib/getopt.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-11-17 01:52:35 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-11-17 01:52:35 +0000
commit4d60dc8a48499fb8c4e82414fce3edad7dfd1861 (patch)
treec1e503ffb84af722b85879b5e3fca7f268157c28 /lib/getopt.c
parent06ee59a585b78f1071e246c1a8c3e0d3731388b0 (diff)
downloadgnulib-4d60dc8a48499fb8c4e82414fce3edad7dfd1861.tar.gz
(POSIXLY_CORRECT): New constant.
Diffstat (limited to 'lib/getopt.c')
-rw-r--r--lib/getopt.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/getopt.c b/lib/getopt.c
index 744f115631..ef790b79e0 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -1154,10 +1154,19 @@ _getopt_internal (int argc, char **argv, const char *optstring,
return result;
}
+/* glibc gets a LSB-compliant getopt.
+ Standalone applications get a POSIX-compliant getopt. */
+#if _LIBC
+enum { POSIXLY_CORRECT = 0 };
+#else
+enum { POSIXLY_CORRECT = 1 };
+#endif
+
int
getopt (int argc, char *const *argv, const char *optstring)
{
- return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, 1);
+ return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
+ POSIXLY_CORRECT);
}