summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-04-20 23:03:32 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-04-20 23:03:32 +0300
commite36b8e6c014df07a0973d56d1135c8bdde55aac3 (patch)
tree6e89ce2dd8df9513a5510701519bd35cbda9faf5
parentcebe7290369abc0dfbe8040ef89cca443715ab39 (diff)
downloadfileserv-e36b8e6c014df07a0973d56d1135c8bdde55aac3.tar.gz
fileserv-e36b8e6c014df07a0973d56d1135c8bdde55aac3.tar.bz2
Restore the -a, -u, and -g options.
-rw-r--r--src/fileserv.828
-rw-r--r--src/fileserv.c33
2 files changed, 54 insertions, 7 deletions
diff --git a/src/fileserv.8 b/src/fileserv.8
index 6014fad..a0204a3 100644
--- a/src/fileserv.8
+++ b/src/fileserv.8
@@ -21,3 +21,6 @@ fileserv \- simple http server for static files
[\fB\-fhsv\fR]\
+ [\fB\-a\fR [\fIIP\fR][\fB:\fIPORT\fR]]\
[\fB\-c\fR \fIFILE\fR]\
+ [\fB\-g\fR \fIGROUP\fR]\
+ [\fB\-u\fR \fIUSER\fR]\
[\fIHOST\fB:\fR]\fIURL\fB:\fIDIR\fR ...
@@ -47,2 +50,9 @@ produced.
.TP
+\fB\-a [\fIIP\fR][\fB:\fIPORT\fR]
+Listen on the given IP address and port. Either \fIIP\fR or \fIPORT\fR (but
+not both) can be omitted. If \fIIP\fR is omitted, the colon must be
+retained.
+.sp
+This option overrides the \fBlisten\fRv configuration setting.
+.TP
\fB\-c \fIFILE\fB
@@ -53,2 +63,12 @@ Run in foreground.
.TP
+.BI \-g " GROUP"
+Run with this primary group privileges. \fIGROUP\fR must be either the
+name of a group listed in the user database, or a numeric GID prefixed
+with a plus sign.
+.sp
+This option overrides the \fBgroup\fR configuration setting.
+.TP
+.B \-h
+Display a terse command line summary and exit.
+.TP
.B \-s
@@ -57,4 +77,8 @@ start a sentinel process.
.TP
-.B \-h
-Display a terse command line summary and exit.
+.BI \-u " USER"
+Run with this user privileges. \fIUSER\fR must be either the
+name of a user listed in the system user database, or a numeric UID
+prefixed with a plus sign.
+.sp
+This option overrides the \fBuser\fR configuration setting.
.TP
diff --git a/src/fileserv.c b/src/fileserv.c
index b760a9a..dbe2eb2 100644
--- a/src/fileserv.c
+++ b/src/fileserv.c
@@ -92,5 +92,9 @@ usage(void)
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");
@@ -769,3 +773,6 @@ main(int argc, char **argv)
int single_process = 0;
-
+ char *opt_address = NULL;
+ char *opt_user = NULL;
+ char *opt_group = NULL;
+
progname = basename(argv[0]);
@@ -777,4 +784,7 @@ main(int argc, char **argv)
- 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':
@@ -785,4 +795,4 @@ main(int argc, char **argv)
break;
- case 's':
- single_process = 1;
+ case 'g':
+ opt_group = optarg;
break;
@@ -791,2 +801,8 @@ main(int argc, char **argv)
exit(0);
+ case 's':
+ single_process = 1;
+ break;
+ case 'u':
+ opt_user = optarg;
+ break;
case 'v':
@@ -801,2 +817,9 @@ main(int argc, char **argv)
+ if (opt_address)
+ address = xstrdup(opt_address);
+ if (opt_user)
+ user = xstrdup(opt_user);
+ if (opt_group)
+ group = xstrdup(opt_group);
+
pidfile_check();
@@ -804,3 +827,3 @@ main(int argc, char **argv)
if (mime_types_file) {
- mimetypes_parse (mime_types_file); //FIXME: diag
+ mimetypes_parse(mime_types_file); //FIXME: diag
}

Return to:

Send suggestions and report system problems to the System administrator.