diff options
Diffstat (limited to 'src/fileserv.c')
-rw-r--r-- | src/fileserv.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/fileserv.c b/src/fileserv.c index b760a9a..dbe2eb2 100644 --- a/src/fileserv.c +++ b/src/fileserv.c @@ -90,9 +90,13 @@ usage(void) { printf("usage: %s [OPTIONS] [HOST:]URL:DIR...\n", progname); printf("OPTIONS are:\n\n"); + printf(" -a [IP]:PORT listen on this IP and PORT\n"); printf(" -c FILE read configuration from FILE\n"); printf(" -f remain in the foreground\n"); + printf(" -g GROUP run with this group privileges\n"); printf(" -h show this help summary\n"); + printf(" -s don't start sentinel process\n"); + printf(" -u USER run with this user privileges\n"); printf(" -v increase verbosity\n"); } @@ -767,7 +771,10 @@ main(int argc, char **argv) struct sockaddr *server_addr; int foreground = 0; int single_process = 0; - + char *opt_address = NULL; + char *opt_user = NULL; + char *opt_group = NULL; + progname = basename(argv[0]); mimetypes_error_printer = fileserv_error_printer; @@ -775,20 +782,29 @@ main(int argc, char **argv) if (!tmpdir) tmpdir = "/tmp"; - while ((c = getopt(argc, argv, "c:fshv")) != EOF) { + while ((c = getopt(argc, argv, "a:c:fg:hsu:v")) != EOF) { switch (c) { + case 'a': + opt_address = optarg; + break; case 'c': config_file = optarg; break; case 'f': foreground = 1; break; - case 's': - single_process = 1; + case 'g': + opt_group = optarg; break; case 'h': usage(); exit(0); + case 's': + single_process = 1; + break; + case 'u': + opt_user = optarg; + break; case 'v': verbose++; break; @@ -799,10 +815,17 @@ main(int argc, char **argv) readconfig(); + if (opt_address) + address = xstrdup(opt_address); + if (opt_user) + user = xstrdup(opt_user); + if (opt_group) + group = xstrdup(opt_group); + pidfile_check(); if (mime_types_file) { - mimetypes_parse (mime_types_file); //FIXME: diag + mimetypes_parse(mime_types_file); //FIXME: diag } fd = open_listener(address, &server_addr); |