2 * $Id: chttpd.cpp,v 1.3 2005/10/18 11:30:19 digi_casi Exp $
4 * (C) 2005 by digi_casi <digi_casi@tuxbox.org>
5 * based on nhttpd (C) 2001/2002 Dirk Szymanski
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifdef ENABLE_EXPERT_WEBIF
24 #define CHTTPD_VERSION "0.1"
27 #include <sys/types.h>
30 #include "webserver.h"
32 #include <chttpd/chttpdconfig.h>
36 CWebserver
*webserver
;
39 void sig_catch(int msignal
)
44 aprintf("got signal HUP, reading config\n");
48 aprintf("stop requested...\n");
55 int main(int argc
, char **argv
)
64 for (i
= 1; i
< argc
; i
++)
67 if (strncmp(argv
[i
], "-d", 2) == 0)
69 CDEBUG::getInstance()->Debug
= true;
74 if (strncmp(argv
[i
], "-f", 2) == 0)
78 else if (strncmp(argv
[i
],"--version", 9) == 0)
80 printf("chttp - Webserver\n");
81 printf("Version: %s\n", CHTTPD_VERSION
);
84 else if ((strncmp(argv
[i
], "--help", 6) == 0) || (strncmp(argv
[i
], "-h", 2) == 0))
86 printf("chttpd parameters:\n");
87 printf("-d\t\tdebug\n");
88 printf("-f\t\tdo not fork\n");
89 printf("--version\tversion\n");
90 printf("--help\t\tthis text\n\n");
96 signal(SIGINT
,sig_catch
);
97 signal(SIGHUP
,sig_catch
);
98 signal(SIGTERM
,sig_catch
);
100 aprintf("HTTP-Server starting..\n");
117 dperror("[chttpd] Error setsid");
122 if ((webserver
= new CWebserver(debug
)) != NULL
)
124 if (webserver
->Start())
132 aprintf("Error initializing chttpd\n");
139 int main(int argc
, char **argv
)