diff options
author | Mattias Andrée <maandree@kth.se> | 2016-12-18 19:17:04 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-12-18 19:17:04 +0100 |
commit | 62a03f15989cf0b53e40fb9c37e65e13b4c64105 (patch) | |
tree | 6b726399b937a2173930c63f36de543c646928b7 /src/cg-base.c | |
parent | m (diff) | |
download | cg-tools-62a03f15989cf0b53e40fb9c37e65e13b4c64105.tar.gz cg-tools-62a03f15989cf0b53e40fb9c37e65e13b4c64105.tar.bz2 cg-tools-62a03f15989cf0b53e40fb9c37e65e13b4c64105.tar.xz |
cg-base: Add NO_DEFAULT_PRIORITY
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/cg-base.c')
-rw-r--r-- | src/cg-base.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/cg-base.c b/src/cg-base.c index dbcaf19..2de0abc 100644 --- a/src/cg-base.c +++ b/src/cg-base.c @@ -646,19 +646,22 @@ int main(int argc, char* argv[]) nulstrcmp(rule, "?") && nulstrcmp(method, "?")) if (handle_args(argc, argv, prio) < 0) goto fail; - - if (!nulstrcmp(prio, "?")) - { - printf("%" PRIi64 "\n", priority); - return 0; - } - else if (prio != NULL) + + if (default_priority != NO_DEFAULT_PRIORITY) { - char *end; - errno = 0; - priority = (int64_t)strtoll(prio, &end, 10); - if (errno || *end || !*prio) - usage(); + if (!nulstrcmp(prio, "?")) + { + printf("%" PRIi64 "\n", priority); + return 0; + } + else if (prio != NULL) + { + char *end; + errno = 0; + priority = (int64_t)strtoll(prio, &end, 10); + if (errno || *end || !*prio) + usage(); + } } if (!nulstrcmp(rule, "??")) |