static void checkargs_remove(void) { checkargs_trans(); if(config->flags & ALPM_TRANS_FLAG_NOSAVE) { invalid_opt(config->print, "--nosave", "--print"); invalid_opt(config->flags & ALPM_TRANS_FLAG_DBONLY, "--nosave", "--dbonly"); } }
static void checkargs_trans(void) { if(config->print) { invalid_opt(config->flags & ALPM_TRANS_FLAG_DBONLY, "--print", "--dbonly"); invalid_opt(config->flags & ALPM_TRANS_FLAG_NOSCRIPTLET, "--print", "--noscriptlet"); } }
static void checkargs_files(void) { if(config->op_q_owns) { invalid_opt(config->op_q_list, "--owns", "--list"); invalid_opt(config->op_q_search, "--owns", "--search"); invalid_opt(config->op_f_regex, "--owns", "--regex"); } else if(config->op_q_list) { invalid_opt(config->op_q_search, "--list", "--search"); invalid_opt(config->op_f_regex, "--list", "--regex"); } }
static void checkargs_database(void) { invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLDEPS && config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT, "--asdeps", "--asexplicit"); if(config->op_q_check) { invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLDEPS, "--asdeps", "--check"); invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT, "--asexplicit", "--check"); } }
static void checkargs_upgrade(void) { checkargs_trans(); invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLDEPS && config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT, "--asdeps", "--asexplicit"); }
static void checkargs_query_filter_opts(const char *opname) { invalid_opt(config->op_q_deps, opname, "--deps"); invalid_opt(config->op_q_explicit, opname, "--explicit"); invalid_opt(config->op_q_upgrade, opname, "--upgrade"); invalid_opt(config->op_q_unrequired, opname, "--unrequired"); invalid_opt(config->op_q_locality & PKG_LOCALITY_NATIVE, opname, "--native"); invalid_opt(config->op_q_locality & PKG_LOCALITY_FOREIGN, opname, "--foreign"); }
static void checkargs_query(void) { if(config->op_q_isfile) { invalid_opt(config->group, "--file", "--groups"); invalid_opt(config->op_q_search, "--file", "--search"); invalid_opt(config->op_q_owns, "--file", "--owns"); } else if(config->op_q_search) { invalid_opt(config->group, "--search", "--groups"); invalid_opt(config->op_q_owns, "--search", "--owns"); checkargs_query_display_opts("--search"); checkargs_query_filter_opts("--search"); } else if(config->op_q_owns) { invalid_opt(config->group, "--owns", "--groups"); checkargs_query_display_opts("--owns"); checkargs_query_filter_opts("--owns"); } else if(config->group) { checkargs_query_display_opts("--groups"); } invalid_opt(config->op_q_deps && config->op_q_explicit, "--deps", "--explicit"); invalid_opt((config->op_q_locality & PKG_LOCALITY_NATIVE) && (config->op_q_locality & PKG_LOCALITY_FOREIGN), "--native", "--foreign"); }
int env_opt(char *line, t_info *info) { size_t i; if (!line) return (0); if (line[0] != '-') return (0); if (ft_strequ(line, "--")) return (0); if (ft_strequ(line, "-u")) return (0); if (line[0] == '-' && line[1] == '\0') return (0); i = 1; while (i < ft_strlen(line)) { if (invalid_opt(line[i], info)) ft_error_parse(line[i]); i++; } return (1); }
static void checkargs_sync(void) { checkargs_upgrade(); if(config->op_s_clean) { invalid_opt(config->group, "--clean", "--groups"); invalid_opt(config->op_s_info, "--clean", "--info"); invalid_opt(config->op_q_list, "--clean", "--list"); invalid_opt(config->op_s_sync, "--clean", "--refresh"); invalid_opt(config->op_s_search, "--clean", "--search"); invalid_opt(config->op_s_upgrade, "--clean", "--sysupgrade"); invalid_opt(config->op_s_downloadonly, "--clean", "--downloadonly"); } else if(config->op_s_info) { invalid_opt(config->group, "--info", "--groups"); invalid_opt(config->op_q_list, "--info", "--list"); invalid_opt(config->op_s_search, "--info", "--search"); invalid_opt(config->op_s_upgrade, "--info", "--sysupgrade"); invalid_opt(config->op_s_downloadonly, "--info", "--downloadonly"); } else if(config->op_s_search) { invalid_opt(config->group, "--search", "--groups"); invalid_opt(config->op_q_list, "--search", "--list"); invalid_opt(config->op_s_upgrade, "--search", "--sysupgrade"); invalid_opt(config->op_s_downloadonly, "--search", "--downloadonly"); } else if(config->op_q_list) { invalid_opt(config->group, "--list", "--groups"); invalid_opt(config->op_s_upgrade, "--list", "--sysupgrade"); invalid_opt(config->op_s_downloadonly, "--list", "--downloadonly"); } else if(config->group) { invalid_opt(config->op_s_upgrade, "--groups", "--sysupgrade"); invalid_opt(config->op_s_downloadonly, "--groups", "--downloadonly"); } }
static void checkargs_query_display_opts(const char *opname) { invalid_opt(config->op_q_changelog, opname, "--changelog"); invalid_opt(config->op_q_check, opname, "--check"); invalid_opt(config->op_q_info, opname, "--info"); invalid_opt(config->op_q_list, opname, "--list"); }