mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Re-arrange usage().
This commit is contained in:
parent
910298566f
commit
e8c3e92aa9
75
darkhttpd.c
75
darkhttpd.c
@ -840,58 +840,35 @@ static void init_sockin(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void) {
|
static void usage(const char *argv0) {
|
||||||
printf("\n"
|
printf("usage:\t%s /path/to/wwwroot [flags]\n\n", argv0);
|
||||||
"usage: darkhttpd /path/to/wwwroot [options]\n\n"
|
printf("flags:\t--port number (default: %u, or 80 if running as root)\n"
|
||||||
"options:\n\n");
|
"\t\tSpecifies which port to listen on for connections.\n\n", bindport);
|
||||||
printf(
|
printf("\t--addr ip (default: all)\n"
|
||||||
"\t--port number (default: %u, or 80 if running as root)\n" /* bindport */
|
|
||||||
"\t\tSpecifies which port to listen on for connections.\n"
|
|
||||||
"\n", bindport);
|
|
||||||
printf(
|
|
||||||
"\t--addr ip (default: all)\n"
|
|
||||||
"\t\tIf multiple interfaces are present, specifies\n"
|
"\t\tIf multiple interfaces are present, specifies\n"
|
||||||
"\t\twhich one to bind the listening port to.\n"
|
"\t\twhich one to bind the listening port to.\n\n");
|
||||||
"\n");
|
printf("\t--maxconn number (default: system maximum)\n"
|
||||||
printf(
|
"\t\tSpecifies how many concurrent connections to accept.\n\n");
|
||||||
"\t--maxconn number (default: system maximum)\n"
|
printf("\t--log filename (default: stdout)\n"
|
||||||
"\t\tSpecifies how many concurrent connections to accept.\n"
|
"\t\tSpecifies which file to append the request log to.\n\n");
|
||||||
"\n");
|
printf("\t--chroot (default: don't chroot)\n"
|
||||||
printf(
|
"\t\tLocks server into wwwroot directory for added security.\n\n");
|
||||||
"\t--log filename (default: stdout)\n"
|
printf("\t--daemon (default: don't daemonize)\n"
|
||||||
"\t\tSpecifies which file to append the request log to.\n"
|
"\t\tDetach from the controlling terminal and run in the background.\n\n");
|
||||||
"\n");
|
printf("\t--index filename (default: %s)\n"
|
||||||
printf(
|
"\t\tDefault file to serve when a directory is requested.\n\n",
|
||||||
"\t--chroot (default: don't chroot)\n"
|
index_name);
|
||||||
"\t\tLocks server into wwwroot directory for added security.\n"
|
printf("\t--mimetypes filename (optional)\n"
|
||||||
"\n");
|
"\t\tParses specified file for extension-MIME associations.\n\n");
|
||||||
printf(
|
printf("\t--uid uid/uname, --gid gid/gname (default: don't privdrop)\n"
|
||||||
"\t--daemon (default: don't daemonize)\n"
|
"\t\tDrops privileges to given uid:gid after initialization.\n\n");
|
||||||
"\t\tDetach from the controlling terminal and run in the background.\n"
|
printf("\t--pidfile filename (default: no pidfile)\n"
|
||||||
"\n");
|
|
||||||
printf(
|
|
||||||
"\t--index filename (default: %s)\n" /* index_name */
|
|
||||||
"\t\tDefault file to serve when a directory is requested.\n"
|
|
||||||
"\n", index_name);
|
|
||||||
printf(
|
|
||||||
"\t--mimetypes filename (optional)\n"
|
|
||||||
"\t\tParses specified file for extension-MIME associations.\n"
|
|
||||||
"\n");
|
|
||||||
printf(
|
|
||||||
"\t--uid uid/uname, --gid gid/gname (default: don't privdrop)\n"
|
|
||||||
"\t\tDrops privileges to given uid:gid after initialization.\n"
|
|
||||||
"\n");
|
|
||||||
printf(
|
|
||||||
"\t--pidfile filename (default: no pidfile)\n"
|
|
||||||
"\t\tWrite PID to the specified file. Note that if you are\n"
|
"\t\tWrite PID to the specified file. Note that if you are\n"
|
||||||
"\t\tusing --chroot, then the pidfile must be relative to,\n"
|
"\t\tusing --chroot, then the pidfile must be relative to,\n"
|
||||||
"\t\tand inside the wwwroot.\n"
|
"\t\tand inside the wwwroot.\n\n");
|
||||||
"\n");
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
printf(
|
printf("\t--accf (default: don't use acceptfilter)\n"
|
||||||
"\t--accf (default: don't use acceptfilter)\n"
|
"\t\tUse acceptfilter. Needs the accf_http module loaded.\n\n");
|
||||||
"\t\tUse acceptfilter. Needs the accf_http module loaded.\n"
|
|
||||||
"\n");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,7 +891,7 @@ static void parse_commandline(const int argc, char *argv[]) {
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if ((argc < 2) || (argc == 2 && strcmp(argv[1], "--help") == 0)) {
|
if ((argc < 2) || (argc == 2 && strcmp(argv[1], "--help") == 0)) {
|
||||||
usage(); /* no wwwroot given */
|
usage(argv[0]); /* no wwwroot given */
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user