mirror of
https://github.com/thepigeongenerator/cpusetcores.git
synced 2025-12-18 14:35:45 +01:00
remove duplicate checks and put everything on a single line.
This commit is contained in:
20
src/opts.c
20
src/opts.c
@@ -12,22 +12,10 @@ uint8_t getoptions(int32_t argc, char *const *argv, int32_t *ncpus) {
|
|||||||
|
|
||||||
while ((opt = getopt(argc, argv, "lavih")) != -1) {
|
while ((opt = getopt(argc, argv, "lavih")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'l':
|
case 'l': opts |= OPT_LIST_CORES; break;
|
||||||
if (opts & OPT_LIST_CORES) fatal("-%c has already been set", 'l');
|
case 'a': opts |= OPT_SET_ALL; break;
|
||||||
opts |= OPT_LIST_CORES;
|
case 'v': opts |= OPT_VERBOSE | OPT_LIST_CORES; break;
|
||||||
break;
|
case 'i': opts |= OPT_INVERT; break;
|
||||||
case 'a':
|
|
||||||
if (opts & OPT_SET_ALL) fatal("-%c has already been set", 'a');
|
|
||||||
opts |= OPT_SET_ALL;
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
if (opts & OPT_VERBOSE) fatal("-%c has already been set", 'v');
|
|
||||||
opts |= OPT_VERBOSE | OPT_LIST_CORES;
|
|
||||||
break;
|
|
||||||
case 'i':
|
|
||||||
if (opts & OPT_INVERT) fatal("-%c has already been set", 'i');
|
|
||||||
opts |= OPT_INVERT;
|
|
||||||
break;
|
|
||||||
case '?':
|
case '?':
|
||||||
printf("specify -h for help\n");
|
printf("specify -h for help\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|||||||
Reference in New Issue
Block a user