Allow switching vhosts using flags and rework the usage

This commit is contained in:
Laslo Hunhold 2017-07-11 15:02:00 +02:00
parent 141bb88af1
commit d3c1091669
2 changed files with 18 additions and 18 deletions

23
quark.1
View file

@ -1,24 +1,21 @@
.Dd 2016-09-02 .Dd 2017-07-11
.Dt QUARK 1 .Dt QUARK 1
.Sh NAME .Sh NAME
.Nm quark .Nm quark
.Nd simple web server .Nd simple web server
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl l | L
.Op Fl v | V
.Oo
.Oo
.Op Fl h Ar host .Op Fl h Ar host
.Op Fl p Ar port .Op Fl p Ar port
.Op Fl v .Oc
.Op Fl d Ar dir |
.Op Fl l
.Op Fl L
.Op Fl u Ar user
.Op Fl g Ar group
.Nm
.Op Fl U Ar sockfile .Op Fl U Ar sockfile
.Op Fl v .Oc
.Op Fl d Ar dir .Op Fl d Ar dir
.Op Fl l
.Op Fl L
.Op Fl u Ar user .Op Fl u Ar user
.Op Fl g Ar group .Op Fl g Ar group
.Sh DESCRIPTION .Sh DESCRIPTION
@ -57,7 +54,9 @@ Create the UNIX-domain socket file
and listen on it for incoming connections. and listen on it for incoming connections.
The file will be cleaned up at exit. The file will be cleaned up at exit.
.It Fl v .It Fl v
Print version information to stdout and exit. Disable virtual hosts.
.It Fl V
Enable virtual hosts.
.El .El
.Sh CUSTOMIZATION .Sh CUSTOMIZATION
.Nm .Nm

13
quark.c
View file

@ -940,10 +940,8 @@ sigcleanup(int sig)
static void static void
usage(void) usage(void)
{ {
char *opts = "[-v] [-d dir] [-l] [-L] [-u user] [-g group]"; die("usage: %s [-l | -L] [-v | -V] [[[-h host] [-p port]] | [-U sockfile]] "
"[-d dir] [-u user] [-g group]\n", argv0);
die("usage: %s [-h host] [-p port] %s\n"
" %s [-U sockfile] %s\n", argv0, opts, argv0, opts);
} }
int int
@ -981,8 +979,11 @@ main(int argc, char *argv[])
udsname = EARGF(usage()); udsname = EARGF(usage());
break; break;
case 'v': case 'v':
fputs("quark-"VERSION"\n", stderr); vhosts = 0;
return 0; break;
case 'V':
vhosts = 1;
break;
default: default:
usage(); usage();
} ARGEND } ARGEND