Sort flag-switch alphabetically

Signed-off-by: Laslo Hunhold <dev@frign.de>
This commit is contained in:
Laslo Hunhold 2019-02-23 13:50:59 +01:00
parent f2afbc4dd7
commit 48ddb8fefb
No known key found for this signature in database
GPG key ID: 69576BD24CFCB980

72
main.c
View file

@ -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