summaryrefslogtreecommitdiffstats
path: root/src/misc/extra
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-02-08 18:57:16 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2017-02-08 18:57:16 -0800
commit77e2b1ff53bd806a681c9a887cd5b026681d271b (patch)
tree836772eb3d0f29f9afa61cd2b4f8b181859baabb /src/misc/extra
parentcf24a0eb0c630e19bf1d81622fc05327371c63cf (diff)
downloadabc-77e2b1ff53bd806a681c9a887cd5b026681d271b.tar.gz
abc-77e2b1ff53bd806a681c9a887cd5b026681d271b.tar.bz2
abc-77e2b1ff53bd806a681c9a887cd5b026681d271b.zip
Autotuner for 'satoko'.
Diffstat (limited to 'src/misc/extra')
-rw-r--r--src/misc/extra/extraUtilUtil.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/src/misc/extra/extraUtilUtil.c b/src/misc/extra/extraUtilUtil.c
index 253d9e3c..2f0f4559 100644
--- a/src/misc/extra/extraUtilUtil.c
+++ b/src/misc/extra/extraUtilUtil.c
@@ -102,35 +102,45 @@ int Extra_UtilGetopt( int argc, char *argv[], const char *optstring )
globalUtilOptarg = NULL;
- if (pScanStr == NULL || *pScanStr == '\0') {
- if (globalUtilOptind == 0) globalUtilOptind++;
- if (globalUtilOptind >= argc) return EOF;
- place = argv[globalUtilOptind];
- if (place[0] != '-' || place[1] == '\0') return EOF;
- globalUtilOptind++;
- if (place[1] == '-' && place[2] == '\0') return EOF;
- pScanStr = place+1;
+ if (pScanStr == NULL || *pScanStr == '\0')
+ {
+ if (globalUtilOptind == 0)
+ globalUtilOptind++;
+ if (globalUtilOptind >= argc)
+ return EOF;
+ place = argv[globalUtilOptind];
+ if (place[0] != '-' || place[1] == '\0')
+ return EOF;
+ globalUtilOptind++;
+ if (place[1] == '-' && place[2] == '\0')
+ return EOF;
+ pScanStr = place+1;
}
c = *pScanStr++;
place = strchr(optstring, c);
if (place == NULL || c == ':') {
- (void) fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
- return '?';
- }
- if (*++place == ':') {
- if (*pScanStr != '\0') {
- globalUtilOptarg = pScanStr;
- pScanStr = NULL;
- } else {
- if (globalUtilOptind >= argc) {
- (void) fprintf(stderr, "%s: %c requires an argument\n",
- argv[0], c);
+ (void) fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
return '?';
- }
- globalUtilOptarg = argv[globalUtilOptind];
- globalUtilOptind++;
}
+ if (*++place == ':')
+ {
+ if (*pScanStr != '\0')
+ {
+ globalUtilOptarg = pScanStr;
+ pScanStr = NULL;
+ }
+ else
+ {
+ if (globalUtilOptind >= argc)
+ {
+ (void) fprintf(stderr, "%s: %c requires an argument\n",
+ argv[0], c);
+ return '?';
+ }
+ globalUtilOptarg = argv[globalUtilOptind];
+ globalUtilOptind++;
+ }
}
return c;
}