added -x to cmd/httpd.c

This commit is contained in:
hyung-hwan 2013-02-22 05:08:22 +00:00
parent 624a917b45
commit f3d6d8a0e1
2 changed files with 9 additions and 4 deletions

View File

@ -43,6 +43,7 @@
static qse_httpd_t* g_httpd = QSE_NULL; static qse_httpd_t* g_httpd = QSE_NULL;
static const qse_char_t* g_cfgfile = QSE_NULL; static const qse_char_t* g_cfgfile = QSE_NULL;
static int g_daemon = 0; static int g_daemon = 0;
static int g_debug = 0;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -1108,6 +1109,7 @@ static void print_usage (QSE_FILE* out, int argc, qse_char_t* argv[])
qse_fprintf (out, QSE_T(" --version show version\n")); qse_fprintf (out, QSE_T(" --version show version\n"));
qse_fprintf (out, QSE_T(" -c/--config-file file specify a configuration file\n")); qse_fprintf (out, QSE_T(" -c/--config-file file specify a configuration file\n"));
qse_fprintf (out, QSE_T(" -d/--daemon run in the background\n")); qse_fprintf (out, QSE_T(" -d/--daemon run in the background\n"));
qse_fprintf (out, QSE_T(" -x output debugging messages\n"));
} }
static int handle_args (int argc, qse_char_t* argv[]) static int handle_args (int argc, qse_char_t* argv[])
@ -1122,7 +1124,7 @@ static int handle_args (int argc, qse_char_t* argv[])
}; };
static qse_opt_t opt = static qse_opt_t opt =
{ {
QSE_T("c:dh"), QSE_T("c:dhx"),
lng lng
}; };
qse_cint_t c; qse_cint_t c;
@ -1160,6 +1162,10 @@ static int handle_args (int argc, qse_char_t* argv[])
print_usage (QSE_STDOUT, argc, argv); print_usage (QSE_STDOUT, argc, argv);
return 0; return 0;
case QSE_T('x'):
g_debug = 1;
break;
case QSE_T('\0'): case QSE_T('\0'):
{ {
if (qse_strcmp(opt.lngopt, QSE_T("version")) == 0) if (qse_strcmp(opt.lngopt, QSE_T("version")) == 0)
@ -1233,7 +1239,7 @@ static int httpd_main (int argc, qse_char_t* argv[])
qse_httpd_getopt (httpd, QSE_HTTPD_RCB, &rcb); qse_httpd_getopt (httpd, QSE_HTTPD_RCB, &rcb);
httpd_xtn->orgimpede = rcb.impede; httpd_xtn->orgimpede = rcb.impede;
rcb.impede = impede_httpd; /* executed when qse_httpd_impede() is called */ rcb.impede = impede_httpd; /* executed when qse_httpd_impede() is called */
rcb.logact = logact_httpd; /* i don't remember this */ if (g_debug) rcb.logact = logact_httpd; /* i don't remember old logging handler */
qse_httpd_setopt (httpd, QSE_HTTPD_RCB, &rcb); qse_httpd_setopt (httpd, QSE_HTTPD_RCB, &rcb);
ret = qse_httpd_loopstd (httpd); ret = qse_httpd_loopstd (httpd);

View File

@ -12,8 +12,7 @@ default {
realm = "default realm"; realm = "default realm";
auth = "username:password"; auth = "username:password";
index = "index.ant", index = "index.html",
"index.html",
"index.cgi"; "index.cgi";
cgi { cgi {