int run(int argc, char *argv[]) { po::positional_options_description p; p.add("input", -1); try { po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm); po::notify(vm); if (vm.count("manager")) *manager_mode = true; if (vm.count("input")) *args = vm["input"].as < CmdArgs >(); if (vm.count("log-file")) *trace = 0; if (vm.count("log-stdout")) *trace = 1; if (vm.count("help")) return show_help(generic); if (vm.count("version")) return show_version(); if (vm.count("infos")) return show_infos(); if (vm.count("list")) return show_package_list(); if (vm.count("restart")) return remove_configuration_file(); if (vm.count("package")) return PROGRAM_OPTIONS_PACKAGE; if (vm.count("remote")) return PROGRAM_OPTIONS_REMOTE; if (vm.count("config")) return PROGRAM_OPTIONS_CONFIG; } catch (const std::exception &e) { std::cerr << e.what() << std::endl; return PROGRAM_OPTIONS_FAILURE; } std::cerr << _("Nothing to do. Use package, remote or config mode." " See the help.\n"); return PROGRAM_OPTIONS_END; }
int main(int argc, char ** argv) { #ifdef ENABLE_GETTEXT setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); #endif static struct option longopts[] = { { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "input", required_argument, NULL, 'i' }, { "output", required_argument, NULL, 'o' }, { "config", required_argument, NULL, 'c' }, { 0, 0, 0, 0 }, }; static int oc; static char *input_file, *output_file, *config_file; while((oc = getopt_long(argc, argv, "vh?i:o:c:", longopts, NULL)) != -1) { switch (oc) { case 'v': show_version(); return 0; case 'h': case '?': show_usage(); return 0; case 'i': input_file = mstrcpy(optarg); break; case 'o': output_file = mstrcpy(optarg); break; case 'c': config_file = mstrcpy(optarg); break; } } if (config_file == NULL) { config_file = mstrcpy(OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD); } convert(input_file, output_file, config_file); free(input_file); free(output_file); free(config_file); return 0; }
static void get_options(int argc, char **argv, const char *progname) { char c; while((c = getopt(argc, argv, "d:r:s:k:w:f:o:vh")) != (char) -1) { switch (c) { case 'r': repeat_filename = optarg; break; case 's': if(*optarg == 'd') { rectangle_size = -1; max_mem_kb = strtol(optarg + 1, 0, 10); if(max_mem_kb <= 0) max_mem_kb = ULONG_MAX; } else rectangle_size = atoi(optarg); if(rectangle_size == 0) { fprintf(stderr, "Invalid rectangle size %s\n", optarg); exit(1); } break; case 'k': kmer_size = atoi(optarg); break; case 'w': window_size = atoi(optarg); break; case 'o': output_filename = optarg; break; case 'd': debug_flags_set(optarg); break; case 'v': show_version(progname); exit(0); case 'h': show_help(progname); exit(0); } } if(argc - optind == 1) { sequence_filename = argv[optind++]; } else if(argc - optind == 2) { sequence_filename = argv[optind++]; second_sequence_filename = argv[optind++]; } else { show_help(progname); fprintf(stderr, "Incorrect number of arguments. Expected 1 or 2, got %d\n", argc - optind); exit(1); } }
static kbool_t konoha_shell(konoha_t konoha) { void *handler = dlopen("libreadline" K_OSDLLEXT, RTLD_LAZY); void *f = (handler != NULL) ? dlsym(handler, "readline") : NULL; kreadline = (f != NULL) ? (char* (*)(const char*))f : readline; f = (handler != NULL) ? dlsym(handler, "add_history") : NULL; kadd_history = (f != NULL) ? (int (*)(const char*))f : add_history; show_version((CTX_t)konoha); shell((CTX_t)konoha); return true; }
void show_usage (char *my_name) { show_version (my_name); fprintf (stderr, "\nusage: %s [options] port1 port2\n", my_name); fprintf (stderr, "Connects two JACK ports together.\n\n"); fprintf (stderr, " -s, --server <name> Connect to the jack server named <name>\n"); fprintf (stderr, " -v, --version Output version information and exit\n"); fprintf (stderr, " -h, --help Display this help message\n\n"); fprintf (stderr, "For more information see http://jackaudio.org/\n"); }
int main(int argc, char **argv) { MalelfDissect dissect; MalelfInfect infect; Disas disas; Database database; Analyse analyse; _u8 error = MALELF_SUCCESS; if (argc == 1) { _malelf_help(); return -1; } if (strncmp(argv[1], DISSECT, sizeof(DISSECT)) == 0) { error = malelf_dissect_init(&dissect, argc, argv); malelf_dissect_finish(&dissect); } else if (strncmp(argv[1], SHELLCODE, sizeof (SHELLCODE)) == 0) { malelf_shellcode_init(argc, argv); malelf_shellcode_finish(); } else if (strncmp(argv[1], INFECT, sizeof(INFECT)) == 0) { malelf_infect_init(&infect, argc, argv); malelf_infect_finish(&infect); } else if (strncmp(argv[1], DYNAMIC_ANALYSIS, sizeof(DYNAMIC_ANALYSIS)) == 0) { malelf_dynanalyse_init(argc, argv); malelf_dynanalyse_finish(); } else if (strncmp(argv[1], DISAS, sizeof(DISAS)) == 0) { disas_init(&disas, argc, argv); disas_finish(&disas); } else if (strncmp(argv[1], DATABASE, sizeof(DATABASE)) == 0) { database_init(&database, argc, argv); database_finish(&database); } else if (strncmp(argv[1], ANALYSE, sizeof(ANALYSE)) == 0) { error = analyse_init(&analyse, argc, argv); analyse_finish(&analyse); } else if (strncmp(argv[1], "-v", 2) || strncmp(argv[1], "--version", 9)) { show_version(*argv); } else { _malelf_help(); } if (MALELF_SUCCESS != error) { if (MALELF_ERROR != error) { MALELF_PERROR(error); } return error; } return 0; }
int main(int nArgc, char* Argv[]){ time_t nStartTm, nEndTm; int nRet; g_logFile = fopen("log.txt", "a"); if ( g_logFile == NULL ){ write_log(LT_SCREEN,"Error: Can't open log file!\n"); goto exit; } nStartTm = time(NULL); if ( nArgc == 1 ){ write_log(LT_SCREEN,"Error: the number of argument is error\n"); goto exit; } else if ( nArgc == 2 ){ if ( strcmp(Argv[1], "-h") == 0 ){ show_help(); return 0; } else if ( strcmp(Argv[1], "-v") == 0 ){ show_version(); return 0; } else { write_log(LT_SCREEN,"Error: invalid option '%s'\n", Argv[1]); goto exit; } } if (Exec_Command(Argv) == 0) goto exit; nRet = 0; goto exit2; exit: nRet = 1; write_log(LT_SCREEN,"Please add '-h' option to get the detail help!\n"); exit2: nEndTm = time(NULL); write_log(LT_BOTH,"\n--------------------------------------------------------\n"); write_log(LT_BOTH,"Task end, total use time: %d min, %d sec\n", (int)(nEndTm - nStartTm)/60, (int)(nEndTm - nStartTm)%60); db_uninit(); str_operate_uninit(); SAFE_CLOSE_FILE(g_logFile); return nRet; }
int main(int argc, char **argv) { int fin, res; off_t position; int optc; int optindex=0; struct option optvalues[] = { {"help", 0, 0, 'h'}, {"version", 0, 0, 'v'}, {NULL, 0, NULL, 0} }; if (argc < 2 || argc > 3) { usage("Missing or bad options/arguments"); exit(-1); } while (1) { optc=getopt_long_only(argc,argv,"hv", optvalues, &optindex); if (optc=='h') usage(NULL); else if (optc=='v') show_version(VERSION); else if (optc==-1) break; else usage("Unknown option or other error\n"); } if (optind >= argc) { usage("Missing filename argument."); } fin = open (argv[optind], O_RDONLY); if (fin < 0) { fprintf(stderr,"failed to open file %s for read\n", argv[optind]); exit(-1); } optind++; if (optind >= argc) { usage("Missing offset argument."); } position = atoll(argv[optind]); if (position <(off_t)0) { fprintf(stderr,"please specify an offset >= 0.\n"); fprintf(stderr,"usage: %s infile offset\n", argv[0]); exit(-1); } /* input file, starting position in file, length of buffer for reading */ res = dump_mw_header(fin); res = dump_from_first_page_id_after_offset(fin, position); exit(res); }
static void show_help(void) { show_version(); fprintf(stderr, "-h --help - show this text and exit\n" "-v --version - show version and exit\n" "-r --reader - the reader to use\n" "-w --wait - wait for a card to be inserted\n" "-p --print - print the datafile\n" "-t --stats - show usage counts of keys\n" "-x --exec - execute a program with data in env vars.\n"); }
void show_usage() { show_version(); printf(_("Usage:\n")); printf(_(" opencc_dict -i input_file -o output_file\n\n")); printf(_(" -i input_file\n")); printf(_(" Read data from input_file.\n")); printf(_(" -o output_file\n")); printf(_(" Write converted data to output_file.\n")); printf(_("\n")); printf(_("\n")); }
static void show_version_full (void) { write_log ("\n"); show_version (); write_log ("\nCopyright 1995-2002 Bernd Schmidt\n"); write_log (" 1999-2005 Toni Wilen\n"); write_log (" 2003-2005 Richard Drummond\n\n"); write_log ("See the source for a full list of contributors.\n"); write_log ("This is free software; see the file COPYING for copying conditions. There is NO\n"); write_log ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); }
int main(int argc, char *argv[]) { int c, lpnumber; char *p; if (argc <= 0) /* in case not provided in (x)inetd config */ progname = "p910nd"; else { progname = argv[0]; if ((p = strrchr(progname, '/')) != 0) progname = p + 1; } lpnumber = '0'; while ((c = getopt(argc, argv, "bi:f:v")) != EOF) { switch (c) { case 'b': bidir = 1; break; case 'f': device = optarg; break; case 'i': bindaddr = optarg; break; case 'v': show_version(); break; default: usage(); break; } } argc -= optind; argv += optind; if (argc > 0) { if (isdigit(argv[0][0])) lpnumber = argv[0][0]; } /* change the n in argv[0] to match the port so ps will show that */ if ((p = strstr(progname, "p910n")) != NULL) p[4] = lpnumber; /* We used to pass (LOG_PERROR|LOG_PID|LOG_LPR|LOG_ERR) to syslog, but * syslog ignored the LOG_PID and LOG_PERROR option. I.e. the intention * was to add both options but the effect was to have neither. * I disagree with the intention to add PERROR. --Stef */ openlog(p, LOG_PID, LOG_LPR); if (is_standalone()) server(lpnumber); else one_job(lpnumber); return (0); }
/** * get_options - process command line * @param argc program arg count * @param argv program arg array * * Process the arguments, fatally complaining on error. */ static void get_options(int argc, char const * argv[]) { optcon = op_poptGetContext(NULL, argc, argv, options, 0); if (show_vers) { show_version(argv[0]); } /* non-option, must be a valid event name or event specs */ chosen_events = poptGetArgs(optcon); /* don't free the context now, we need chosen_events */ }
static void show_help (void) { show_version (); printf ("-c --cpuusage Display CPU usage.\n"); printf ("-d --debug Display debugging output.\n"); printf ("-F --farenheit Display temperature in farenheit.\n"); printf ("-h --help Display this help.\n"); printf ("-i[FILE] --icon[=FILE] Set the icon filename, or disable the icon.\n"); printf ("-v --version Display version information.\n"); printf ("\nLong options may be passed with a single dash.\n\n"); }
void slave_get_options (int *argc,char ***argv, int *force, struct slave_database *sdb) { int opt; char *hour,*min; while ((opt = getopt (*argc,*argv,"a:n:fl:c:ohv")) != -1) { switch (opt) { case 'a': sdb->limits.autoenable.flags |= AEF_ACTIVE; hour = optarg; if ((min = strchr (hour,':')) == NULL) { usage (); exit (1); } *min = '\0'; min++; sdb->limits.autoenable.h = atoi (hour) % 24; sdb->limits.autoenable.m = atoi (min) % 60; printf ("Autoenable time from command line: %02i:%02i\n",sdb->limits.autoenable.h,sdb->limits.autoenable.m); break; case 'n': sdb->limits.nmaxcpus = atoi (optarg); sdb->flags |= SDBF_SETMAXCPUS; break; case 'c': strncpy(sdb->conf,optarg,PATH_MAX-1); printf ("Reading config file from: '%s'\n",sdb->conf); break; case 'f': *force = 1; fprintf (stderr,"WARNING: Forcing usage of pre-existing shared memory (-f). Do not do this unless you really know what it means.\n"); break; case 'l': log_level_severity_set (atoi(optarg)); printf ("Logging level set to: %s\n",log_level_str(loglevel)); break; case 'o': log_level_out_set (L_ONSCREEN); printf ("Logging on screen.\n"); break; case 'v': show_version (*argv); exit (0); case '?': case 'h': usage(); exit (0); } } }
int main(int argc, char *argv[]) { #if defined(_WIN32) || defined(__CYGWIN__) const char * port = "COM1"; #else const char * port = "/dev/ttyS11"; #endif int fcnt; char * fnam[64]; extern char *optarg; /* getopt */ extern int optind; /* getopt */ int c; /* the program name start just after the last slash */ if ((progname = (char *)strrchr(argv[0], '/')) == NULL) progname = argv[0]; else progname++; /* parse the command line options */ while ((c = getopt(argc, argv, "dvhp:")) > 0) { switch (c) { case 'v': show_version(); return 0; case 'h': show_usage(); return 1; case 'p': port = optarg; break; default: parse_err(optarg); return 2; } } if (optind < argc) { fcnt = 0; do { fnam[fcnt++] = argv[optind]; optind++; } while (optind < argc); return ymodem_send(port, fcnt, fnam); } return ymodem_recv(port); }
/* * Description: Displays the various available commands. */ static void show_usage () { int i ; show_version() ; printf( "Available Commands are:\n\n" ) ; for ( i = 0; i < tLength; i++ ) { printf( "\t%c %-15s %-30s\n", myCmdStruct[i].c , myCmdStruct[i].string , myCmdStruct[i].helptext ) ; } }
void save_all(FILE *fp) { show_version(fp); save_set_all(fp); save_functions__sub(fp); save_variables__sub(fp); fprintf(fp, "%s\n", replot_line); if (wri_to_fil_last_fit_cmd(NULL)) { fputs("## ", fp); wri_to_fil_last_fit_cmd(fp); putc('\n', fp); } fputs("# EOF\n", fp); }
int main(int argc, char** argv) { static struct option long_options[] = { { "help", no_argument, NULL, 'h'}, { "version", no_argument, NULL, 'r'}, { NULL, 0, NULL, 0 } }; int c, idx; while((c = getopt_long(argc, argv, "hr", long_options, &idx)) != -1) { switch(c) { case 'r': show_version(argc, argv); break; case 'h': case '?': show_usage(argc, argv); break; default: abort(); } } FILE* fp = fdopen(fileno(stdout), "wb"); if(!fp) { perror("stdout"); return -1; } unsigned short zeros[NR_KEYS]; memset(zeros, 0, sizeof(zeros)); int i; for(i = 0; i < 16; i++) { if(key_maps[i]) fwrite(key_maps[i], sizeof(unsigned short) * NR_KEYS, 1, fp); else fwrite(zeros, sizeof(unsigned short) * NR_KEYS, 1, fp); } return 0; }
int main (int argc, char *argv[]) { bool help, version, output, input, decode; help = version = output = input = decode = false; char *input_file, *output_file; input_file = output_file = NULL; int flag = 0; struct option opts[] = { {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {"output", required_argument, 0, 'o'}, {"input", required_argument, 0, 'i'}, {"decode", no_argument, 0, 'd'} }; while ((flag = getopt_long(argc, argv, "Vho:i:d", opts, NULL)) != -1) { switch (flag) { case 'V' : version = true; break; case 'h' : help = true; break; case 'o' : output_file = optarg; output = true; break; case 'i' : input_file = optarg; input = true; break; case 'd' : decode = true; } } if (help) { show_help(); } else if (version) { show_version(); } else if (input && output && decode) { decode_64_to_ascii(input_file, output_file); } else if (input && output) { encode_ascii_to_64(input_file, output_file); } else if (!feof(stdin)) { encode_ascii_to_64(NULL, NULL); } return EXIT_SUCCESS; }
int main(int argc, char **argv) { setlocale(LC_ALL, "" ); textdomain("logistics"); int c =0; while(( c = getopt_long(argc, argv, ":lhvi:r:uUgx", args, NULL)) != -1) { switch(c) { case 'h': show_help(); return 0; break; case 'v': show_version(); return 0; break; case 'l': list_all_packages_to_terminal(); break; case 'i': install_package(optarg); break; case 'r': remove_package(optarg); break; case 'u': update_package_db(); break; case 'U': system_upgrade(); break; case 'g': gtk_init(&argc, &argv); init_gui(argc, argv, 0); break; case 'x': gtk_init(&argc, &argv); init_gui(argc, argv, 1); break; default: show_help(); return 1; break; } } return 0; }
void show_help(bool defaults) { typedef struct { const char *info; const char *verbose; const char *description; const char *standard; } help_info; help_info myopts[]= { {"c", "config=FILE", "use FILE as configuration file", SYSCONFDIR "/dionaea.conf"}, {"D", "daemonize", "run as daemon", 0}, {"g", "group=GROUP", "switch to GROUP after startup (use with -u)", "keep current group"}, #ifdef HAVE_LIBGC {"G", "garbage=[collect|debug]","garbage collect, usefull to debug memory leaks, does NOT work with valgrind", 0}, #endif {"h", "help", "display help", 0}, {"H", "large-help", "display help with default values", 0}, {"l", "log-levels=WHAT", "which levels to log, valid values all, debug, info, message, warning, critical, error, combine using ',', exclude with - prefix", 0}, {"L", "log-domains=WHAT", "which domains use * and ? wildcards, combine using ',', exclude using -", 0}, {"u", "user=USER", "switch to USER after startup", "keep current user"}, {"p", "pid-file=FILE", "write pid to file", 0}, {"r", "chroot=DIR", "chroot to DIR after startup, warning: chrooting causes problems with logsql/sqlite", "don't chroot"}, {"V", "version", "show version", ""}, {"w", "workingdir=DIR", "set the process' working dir to DIR", PREFIX}, }; show_version(NULL); for( int i=0;i<sizeof(myopts)/sizeof(help_info);i++ ) { printf(" -%s, --%-25s %s\n", myopts[i].info, myopts[i].verbose, myopts[i].description); if( defaults == true && myopts[i].standard ) { printf("%-35s Default value/behaviour: %s\n", "", myopts[i].standard); } } puts("\n\nexamples:\n" "\t# dionaea -l all,-debug -L '*'\n" "\t# dionaea -l all,-debug -L 'con*,py*'\n" "\t# dionaea -u nobody -g nogroup -w /opt/dionaea -p /opt/dionaea/var/run/dionaea.pid\n"); }
int main (int argc, char *argv[]) { struct version v; show_version(&v); g_log_set_default_handler(logger_stdout_log, NULL); struct options *opt = malloc(sizeof(struct options)); memset(opt, 0, sizeof(struct options)); if( options_parse(opt, argc, argv) == false ) { g_error("Could not parse options!\n"); } if( options_validate(opt) == false ) { g_error("Invalid options"); } g_log_set_default_handler(logger_stdout_log, opt->stdOUT.filter); // gc if( opt->garbage != NULL ) { #ifdef HAVE_LIBGC g_message("gc mode %s", opt->garbage); if( g_mem_gc_friendly != TRUE ) { g_error("export G_DEBUG=gc-friendly\nexport G_SLICE=always-malloc\n for gc"); } static GMemVTable memory_vtable = { .malloc = GC_malloc, .realloc = GC_realloc, .free = GC_free, }; g_mem_set_vtable(&memory_vtable); if( strcmp(opt->garbage, "debug") == 0 ) GC_find_leak = 1; // set libev allocator typedef void *(*moron)(void *ptr, long size); ev_set_allocator((moron)GC_realloc); #endif }
int main(int argc, char *argv[]) { const char *serial = NULL; const char *rom_name = NULL; int opt; while ((opt = getopt(argc, argv, "VES:hvs:")) != -1) { switch (opt) { case 'V': show_version(); return 0; case 'h': flasher_usage(); return 0; case 'E': erase_used = 1; break; case 'S': start_addr = strtol(optarg, NULL, 16); /* force erasing only the used blocks */ erase_used = 1; break; case 'v': do_verify = 1; break; case 's': serial = optarg; break; default: flasher_usage(); return EXIT_FAILURE; } } if (optind >= argc) { flasher_usage(); return EXIT_FAILURE; } else rom_name = argv[optind]; if (start_addr && (start_addr % FLASH_ERASE_SIZE)) { printf("Address given to -S must be 0x%x aligned\n", FLASH_ERASE_SIZE); return EXIT_FAILURE; } return flasher_flash(serial, rom_name); }
static void usage(void) { show_version(); fprintf(stderr, "\n" "usage: hostapd [-hdBKt] <configuration file(s)>\n" "\n" "options:\n" " -h show this usage\n" " -d show more debug messages (-dd for even more)\n" " -B run daemon in the background\n" " -K include key data in debug messages\n" " -t include timestamps in some debug messages\n" " -v show hostapd version\n"); exit(1); }
static void parse_options(int argc, char *argv[], struct mount_options *opts) { int c, show_version_only = 0; while ((c = getopt(argc, argv, "fvnt:o:rwV")) != EOF) { switch (c) { case 'f': fake++; break; case 'v': verbose++; break; case 'n': nomtab++; break; case 't': opts->fstype = optarg; break; case 'o': if (opts->opts) opts->opts = xstrconcat3(opts->opts, ",", optarg); else opts->opts = xstrdup(optarg); break; case 'r': readonly++; break; case 'w': readwrite++; break; case 'V': show_version_only++; break; default: break; } } if (show_version_only) { show_version(); exit(0); } parse_opts(opts->opts, &opts->flags, &opts->extra_opts); }
void parse_options ( int argc, char** argv ) { extern char *optarg; extern int optind, optopt; char c; while ( (c = getopt ( argc, argv, ":Ld:hv" ) ) != -1 ) { switch (c) { case 'd': printf("Debugging messages enabled.\n"); options.debug = atoi(optarg); break; /*case 'f': options.config_file = strdup(optarg); break;*/ case 'h': show_usage(); break; case 'v': show_version(); break; case 'L': show_license(); break; case ':': fprintf ( stderr, "Option -%c requires an operand\n", optopt ); show_usage(); break; case '?': fprintf ( stderr, "Unrecognized option: -%c\n", optopt ); show_usage(); break; } } return; }
/* start of program execution */ int main(int argc, char* argv[]){ /* parse command-line options */ getopts(argc, argv); /* if verbose mode, print out program information as a header */ if(!opt.silent){ printf("------------------------------------\n"); show_version(); printf("------------------------------------\n"); } int retval = run(); /* run the simulation until end of program*/ return retval; }
void show_usage() { show_version(); printf(_("Usage:\n")); printf(_(" opencc [Options]\n")); printf(_("\n")); printf(_("Options:\n")); printf(_(" -i [file], --input=[file] Read original text from [file].\n")); printf(_(" -o [file], --output=[file] Write converted text to [file].\n")); printf(_(" -c [file], --config=[file] Load configuration of conversion from [file].\n")); printf(_(" -v, --version Print version and build information.\n")); printf(_(" -h, --help Print this help.\n")); printf(_("\n")); printf(_("With no input file, reads standard input and writes converted stream to standard output.\n")); printf(_("Default configuration(%s) will be loaded if not set.\n"), OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD); printf(_("\n")); }
void getopts(int argc, char *argv[]) { const char *work_path = NULL; const char *conf_file = NULL; struct option long_options[] = { //{"debug", 0, &g_conf.debug, 0}, {"work_path", 1, NULL, 'd'}, {"config", 1, NULL, 'f'}, {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'v'}, }; char c; int option_index = 0; while ((c = getopt_long(argc, argv, "d:f:hv", long_options, &option_index)) != -1) { switch (c) { case 0: //printf ("option %s", long_options[option_index].name); break; case 'd': work_path = optarg; break; case 'f': conf_file = optarg; break; case 'h': show_help(); break; case 'v': show_version(); break; default: exit(1); break; } } if (NULL == work_path || NULL == conf_file) { show_help(); exit(1); } snprintf(g_conf.work_path, sizeof(g_conf.work_path), "%s", work_path); snprintf(g_conf.conf_file, sizeof(g_conf.conf_file), "%s", conf_file); }