📄 cmdline.c
字号:
/* File autogenerated by gengetopt version 2.12.2 generated with the following command: gengetopt --no-handle-help --unamed-opts=[--] COMMAND [COMMAND FLAGS] The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it.*//* If we use autoconf. */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <stdio.h>#include <stdlib.h>#include <string.h>#include "getopt.h"#include "cmdline.h"staticvoid clear_given (struct gengetopt_args_info *args_info);staticvoid clear_args (struct gengetopt_args_info *args_info);static intcmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error);static char *gengetopt_strdup (const char *s);staticvoid clear_given (struct gengetopt_args_info *args_info){ args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->n_procs_given = 0 ; args_info->jobid_given = 0 ; args_info->machines_file_given = 0 ; args_info->stable_machines_file_given = 0 ; args_info->n_el_given = 0 ; args_info->n_cs_given = 0 ; args_info->runtime_port_given = 0 ; args_info->el_port_given = 0 ; args_info->cs_port_given = 0 ; args_info->sc_port_given = 0 ; args_info->rsh_given = 0 ; args_info->working_dir_given = 0 ; args_info->tmp_dir_given = 0 ; args_info->helpers_dir_given = 0 ; args_info->master_sched_given = 0 ; args_info->debug_given = 0 ;}staticvoid clear_args (struct gengetopt_args_info *args_info){ args_info->machines_file_arg = gengetopt_strdup ("machines"); args_info->stable_machines_file_arg = NULL; args_info->n_el_arg = 1 ; args_info->rsh_arg = gengetopt_strdup ("/usr/bin/ssh"); args_info->working_dir_arg = NULL; args_info->tmp_dir_arg = gengetopt_strdup ("/tmp"); args_info->helpers_dir_arg = NULL; args_info->master_sched_arg = NULL; args_info->debug_arg = NULL;}voidcmdline_parser_print_version (void){ printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);}voidcmdline_parser_print_help (void){ cmdline_parser_print_version (); printf("\n" "Purpose:\n"" Launches and monitors an MPI application in the V-environment\n" "\n" "Usage: %s [OPTIONS]... [[--] COMMAND [COMMAND FLAGS]]...\n", CMDLINE_PARSER_PACKAGE); printf("\n"); printf("%s\n"," -h, --help Print help and exit"); printf("%s\n"," -V, --version Print version and exit"); printf("%s\n"," -n, --n-procs=np number of processes for the MPI application (np \n flag of mpirun)"); printf("%s\n"," -j, --jobid=int unique id for the job. (default=rand)"); printf("%s\n"," -m, --machines-file=filename machines file like for any MPICH device \n (typical deployment may use at least 3 more \n machines than np) (default=`machines')"); printf("%s\n"," --stable-machines-file=filename\n file of stable machines (machines having a high \n MTBF)"); printf("%s\n"," -e, --n-el=int number of event loggers (default=`1')"); printf("%s\n"," -c, --n-cs=int number of checkpoint servers (default=np/5)"); printf("%s\n"," --runtime-port=port port for the runtime process \n (default=autoselect)"); printf("%s\n"," --el-port=port port for the event logger (default=autoselect)"); printf("%s\n"," --cs-port=port port for the checkpoint server \n (default=autoselect)"); printf("%s\n"," --sc-port=port port for the checkpoint scheduler \n (default=autoselect)"); printf("%s\n"," --rsh=command remote shell program for executing remote \n commands (default=`/usr/bin/ssh')"); printf("%s\n"," --working-dir=path working directory for running the MPI \n application (default=current pwd)"); printf("%s\n"," --tmp-dir=path writeable directory (this directory must be \n writeable on all machines of the machines \n file and stable machines file. A local \n filesystem is necessary for performances) \n (default=`/tmp')"); printf("%s\n"," --helpers-dir=path directory with the helpers (checkpointserver, \n etc...) (default=same directory as vrun)"); printf("%s\n"," --master-sched=ip:port address of the master scheduler (only for \n multiple applications scheduling)"); printf("%s\n"," -d, --debug=[%filename|ip:[port]][+|-labels]*\n debugging options. First part is the target, \n second part the selection. Target may be \n %filename for storing in a file, or ip:[port] \n for sending debugs to a debug server. \n Selection use +label or -label to force or \n prevent the displaying of certain \n informations.");}voidcmdline_parser_init (struct gengetopt_args_info *args_info){ clear_given (args_info); clear_args (args_info); args_info->inputs = NULL; args_info->inputs_num = 0;}voidcmdline_parser_free (struct gengetopt_args_info *args_info){ unsigned int i; if (args_info->machines_file_arg) { free (args_info->machines_file_arg); /* free previous argument */ args_info->machines_file_arg = 0; } if (args_info->stable_machines_file_arg) { free (args_info->stable_machines_file_arg); /* free previous argument */ args_info->stable_machines_file_arg = 0; } if (args_info->rsh_arg) { free (args_info->rsh_arg); /* free previous argument */ args_info->rsh_arg = 0; } if (args_info->working_dir_arg) { free (args_info->working_dir_arg); /* free previous argument */ args_info->working_dir_arg = 0; } if (args_info->tmp_dir_arg) { free (args_info->tmp_dir_arg); /* free previous argument */ args_info->tmp_dir_arg = 0; } if (args_info->helpers_dir_arg) { free (args_info->helpers_dir_arg); /* free previous argument */ args_info->helpers_dir_arg = 0; } if (args_info->master_sched_arg) { free (args_info->master_sched_arg); /* free previous argument */ args_info->master_sched_arg = 0; } if (args_info->debug_arg) { free (args_info->debug_arg); /* free previous argument */ args_info->debug_arg = 0; } for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info);}/* gengetopt_strdup() *//* strdup.c replacement of strdup, which is not standard */char *gengetopt_strdup (const char *s){ char *result = NULL; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result;}intcmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info){ return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);}intcmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required){ int result; result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result;}intcmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error){ int c; /* Character of the parsed option. */ int error = 0; struct gengetopt_args_info local_args_info; if (initialize) cmdline_parser_init (args_info); cmdline_parser_init (&local_args_info); optarg = 0; optind = 1; opterr = 1; optopt = '?'; while (1) { int option_index = 0; char *stop_char; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "n-procs", 1, NULL, 'n' }, { "jobid", 1, NULL, 'j' }, { "machines-file", 1, NULL, 'm' }, { "stable-machines-file", 1, NULL, 0 }, { "n-el", 1, NULL, 'e' }, { "n-cs", 1, NULL, 'c' }, { "runtime-port", 1, NULL, 0 }, { "el-port", 1, NULL, 0 }, { "cs-port", 1, NULL, 0 }, { "sc-port", 1, NULL, 0 }, { "rsh", 1, NULL, 0 }, { "working-dir", 1, NULL, 0 }, { "tmp-dir", 1, NULL, 0 }, { "helpers-dir", 1, NULL, 0 }, { "master-sched", 1, NULL, 0 }, { "debug", 1, NULL, 'd' }, { NULL, 0, NULL, 0 } }; stop_char = 0; c = getopt_long (argc, argv, "hVn:j:m:e:c:d:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ if (local_args_info.help_given) { fprintf (stderr, "%s: `--help' (`-h') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; } if (args_info->help_given && ! override) continue; local_args_info.help_given = 1; args_info->help_given = 1; return 0; case 'V': /* Print version and exit. */ cmdline_parser_print_version (); exit (EXIT_SUCCESS); case 'n': /* number of processes for the MPI application (np flag of mpirun). */ if (local_args_info.n_procs_given) { fprintf (stderr, "%s: `--n-procs' (`-n') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -