From 48ddb8fefb512effefd9b761efa25fd9158e2edc Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Sat, 23 Feb 2019 13:50:59 +0100 Subject: [PATCH] Sort flag-switch alphabetically Signed-off-by: Laslo Hunhold --- main.c | 72 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/main.c b/main.c index e9d0a06..9d193a5 100644 --- a/main.c +++ b/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