version 1.1.1.2, 2010/09/20 23:07:21 |
version 1.1.1.3, 2011/11/18 09:40:36 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/* $eterna: main.c,v 1.4 2010/07/11 00:34:28 mrg Exp $ */ |
/* $eterna: main.c,v 1.6 2011/11/18 09:21:15 mrg Exp $ */ |
/* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */ |
/* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */ |
|
|
/* |
/* |
* Copyright (c) 1997-2010 Matthew R. Green |
* Copyright (c) 1997-2011 Matthew R. Green |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
#include <time.h> |
#include <time.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
#ifndef __attribute__ |
|
#define __attribute__(x) |
|
#endif /* __attribute__ */ |
|
|
|
#include "bozohttpd.h" |
#include "bozohttpd.h" |
|
|
/* variables and functions */ |
/* variables and functions */ |
|
|
#endif |
#endif |
|
|
/* print a usage message, and then exit */ |
/* print a usage message, and then exit */ |
static void |
BOZO_DEAD static void |
usage(bozohttpd_t *httpd, char *progname) |
usage(bozohttpd_t *httpd, char *progname) |
{ |
{ |
bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]", |
bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]", |
Line 83 usage(bozohttpd_t *httpd, char *progname |
|
Line 79 usage(bozohttpd_t *httpd, char *progname |
|
bozo_warn(httpd, |
bozo_warn(httpd, |
" -c cgibin\t\tenable cgi-bin support in this directory"); |
" -c cgibin\t\tenable cgi-bin support in this directory"); |
#endif |
#endif |
|
bozo_warn(httpd, " -I port\t\tbind or use on this port"); |
#ifndef NO_DAEMON_MODE |
#ifndef NO_DAEMON_MODE |
bozo_warn(httpd, " -b\t\t\tbackground and go into daemon mode"); |
bozo_warn(httpd, " -b\t\t\tbackground and go into daemon mode"); |
bozo_warn(httpd, " -f\t\t\tkeep daemon mode in the foreground"); |
bozo_warn(httpd, " -f\t\t\tkeep daemon mode in the foreground"); |
bozo_warn(httpd, |
bozo_warn(httpd, |
" -i address\t\tbind on this address (daemon mode only)"); |
" -i address\t\tbind on this address (daemon mode only)"); |
bozo_warn(httpd, " -I port\t\tbind on this port (daemon mode only)"); |
bozo_warn(httpd, " -P pidfile\t\tpath to the pid file to create"); |
#endif |
#endif |
bozo_warn(httpd, " -S version\t\tset server version string"); |
bozo_warn(httpd, " -S version\t\tset server version string"); |
bozo_warn(httpd, " -t dir\t\tchroot to `dir'"); |
bozo_warn(httpd, " -t dir\t\tchroot to `dir'"); |
Line 141 main(int argc, char **argv) |
|
Line 138 main(int argc, char **argv) |
|
bozo_set_defaults(&httpd, &prefs); |
bozo_set_defaults(&httpd, &prefs); |
|
|
while ((c = getopt(argc, argv, |
while ((c = getopt(argc, argv, |
"C:HI:M:S:U:VXZ:bc:defhi:np:rst:uv:x:z:")) != -1) { |
"C:HI:M:P:S:U:VXZ:bc:defhi:np:rst:uv:x:z:")) != -1) { |
switch(c) { |
switch(c) { |
|
|
case 'M': |
case 'M': |
Line 201 main(int argc, char **argv) |
|
Line 198 main(int argc, char **argv) |
|
bozo_set_pref(&prefs, "index.html", optarg); |
bozo_set_pref(&prefs, "index.html", optarg); |
break; |
break; |
|
|
|
case 'I': |
|
bozo_set_pref(&prefs, "port number", optarg); |
|
break; |
|
|
#ifdef NO_DAEMON_MODE |
#ifdef NO_DAEMON_MODE |
case 'b': |
case 'b': |
case 'e': |
case 'e': |
case 'f': |
case 'f': |
case 'i': |
case 'i': |
case 'I': |
case 'P': |
bozo_err(&httpd, 1, "Daemon mode is not enabled"); |
bozo_err(&httpd, 1, "Daemon mode is not enabled"); |
/* NOTREACHED */ |
/* NOTREACHED */ |
#else |
#else |
Line 235 main(int argc, char **argv) |
|
Line 236 main(int argc, char **argv) |
|
bozo_set_pref(&prefs, "bind address", optarg); |
bozo_set_pref(&prefs, "bind address", optarg); |
break; |
break; |
|
|
case 'I': |
case 'P': |
bozo_set_pref(&prefs, "port number", optarg); |
bozo_set_pref(&prefs, "pid file", optarg); |
break; |
break; |
#endif /* NO_DAEMON_MODE */ |
#endif /* NO_DAEMON_MODE */ |
|
|