void host_resolve_options_init(HostResolveOptions *options, HostResolveOptions *global_options) { if (options->use_dns == -1) options->use_dns = global_options->use_dns; if (options->use_fqdn == -1) options->use_fqdn = global_options->use_fqdn; if (options->use_dns_cache == -1) options->use_dns_cache = global_options->use_dns_cache; if (options->normalize_hostnames == -1) options->normalize_hostnames = global_options->normalize_hostnames; _init_options(options); }
/* * parse_command_line, fill in params data structure with data */ extern void parse_command_line(int argc, char *argv[]) { int first = 1; int opt_char; int option_index; uid_t some_uid; long tmp_l; static struct option long_options[] = { {"primary_slurmctld_failure", no_argument, 0, 'a'}, {"primary_slurmctld_resumed_operation", no_argument, 0, 'A'}, {"primary_slurmctld_resumed_control", no_argument, 0, 'b'}, {"backup_slurmctld_failure", no_argument, 0, 'B'}, {"backup_slurmctld_resumed_operation", no_argument, 0, 'c'}, {"backup_slurmctld_assumed_control", no_argument, 0, 'C'}, {"down", no_argument, 0, 'd'}, {"drained", no_argument, 0, 'D'}, {"primary_slurmctld_acct_buffer_full", no_argument, 0, 'e'}, {"fini", no_argument, 0, 'f'}, {"fail", no_argument, 0, 'F'}, {"primary_slurmdbd_failure", no_argument, 0, 'g'}, {"primary_slurmdbd_resumed_operation", no_argument, 0, 'G'}, {"primary_database_failure", no_argument, 0, 'h'}, {"primary_database_resumed_operation", no_argument, 0, 'H'}, {"id", required_argument, 0, 'i'}, {"idle", no_argument, 0, 'I'}, {"jobid", required_argument, 0, 'j'}, {"cluster", required_argument, 0, 'M'}, {"clusters", required_argument, 0, 'M'}, {"node", optional_argument, 0, 'n'}, {"offset", required_argument, 0, 'o'}, {"program", required_argument, 0, 'p'}, {"quiet", no_argument, 0, 'Q'}, {"reconfig", no_argument, 0, 'r'}, {"time", no_argument, 0, 't'}, {"up", no_argument, 0, 'u'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"block_err", no_argument, 0, OPT_LONG_BLOCK_ERR}, {"clear", no_argument, 0, OPT_LONG_CLEAR}, {"flags", required_argument, 0, OPT_LONG_FLAGS}, {"front_end", no_argument, 0, OPT_LONG_FRONT_END}, {"get", no_argument, 0, OPT_LONG_GET}, {"help", no_argument, 0, OPT_LONG_HELP}, {"set", no_argument, 0, OPT_LONG_SET}, {"usage", no_argument, 0, OPT_LONG_USAGE}, {"user", required_argument, 0, OPT_LONG_USER}, {NULL, 0, 0, 0} }; _init_options(); optind = 0; while ((opt_char = getopt_long(argc, argv, "aAbBcCdDeFfgGhHi:Ij:M:n::o:p:QrtuvV", long_options, &option_index)) != -1) { switch (opt_char) { case (int)'?': if (first) { first = 0; fprintf(stderr, "Try \"strigger --help\" for " "more information\n"); } exit(1); break; case (int)'a': params.pri_ctld_fail = true; break; case (int)'A': params.pri_ctld_res_op = true; break; case (int)'b': params.pri_ctld_res_ctrl = true; break; case (int)'B': params.bu_ctld_fail = true; break; case (int)'c': params.bu_ctld_res_op = true; break; case (int)'C': params.bu_ctld_as_ctrl = true; break; case (int)'d': params.node_down = true; break; case (int)'D': params.node_drained = true; break; case (int)'e': params.pri_ctld_acct_buffer_full = true; break; case (int)'f': params.job_fini = true; break; case (int)'F': params.node_fail = true; break; case (int)'g': params.pri_dbd_fail = true; break; case (int)'G': params.pri_dbd_res_op = true; break; case (int)'h': params.pri_db_fail = true; break; case (int)'H': params.pri_db_res_op = true; break; case (int)'i': params.trigger_id = atoi(optarg); break; case (int)'I': params.node_idle = true; break; case (int)'j': tmp_l = atol(optarg); if (tmp_l <= 0) { error("Invalid jobid %s", optarg); exit(1); } params.job_id = tmp_l; break; case (int) 'M': if (params.clusters) list_destroy(params.clusters); if (!(params.clusters = slurmdb_get_info_cluster(optarg))) { error("'%s' can't be reached now, " "or it is an invalid entry for " "--cluster. Use 'sacctmgr --list " "cluster' to see available clusters.", optarg); exit(1); } working_cluster_rec = list_peek(params.clusters); break; case (int)'n': xfree(params.node_id); if (optarg) params.node_id = xstrdup(optarg); else params.node_id = xstrdup("*"); break; case (int)'o': params.offset = atoi(optarg); break; case (int)'p': xfree(params.program); params.program = xstrdup(optarg); break; case (int)'Q': params.quiet = true; break; case (int)'r': params.reconfig = true; break; case (int)'t': params.time_limit = true; break; case (int)'u': params.node_up = true; break; case (int) 'v': params.verbose++; break; case (int) 'V': print_slurm_version(); exit(0); case (int) OPT_LONG_BLOCK_ERR: params.block_err = true; break; case (int) OPT_LONG_HELP: _help(); exit(0); case (int) OPT_LONG_USAGE: _usage(); exit(0); case (int) OPT_LONG_CLEAR: params.mode_clear = true; break; case (int) OPT_LONG_FLAGS: if (!strncasecmp(optarg, "perm", 4)) params.flags = TRIGGER_FLAG_PERM; else { error("Invalid flags %s", optarg); exit(1); } break; case (int) OPT_LONG_FRONT_END: params.front_end = true; break; case (int) OPT_LONG_GET: params.mode_get = true; break; case (int) OPT_LONG_SET: params.mode_set = true; break; case (int) OPT_LONG_USER: if ( uid_from_string( optarg, &some_uid ) != 0 ) { error("Invalid user %s", optarg); exit(1); } params.user_id = (uint32_t) some_uid; break; } } if (params.verbose) _print_options(); _validate_options(); }
void host_resolve_options_init_globals(HostResolveOptions *options) { _init_options(options); }