added command line interface
This commit is contained in:
parent
a20243ea7c
commit
3e45a7c0ba
2 changed files with 43 additions and 11 deletions
18
config.def.h
18
config.def.h
|
@ -1,14 +1,14 @@
|
||||||
/* quark configuration */
|
/* quark configuration */
|
||||||
|
|
||||||
static const char servername[] = "192.168.1.66";
|
static char *servername = "127.0.0.1";
|
||||||
static const char serverport[] = "80";
|
static char *serverport = "80";
|
||||||
static const char docroot[] = ".";
|
static char *docroot = ".";
|
||||||
static const char docindex[] = "index.html";
|
static char *docindex = "index.html";
|
||||||
static const char user[] = "nobody";
|
static char *user = "nobody";
|
||||||
static const char group[] = "nobody";
|
static char *group = "nobody";
|
||||||
static const char cgi_dir[] = "/var/www/werc-dev/bin";
|
static char *cgi_dir = "/var/www/werc-dev/bin";
|
||||||
static const char cgi_script[] = "./werc.rc";
|
static char *cgi_script = "./werc.rc";
|
||||||
static const int cgi_mode = 0;
|
static int cgi_mode = 0;
|
||||||
|
|
||||||
static const MimeType servermimes[] = {
|
static const MimeType servermimes[] = {
|
||||||
{ "html", "text/html; charset=UTF-8" },
|
{ "html", "text/html; charset=UTF-8" },
|
||||||
|
|
36
quark.c
36
quark.c
|
@ -459,10 +459,42 @@ main(int argc, char *argv[]) {
|
||||||
|
|
||||||
/* arguments */
|
/* arguments */
|
||||||
for(i = 1; i < argc; i++)
|
for(i = 1; i < argc; i++)
|
||||||
if(!strcmp(argv[i], "-v"))
|
if(!strcmp(argv[i], "-n")) {
|
||||||
|
if(++i < argc) servername = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-p")) {
|
||||||
|
if(++i < argc) serverport = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-r")) {
|
||||||
|
if(++i < argc) docroot = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-i")) {
|
||||||
|
if(++i < argc) docindex = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-u")) {
|
||||||
|
if(++i < argc) user = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-g")) {
|
||||||
|
if(++i < argc) group = argv[i];
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-c")) {
|
||||||
|
if(++i < argc) cgi_dir = argv[i];
|
||||||
|
if(++i < argc) {
|
||||||
|
cgi_script = argv[i];
|
||||||
|
cgi_mode = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!strcmp(argv[i], "-v"))
|
||||||
die("quark-"VERSION", © 2009-2010 Anselm R Garbe\n");
|
die("quark-"VERSION", © 2009-2010 Anselm R Garbe\n");
|
||||||
else
|
else
|
||||||
die("usage: quark [-v]\n");
|
die("usage: quark [-n <server-name>]\n"
|
||||||
|
" [-p <port>]\n"
|
||||||
|
" [-r <doc root>]\n"
|
||||||
|
" [-i <doc index>]\n"
|
||||||
|
" [-u <user>]\n"
|
||||||
|
" [-g <group>]\n"
|
||||||
|
" [-c <cgi dir> <cgi script>]\n"
|
||||||
|
" [-v]\n");
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
if(!(upwd = getpwnam(user)))
|
if(!(upwd = getpwnam(user)))
|
||||||
|
|
Loading…
Reference in a new issue