New ACC system.
committer: mfx <mfx> 1048662134 +0000
This commit is contained in:
+8
-18
@@ -21,11 +21,8 @@
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include "tailor.h"
|
||||
#ifndef EOF
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#undef progname
|
||||
#if 1
|
||||
@@ -66,8 +63,6 @@ static const char *my_progname(const char *argv0)
|
||||
#define optind mfx_optind
|
||||
#define opterr mfx_opterr
|
||||
#define optopt mfx_optopt
|
||||
#define my_index strchr
|
||||
#define my_strlen strlen
|
||||
#undef BAD_OPTION
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
@@ -394,15 +389,10 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
int indfound = 0;
|
||||
int needexact = 0;
|
||||
|
||||
#if defined(DOSISH)
|
||||
/* allow `--option#value' because you cannout assign a '='
|
||||
to an environment variable under DOS command.com */
|
||||
while (*s && *s != '=' && * s != '#')
|
||||
s++;
|
||||
#else
|
||||
while (*s && *s != '=')
|
||||
s++;
|
||||
#endif
|
||||
|
||||
/* Test all options for either exact match or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name;
|
||||
@@ -411,7 +401,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
{
|
||||
if (p->has_arg & 0x10)
|
||||
needexact = 1;
|
||||
if ((unsigned) (s - nextchar) == my_strlen (p->name))
|
||||
if ((unsigned) (s - nextchar) == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
@@ -436,7 +426,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
if (opterr)
|
||||
fprintf (stderr, "%s: unrecognized option `%s'\n",
|
||||
progname(argv[0]), argv[optind]);
|
||||
nextchar += my_strlen (nextchar);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
return BAD_OPTION;
|
||||
}
|
||||
@@ -445,7 +435,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
if (opterr)
|
||||
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
||||
progname(argv[0]), argv[optind]);
|
||||
nextchar += my_strlen (nextchar);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
return BAD_OPTION;
|
||||
}
|
||||
@@ -478,7 +468,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
"%s: option `%c%s' doesn't allow an argument\n",
|
||||
progname(argv[0]), argv[optind - 1][0], pfound->name);
|
||||
}
|
||||
nextchar += my_strlen (nextchar);
|
||||
nextchar += strlen (nextchar);
|
||||
return BAD_OPTION;
|
||||
}
|
||||
}
|
||||
@@ -496,11 +486,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
|
||||
progname(argv[0]), pfound->name,
|
||||
(pfound->has_arg & 0x20) ? "=" : "");
|
||||
nextchar += my_strlen (nextchar);
|
||||
nextchar += strlen (nextchar);
|
||||
return optstring[0] == ':' ? ':' : BAD_OPTION;
|
||||
}
|
||||
}
|
||||
nextchar += my_strlen (nextchar);
|
||||
nextchar += strlen (nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag)
|
||||
@@ -518,7 +508,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
#ifdef GETOPT_COMPAT
|
||||
|| argv[optind][0] == '+'
|
||||
#endif /* GETOPT_COMPAT */
|
||||
|| my_index (optstring, *nextchar) == NULL)
|
||||
|| strchr (optstring, *nextchar) == NULL)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
@@ -542,7 +532,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
||||
|
||||
{
|
||||
char c = *nextchar++;
|
||||
const char *temp = my_index (optstring, c);
|
||||
const char *temp = strchr (optstring, c);
|
||||
|
||||
/* Increment `optind' when we start to process its last character. */
|
||||
if (*nextchar == '\0')
|
||||
|
||||
Reference in New Issue
Block a user