diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-09-14 18:05:55 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-09-14 18:05:55 -0700 |
commit | ec11595998eb44b6ad129d0a4b4ac4c301770e64 (patch) | |
tree | 0f389238b415299e92b9306161991456637df80e /missing | |
parent | a5eca2cbbfa991c0ae26d0b039bf303fa92734ac (diff) | |
download | tcpdump-ec11595998eb44b6ad129d0a4b4ac4c301770e64.tar.gz |
Revert "Clean up the code a bit."
This reverts commit a5eca2cbbfa991c0ae26d0b039bf303fa92734ac.
MSVC doesn't complain about it, so leave it alone.
Diffstat (limited to 'missing')
-rw-r--r-- | missing/getopt_long.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/missing/getopt_long.c b/missing/getopt_long.c index 37062404..80857369 100644 --- a/missing/getopt_long.c +++ b/missing/getopt_long.c @@ -495,32 +495,16 @@ start: } } - optchar = (int)*place++; - /* - * If the user specified "-" and '-' isn't listed in - * options, return -1 (non-option) as per POSIX. - */ - if (optchar == (int)'-' && *place == '\0') - return (-1); - if (optchar == (int)':') { - if (!*place) - ++optind; -#ifdef GNU_COMPATIBLE - if (PRINT_ERROR) - warnx(posixly_correct ? illoptchar : gnuoptchar, - optchar); -#else - if (PRINT_ERROR) - warnx(illoptchar, optchar); -#endif - optopt = optchar; - return (BADCH); - } - oli = strchr(options, optchar); - if (oli == NULL) { + if ((optchar = (int)*place++) == (int)':' || + (optchar == (int)'-' && *place != '\0') || + (oli = strchr(options, optchar)) == NULL) { /* - * Unknown option character. + * If the user specified "-" and '-' isn't listed in + * options, return -1 (non-option) as per POSIX. + * Otherwise, it is an unknown option character (or ':'). */ + if (optchar == (int)'-' && *place == '\0') + return (-1); if (!*place) ++optind; #ifdef GNU_COMPATIBLE |