Enter 2003.

committer: mfx <mfx> 1042478199 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2003-01-13 17:16:39 +00:00
parent 102e0f0a98
commit 2162a01848
151 changed files with 415 additions and 426 deletions
+29 -12
View File
@@ -27,6 +27,18 @@
#include <string.h>
#endif
#undef progname
#if 1
#define progname(x) (x)
#else
#include "conf.h"
static const char *my_progname(const char *argv0)
{
UNUSED(argv0);
return progname ? progname : argv0;
}
#define progname my_progname
#endif
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
@@ -423,7 +435,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{
if (opterr)
fprintf (stderr, "%s: unrecognized option `%s'\n",
argv[0], argv[optind]);
progname(argv[0]), argv[optind]);
nextchar += my_strlen (nextchar);
optind++;
return BAD_OPTION;
@@ -432,7 +444,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
argv[0], argv[optind]);
progname(argv[0]), argv[optind]);
nextchar += my_strlen (nextchar);
optind++;
return BAD_OPTION;
@@ -459,12 +471,12 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
/* --option */
fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n",
argv[0], pfound->name);
progname(argv[0]), pfound->name);
else
/* +option or -option */
fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n",
argv[0], argv[optind - 1][0], pfound->name);
progname(argv[0]), argv[optind - 1][0], pfound->name);
}
nextchar += my_strlen (nextchar);
return BAD_OPTION;
@@ -482,7 +494,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{
if (opterr)
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
argv[0], pfound->name,
progname(argv[0]), pfound->name,
(pfound->has_arg & 0x20) ? "=" : "");
nextchar += my_strlen (nextchar);
return optstring[0] == ':' ? ':' : BAD_OPTION;
@@ -513,11 +525,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n",
argv[0], nextchar);
progname(argv[0]), nextchar);
else
/* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
argv[0], argv[optind][0], nextchar);
progname(argv[0]), argv[optind][0], nextchar);
}
nextchar = empty_string;
optind++;
@@ -543,12 +555,12 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
#if 0
if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
argv[0], c);
progname(argv[0]), c);
else
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
fprintf (stderr, "%s: unrecognized option `-%c'\n", progname(argv[0]), c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
fprintf (stderr, "%s: illegal option -- %c\n", progname(argv[0]), c);
#endif
}
optopt = c;
@@ -584,11 +596,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{
#if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n",
argv[0], c);
progname(argv[0]), c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
progname(argv[0]), c);
#endif
}
optopt = c;
@@ -694,3 +706,8 @@ main (argc, argv)
}
#endif /* TEST */
/*
vi:ts=4:et:nowrap
*/