Sort flag-switch alphabetically
Signed-off-by: Laslo Hunhold <dev@frign.de>
This commit is contained in:
parent
f2afbc4dd7
commit
48ddb8fefb
1 changed files with 36 additions and 36 deletions
72
main.c
72
main.c
|
@ -129,9 +129,45 @@ main(int argc, char *argv[])
|
|||
s.listdirs = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'd':
|
||||
servedir = EARGF(usage());
|
||||
break;
|
||||
case 'g':
|
||||
group = EARGF(usage());
|
||||
break;
|
||||
case 'h':
|
||||
s.host = EARGF(usage());
|
||||
break;
|
||||
case 'i':
|
||||
s.docindex = EARGF(usage());
|
||||
if (strchr(s.docindex, '/')) {
|
||||
die("The document index must not contain '/'");
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
s.listdirs = 1;
|
||||
break;
|
||||
case 'm':
|
||||
if (!(tok = strdup(EARGF(usage())))) {
|
||||
die("strdup:");
|
||||
}
|
||||
if (!(s.map = reallocarray(s.map, ++s.map_len,
|
||||
sizeof(struct map)))) {
|
||||
die("reallocarray:");
|
||||
}
|
||||
if (!(s.map[s.map_len - 1].chost = strtok(tok, " ")) ||
|
||||
!(s.map[s.map_len - 1].from = strtok(NULL, " ")) ||
|
||||
!(s.map[s.map_len - 1].to = strtok(NULL, " ")) ||
|
||||
strtok(NULL, "")) {
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
maxnprocs = strtonum(EARGF(usage()), 1, INT_MAX, &err);
|
||||
if (err) {
|
||||
die("strtonum '%s': %s", EARGF(usage()), err);
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
s.port = EARGF(usage());
|
||||
break;
|
||||
|
@ -141,27 +177,6 @@ main(int argc, char *argv[])
|
|||
case 'u':
|
||||
user = EARGF(usage());
|
||||
break;
|
||||
case 'g':
|
||||
group = EARGF(usage());
|
||||
break;
|
||||
case 'n':
|
||||
maxnprocs = strtonum(EARGF(usage()), 1, INT_MAX, &err);
|
||||
if (err) {
|
||||
die("strtonum '%s': %s", EARGF(usage()), err);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
servedir = EARGF(usage());
|
||||
break;
|
||||
case 'l':
|
||||
s.listdirs = 1;
|
||||
break;
|
||||
case 'i':
|
||||
s.docindex = EARGF(usage());
|
||||
if (strchr(s.docindex, '/')) {
|
||||
die("The document index must not contain '/'");
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
if (!(tok = strdup(EARGF(usage())))) {
|
||||
die("strdup:");
|
||||
|
@ -180,21 +195,6 @@ main(int argc, char *argv[])
|
|||
usage();
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (!(tok = strdup(EARGF(usage())))) {
|
||||
die("strdup:");
|
||||
}
|
||||
if (!(s.map = reallocarray(s.map, ++s.map_len,
|
||||
sizeof(struct map)))) {
|
||||
die("reallocarray:");
|
||||
}
|
||||
if (!(s.map[s.map_len - 1].chost = strtok(tok, " ")) ||
|
||||
!(s.map[s.map_len - 1].from = strtok(NULL, " ")) ||
|
||||
!(s.map[s.map_len - 1].to = strtok(NULL, " ")) ||
|
||||
strtok(NULL, "")) {
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
} ARGEND
|
||||
|
|
Loading…
Reference in a new issue