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

13
quark.c
View file

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