diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
| commit | 884c8093d63402a1ad0b502244b791e3c6782be3 (patch) | |
| tree | a600d4ab0d431a2bdfe4c15b70df43c14fbd8dd0 /debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c | |
| parent | 14e1aa2006796f147f3f4811fb908a6b01e79253 (diff) | |
| download | extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.tar.gz extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.zip | |
Added debian extra dependency packages.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c')
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c b/debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c new file mode 100755 index 00000000..d47ea498 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/tifficc/getopt.c @@ -0,0 +1,75 @@ +/* + getopt.c + +*/ + +#include <errno.h> +#include <string.h> +#include <stdio.h> + +int xoptind = 1; /* index of which argument is next */ +char *xoptarg; /* pointer to argument of current option */ +int xopterr = 0; /* allow error message */ + +static char *letP = NULL; /* remember next option char's location */ +char SW = '-'; /* DOS switch character, either '-' or '/' */ + +/* + Parse the command line options, System V style. + + Standard option syntax is: + + option ::= SW [optLetter]* [argLetter space* argument] + +*/ + +int xgetopt(int argc, char *argv[], char *optionS) +{ + unsigned char ch; + char *optP; + + if (SW == 0) { + SW = '/'; + } + + if (argc > xoptind) { + if (letP == NULL) { + if ((letP = argv[xoptind]) == NULL || + *(letP++) != SW) goto gopEOF; + if (*letP == SW) { + xoptind++; goto gopEOF; + } + } + if (0 == (ch = *(letP++))) { + xoptind++; goto gopEOF; + } + if (':' == ch || (optP = strchr(optionS, ch)) == NULL) + goto gopError; + if (':' == *(++optP)) { + xoptind++; + if (0 == *letP) { + if (argc <= xoptind) goto gopError; + letP = argv[xoptind++]; + } + xoptarg = letP; + letP = NULL; + } else { + if (0 == *letP) { + xoptind++; + letP = NULL; + } + xoptarg = NULL; + } + return ch; + } +gopEOF: + xoptarg = letP = NULL; + return EOF; + +gopError: + xoptarg = NULL; + errno = EINVAL; + if (xopterr) + perror ("get command line option"); + return ('?'); +} |
