{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable. */
+static char *posixly_correct;
\f
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+ That was relevant to code that was here before. */
#ifndef __STDC__
-#ifdef IN_GCC
-#include "gstddef.h"
-#else /* not IN_GCC */
-/* Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- Enable Emacs to compile on it. */
-#include <stddef.h>
-#endif /* not IN_GCC */
-extern size_t strlen (const char *);
+/* gcc with -traditional declares the built-in strlen to return int,
+ and has done so at least since version 2.4.5. -- rms. */
+extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */
nextchar = NULL;
+ posixly_correct = getenv ("POSIXLY_CORRECT");
+
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
ordering = REQUIRE_ORDER;
++optstring;
}
- else if (getenv ("POSIXLY_CORRECT") != NULL)
+ else if (posixly_correct != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
{
if (opterr)
{
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+ else
+ fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
}
optopt = c;
return '?';