int main(int argc, char **argv) { int nchildren = 1; int c; while ((c = getopt(argc, argv, "c:")) != -1) { switch (c) { case 'c': nchildren = atoi(optarg); break; case '?': if (optopt == 'c') fprintf(stderr, "Option -%c requires an argument.\n", optopt); else if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt); else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); return 1; default: abort(); } } prefork(nchildren); fcgiwrap_main(); return 0; }
int main(int argc, char **argv) { int c; memset( &fcgiwrap_cfg, 0, sizeof(struct fcgiwrap_cfg_st)); while ((c = getopt(argc, argv, "c:fh")) != -1) { switch (c) { case 'h': exit( usage() ); case 'f': fcgiwrap_cfg.fix_path_info = 1; break; case '?': if (optopt == 'c') fprintf(stderr, "Option -%c requires an argument.\n", optopt); else if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt); else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); return 1; default: abort(); } } fcgiwrap_main(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { int nchildren = 1; char *socket_url = NULL; int c; while ((c = getopt(argc, argv, "c:hfs:")) != -1) { switch (c) { case 'f': stderr_to_fastcgi++; break; case 'h': printf("Usage: %s [OPTION]\nInvokes CGI scripts as FCGI.\n\n" PACKAGE_NAME" version "PACKAGE_VERSION"\n\n" "Options are:\n" " -c <number>\t\tNumber of processes to prefork\n" " -s <socket_url>\tSocket to bind to (say -s help for help)\n" " -h\t\t\tShow this help message and exit\n" "\nReport bugs to Grzegorz Nosek <"PACKAGE_BUGREPORT">.\n" PACKAGE_NAME" home page: <http://nginx.localdomain.pl/wiki/FcgiWrap>\n", argv[0] ); return 0; case 'c': nchildren = atoi(optarg); break; case 's': socket_url = strdup(optarg); break; case '?': if (optopt == 'c' || optopt == 's') fprintf(stderr, "Option -%c requires an argument.\n", optopt); else if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt); else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); return 1; default: abort(); } } if (socket_url) { if (setup_socket(socket_url) < 0) { return 1; } free(socket_url); } prefork(nchildren); fcgiwrap_main(); return 0; }