commit 48ddb8fefb512effefd9b761efa25fd9158e2edc
parent f2afbc4dd703e07b6204faa6d29f885482b18a3b
Author: Laslo Hunhold <dev@frign.de>
Date: Sat, 23 Feb 2019 13:50:59 +0100
Sort flag-switch alphabetically
Signed-off-by: Laslo Hunhold <dev@frign.de>
Diffstat:
M | main.c | | | 66 | +++++++++++++++++++++++++++++++++--------------------------------- |
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/main.c b/main.c
@@ -129,20 +129,38 @@ 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 'p':
- s.port = EARGF(usage());
- break;
- case 'U':
- udsname = EARGF(usage());
+ case 'i':
+ s.docindex = EARGF(usage());
+ if (strchr(s.docindex, '/')) {
+ die("The document index must not contain '/'");
+ }
break;
- case 'u':
- user = EARGF(usage());
+ case 'l':
+ s.listdirs = 1;
break;
- case 'g':
- group = EARGF(usage());
+ 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);
@@ -150,17 +168,14 @@ main(int argc, char *argv[])
die("strtonum '%s': %s", EARGF(usage()), err);
}
break;
- case 'd':
- servedir = EARGF(usage());
+ case 'p':
+ s.port = EARGF(usage());
break;
- case 'l':
- s.listdirs = 1;
+ case 'U':
+ udsname = EARGF(usage());
break;
- case 'i':
- s.docindex = EARGF(usage());
- if (strchr(s.docindex, '/')) {
- die("The document index must not contain '/'");
- }
+ case 'u':
+ user = EARGF(usage());
break;
case 'v':
if (!(tok = strdup(EARGF(usage())))) {
@@ -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