diff --git a/config.def.h b/config.def.h index 9a679cf..ca8d05a 100644 --- a/config.def.h +++ b/config.def.h @@ -1,14 +1,14 @@ /* quark configuration */ -static const char servername[] = "192.168.1.66"; -static const char serverport[] = "80"; -static const char docroot[] = "."; -static const char docindex[] = "index.html"; -static const char user[] = "nobody"; -static const char group[] = "nobody"; -static const char cgi_dir[] = "/var/www/werc-dev/bin"; -static const char cgi_script[] = "./werc.rc"; -static const int cgi_mode = 0; +static char *servername = "127.0.0.1"; +static char *serverport = "80"; +static char *docroot = "."; +static char *docindex = "index.html"; +static char *user = "nobody"; +static char *group = "nobody"; +static char *cgi_dir = "/var/www/werc-dev/bin"; +static char *cgi_script = "./werc.rc"; +static int cgi_mode = 0; static const MimeType servermimes[] = { { "html", "text/html; charset=UTF-8" }, diff --git a/quark.c b/quark.c index 94e37eb..bb5d836 100644 --- a/quark.c +++ b/quark.c @@ -459,10 +459,42 @@ main(int argc, char *argv[]) { /* arguments */ 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"); else - die("usage: quark [-v]\n"); + die("usage: quark [-n ]\n" + " [-p ]\n" + " [-r ]\n" + " [-i ]\n" + " [-u ]\n" + " [-g ]\n" + " [-c ]\n" + " [-v]\n"); /* sanity checks */ if(!(upwd = getpwnam(user)))