summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/fileserv.85
-rw-r--r--src/fileserv.c57
3 files changed, 44 insertions, 20 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d871c86..e943d6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,2 +1,2 @@
-bin_PROGRAMS=fileserv
+sbin_PROGRAMS=fileserv
fileserv_SOURCES=fileserv.c runas.c fileserv.h logger.c pidfile.c\
diff --git a/src/fileserv.8 b/src/fileserv.8
index a0204a3..11129f0 100644
--- a/src/fileserv.8
+++ b/src/fileserv.8
@@ -15,3 +15,3 @@
.\" along with fileserv. If not, see <http://www.gnu.org/licenses/>.
-.TH FILESERV 8 "April 20, 2018" "FILESERV" "User Commands"
+.TH FILESERV 8 "April 21, 2018" "FILESERV" "User Commands"
.SH NAME
@@ -86,2 +86,5 @@ This option overrides the \fBuser\fR configuration setting.
Increase verbosity level. Multiple options accumulate.
+.TP
+.B \-V
+Show program version, license and copyright information.
.SH CONFIGURATION FILE
diff --git a/src/fileserv.c b/src/fileserv.c
index fb9811d..58262c3 100644
--- a/src/fileserv.c
+++ b/src/fileserv.c
@@ -37,3 +37,3 @@
char const *progname;
-int verbose; /* reserved for future use */
+int verbose; /* increase diagnostic verbosity */
char *address = DEFAULT_ADDRESS;
@@ -45,3 +45,36 @@ char *group;
char *mime_types_file;
+
+void
+usage(void)
+{
+ printf("usage: %s [OPTIONS] [HOST:]URL:DIR...\n", progname);
+ printf("Simple HTTP server.\n");
+ 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");
+ printf(" -V show program version\n");
+ printf("\n");
+}
+const char version_copyright[] = "Copyright (C) 2017-2018 Sergey Poznyakoff";
+const char gplv3[] = "\
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
+This is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\
+";
+
+static void
+show_version(void)
+{
+ printf("%s\n", PACKAGE_STRING);
+ printf("%s\n", version_copyright);
+ printf("\n%s\n\n", gplv3);
+}
+
static void
@@ -86,18 +119,3 @@ errno_to_http_code(int ec)
}
-
-void
-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");
-}
-
+
int
@@ -783,3 +801,3 @@ main(int argc, char **argv)
- while ((c = getopt(argc, argv, "a:c:fg:hsu:v")) != EOF) {
+ while ((c = getopt(argc, argv, "a:c:fg:hsu:vV")) != EOF) {
switch (c) {
@@ -809,2 +827,5 @@ main(int argc, char **argv)
break;
+ case 'V':
+ show_version();
+ exit(0);
default:

Return to:

Send suggestions and report system problems to the System administrator.