Module Name: src Committed By: mrg Date: Thu Nov 22 18:21:59 UTC 2018
Modified Files: src/libexec/httpd: main.c Log Message: alpha sort the option switch. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/libexec/httpd/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/httpd/main.c diff -u src/libexec/httpd/main.c:1.19 src/libexec/httpd/main.c:1.20 --- src/libexec/httpd/main.c:1.19 Thu Nov 22 08:54:08 2018 +++ src/libexec/httpd/main.c Thu Nov 22 18:21:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.19 2018/11/22 08:54:08 mrg Exp $ */ +/* $NetBSD: main.c,v 1.20 2018/11/22 18:21:59 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 */ @@ -163,92 +163,53 @@ main(int argc, char **argv) "C:EGHI:L:M:P:S:T:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) { switch (c) { - case 'L': - if (!have_lua) - bozoerr(&httpd, 1, "Lua support not enabled"); - - /* make sure there's two argument */ - if (argc - optind < 1) - usage(&httpd, progname); - bozo_add_lua_map(&httpd, optarg, argv[optind]); - optind++; - break; - case 'M': - if (!have_dynamic_content) - bozoerr(&httpd, 1, - "dynamic mime content support not enabled"); + case 'b': + if (!have_daemon_mode) + no_daemon_mode: + bozoerr(&httpd, 1, "Daemon mode not enabled"); - /* make sure there're four arguments */ - if (argc - optind < 3) - usage(&httpd, progname); - bozo_add_content_map_mime(&httpd, optarg, argv[optind], - argv[optind+1], argv[optind+2]); - optind += 3; + /* + * test suite support - undocumented + * background == 2 (aka, -b -b) means to + * only process 1 per kid + */ + val = bozo_get_pref(&prefs, "background") == NULL ? + "1" : "2"; + bozo_set_pref(&httpd, &prefs, "background", val); break; - case 'n': - bozo_set_pref(&httpd, &prefs, "numeric", "true"); - break; + case 'c': + if (!have_cgibin) + bozoerr(&httpd, 1, "CGI not enabled"); - case 's': - bozo_set_pref(&httpd, &prefs, "log to stderr", "true"); + bozo_cgi_setbin(&httpd, optarg); break; - case 'S': - bozo_set_pref(&httpd, &prefs, "server software", - optarg); - break; - case 'Z': - if (!have_ssl) - no_ssl: - bozoerr(&httpd, 1, "ssl support not enabled"); + case 'C': + if (!have_dynamic_content && !have_cgibin) + bozoerr(&httpd, 1, + "dynamic CGI handler support not enabled"); /* make sure there's two arguments */ if (argc - optind < 1) usage(&httpd, progname); - bozo_ssl_set_opts(&httpd, optarg, argv[optind++]); - break; - - case 'z': - if (!have_ssl) - goto no_ssl; - - bozo_ssl_set_ciphers(&httpd, optarg); - break; - - case 'U': - bozo_set_pref(&httpd, &prefs, "username", optarg); - break; - - case 'V': - bozo_set_pref(&httpd, &prefs, "unknown slash", "true"); - break; - - case 'v': - bozo_set_pref(&httpd, &prefs, "virtual base", optarg); - break; - - case 'x': - bozo_set_pref(&httpd, &prefs, "index.html", optarg); + bozo_add_content_map_cgi(&httpd, optarg, + argv[optind++]); break; - case 'I': - bozo_set_pref(&httpd, &prefs, "port number", optarg); + case 'd': + if (!have_debug) + bozowarn(&httpd, "Debugging not enabled"); + httpd.debug++; break; - case 'b': - if (!have_daemon_mode) - no_daemon_mode: - bozoerr(&httpd, 1, "Daemon mode not enabled"); + case 'E': + if (have_user && + have_cgibin) + bozoerr(&httpd, 1, "CGI not enabled"); - /* - * test suite support - undocumented - * background == 2 (aka, -b -b) means to - * only process 1 per kid - */ - val = bozo_get_pref(&prefs, "background") == NULL ? - "1" : "2"; - bozo_set_pref(&httpd, &prefs, "background", val); + bozo_set_pref(&httpd, &prefs, "enable user cgibin", + "true"); break; case 'e': @@ -266,11 +227,58 @@ main(int argc, char **argv) bozo_set_pref(&httpd, &prefs, "foreground", "true"); break; + case 'G': + { + char version[128]; + + bozo_get_version(version, sizeof(version)); + printf("bozohttpd version %s\n", version); + } + return 0; + + case 'H': + if (!have_dirindex) + no_dirindex_support: + bozoerr(&httpd, 1, + "directory indexing not enabled"); + + bozo_set_pref(&httpd, &prefs, "hide dots", "true"); + break; + + case 'I': + bozo_set_pref(&httpd, &prefs, "port number", optarg); + break; + case 'i': if (!have_daemon_mode) goto no_daemon_mode; - bozo_set_pref(&httpd, &prefs, "bind address", optarg); + case 'L': + if (!have_lua) + bozoerr(&httpd, 1, "Lua support not enabled"); + + /* make sure there's two argument */ + if (argc - optind < 1) + usage(&httpd, progname); + bozo_add_lua_map(&httpd, optarg, argv[optind]); + optind++; + break; + + case 'M': + if (!have_dynamic_content) + bozoerr(&httpd, 1, + "dynamic mime content support not enabled"); + + /* make sure there're four arguments */ + if (argc - optind < 3) + usage(&httpd, progname); + bozo_add_content_map_mime(&httpd, optarg, argv[optind], + argv[optind+1], argv[optind+2]); + optind += 3; + break; + + case 'n': + bozo_set_pref(&httpd, &prefs, "numeric", "true"); break; case 'P': @@ -280,41 +288,42 @@ main(int argc, char **argv) bozo_set_pref(&httpd, &prefs, "pid file", optarg); break; - case 'c': - if (!have_cgibin) - bozoerr(&httpd, 1, "CGI not enabled"); + case 'p': + if (!have_user) + no_user_support: + bozoerr(&httpd, 1, "User support not enabled"); - bozo_cgi_setbin(&httpd, optarg); + bozo_set_pref(&httpd, &prefs, "public_html", optarg); break; - case 'C': - if (!have_dynamic_content && !have_cgibin) - bozoerr(&httpd, 1, - "dynamic CGI handler support not enabled"); + case 'S': + bozo_set_pref(&httpd, &prefs, "server software", + optarg); + break; - /* make sure there's two arguments */ - if (argc - optind < 1) - usage(&httpd, progname); - bozo_add_content_map_cgi(&httpd, optarg, - argv[optind++]); + case 's': + bozo_set_pref(&httpd, &prefs, "log to stderr", "true"); break; - case 'd': - if (!have_debug) - bozowarn(&httpd, "Debugging not enabled"); - httpd.debug++; + case 'T': + /* make sure there're two arguments */ + if (argc - optind < 1) + usage(&httpd, progname); + if (bozo_set_timeout(&httpd, &prefs, + optarg, argv[optind])) { + bozoerr(&httpd, 1, + "invalid type '%s'", optarg); + /* NOTREACHED */ + } + optind++; break; case 't': bozo_set_pref(&httpd, &prefs, "chroot dir", optarg); break; - case 'p': - if (!have_user) - no_user_support: - bozoerr(&httpd, 1, "User support not enabled"); - - bozo_set_pref(&httpd, &prefs, "public_html", optarg); + case 'U': + bozo_set_pref(&httpd, &prefs, "username", optarg); break; case 'u': @@ -324,52 +333,45 @@ main(int argc, char **argv) bozo_set_pref(&httpd, &prefs, "enable users", "true"); break; - case 'E': - if (have_user && - have_cgibin) - bozoerr(&httpd, 1, "CGI not enabled"); - - bozo_set_pref(&httpd, &prefs, "enable user cgibin", + bozo_set_pref(&httpd, &prefs, "directory indexing", "true"); break; - case 'H': - if (!have_dirindex) - no_dirindex_support: - bozoerr(&httpd, 1, - "directory indexing not enabled"); + case 'V': + bozo_set_pref(&httpd, &prefs, "unknown slash", "true"); + break; - bozo_set_pref(&httpd, &prefs, "hide dots", "true"); + case 'v': + bozo_set_pref(&httpd, &prefs, "virtual base", optarg); break; case 'X': if (!have_dirindex) goto no_dirindex_support; - bozo_set_pref(&httpd, &prefs, "directory indexing", - "true"); + case 'x': + bozo_set_pref(&httpd, &prefs, "index.html", optarg); break; - case 'G': - { - char version[128]; - - bozo_get_version(version, sizeof(version)); - printf("bozohttpd version %s\n", version); - } - return 0; + case 'Z': + if (!have_ssl) + no_ssl: + bozoerr(&httpd, 1, "ssl support not enabled"); - case 'T': - /* make sure there're two arguments */ + /* make sure there's two arguments */ if (argc - optind < 1) usage(&httpd, progname); - if (bozo_set_timeout(&httpd, &prefs, - optarg, argv[optind])) { - bozoerr(&httpd, 1, - "invalid type '%s'", optarg); - /* NOTREACHED */ - } - optind++; + bozo_ssl_set_opts(&httpd, optarg, argv[optind++]); + break; + + case 'z': + if (!have_ssl) + goto no_ssl; + + bozo_ssl_set_ciphers(&httpd, optarg); + break; + + bozo_set_pref(&httpd, &prefs, "bind address", optarg); break; default: