summaryrefslogtreecommitdiffstats
path: root/tests/main.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2025-04-18 14:09:35 -0400
committerTavian Barnes <tavianator@tavianator.com>2025-04-18 14:09:35 -0400
commit96f98cea12d6ae80ecb45dba2fb14555c74612fc (patch)
tree0bdfb49f9ac1bf52833ae1e451e7b54badfb402f /tests/main.c
parentf9fd4b9be60848bfd69682af45c51739bf7aa3bf (diff)
downloadbfs-96f98cea12d6ae80ecb45dba2fb14555c74612fc.tar.xz
bfstd: Add some more integer parsing functionsHEADmain
Diffstat (limited to 'tests/main.c')
-rw-r--r--tests/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/main.c b/tests/main.c
index 4c770bd..9240e1c 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -222,15 +222,15 @@ int main(int argc, char *argv[]) {
}
tzset();
- long jobs = 0;
+ unsigned int jobs = 0;
const char *cmd = argc > 0 ? argv[0] : "units";
int c;
while (c = getopt(argc, argv, ":j:"), c != -1) {
switch (c) {
case 'j':
- if (xstrtol(optarg, NULL, 10, &jobs) != 0 || jobs <= 0) {
- fprintf(stderr, "%s: Bad job count '%s'\n", cmd, optarg);
+ if (xstrtoui(optarg, NULL, 10, &jobs) != 0) {
+ fprintf(stderr, "%s: Bad job count '%s': %s\n", cmd, optarg, errstr());
return EXIT_FAILURE;
}
break;
@@ -243,7 +243,7 @@ int main(int argc, char *argv[]) {
}
}
- if (jobs == 0) {
+ if (!jobs) {
jobs = nproc();
}