void variable_set(char *var, int dirty) { char tmp[1024], *cp; if (!var) msgFatal("NULL variable name & value passed."); else if (!*var) msgDebug("Warning: Zero length name & value passed to variable_set()\n"); SAFE_STRCPY(tmp, var); if ((cp = index(tmp, '=')) == NULL) msgFatal("Invalid variable format: %s", var); *(cp++) = '\0'; make_variable(tmp, string_skipwhite(cp), dirty); }
void pvariable_set(char *var) { char *p; char tmp[1024]; if (!var) msgFatal("NULL variable name & value passed."); else if (!*var) msgDebug("Warning: Zero length name & value passed to variable_set()\n"); /* Add a trivial namespace to whatever name the caller chooses. */ SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); if (index(var, '=') == NULL) msgFatal("Invalid variable format: %s", var); strlcat(tmp, var, 1024); p = strchr(tmp, '='); *p = '\0'; setenv(tmp, p + 1, 1); }
void variable_set2(char *var, char *value, int dirty) { if (!var || !value) msgFatal("Null name or value passed to set_variable2(%s) = %s!", var ? var : "", value ? value : ""); else if (!*var || !*value) msgDebug("Warning: Zero length name or value passed to variable_set2(%s) = %s\n", var, value); make_variable(var, value, dirty); }
/* Traverse over an internal menu */ Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max, Boolean buttons) { int n, rval = 0; dialogMenuItem *items; items = menu->items; if (buttons) items += 2; /* Count up all the items */ for (n = 0; items[n].title; n++); while (1) { char buf[FILENAME_MAX]; WINDOW *w = savescr(); /* Any helpful hints, put 'em up! */ use_helpline(menu->helpline); use_helpfile(systemHelpFile(menu->helpfile, buf)); dialog_clear_norefresh(); /* Pop up that dialog! */ if (menu->type & DMENU_NORMAL_TYPE) rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, items, (char *)(uintptr_t)buttons, choice, scroll); else if (menu->type & DMENU_RADIO_TYPE) rval = dialog_radiolist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, items, (char *)(uintptr_t)buttons); else if (menu->type & DMENU_CHECKLIST_TYPE) rval = dialog_checklist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, items, (char *)(uintptr_t)buttons); else msgFatal("Menu: `%s' is of an unknown type\n", menu->title); if (exited) { exited = FALSE; restorescr(w); return TRUE; } else if (rval) { restorescr(w); return FALSE; } else if (menu->type & DMENU_SELECTION_RETURNS) { restorescr(w); return TRUE; } } }