options.c (16208) | options.c (16366) |
---|---|
1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last attempt in the `sysinstall' line, the next 5 * generation being slated for what's essentially a complete rewrite. 6 * | 1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last attempt in the `sysinstall' line, the next 5 * generation being slated for what's essentially a complete rewrite. 6 * |
7 * $Id: options.c,v 1.37 1996/06/08 08:01:52 jkh Exp $ | 7 * $Id: options.c,v 1.38 1996/06/08 09:08:45 jkh Exp $ |
8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 40static char * 41varCheck(Option opt) 42{ 43 char *cp = NULL; 44 45 if (opt.aux) 46 cp = variable_get((char *)opt.aux); 47 if (!cp) | 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 40static char * 41varCheck(Option opt) 42{ 43 char *cp = NULL; 44 45 if (opt.aux) 46 cp = variable_get((char *)opt.aux); 47 if (!cp) |
48 return "<default setting>"; | 48 return "NO"; |
49 return cp; 50} 51 52/* Show our little logo */ 53static char * 54resetLogo(char *str) 55{ 56 return "[RESET!]"; --- 69 unchanged lines hidden (view full) --- 126 OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck }, 127{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs", 128 OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck }, 129{ "Browser Exec", "This is the path to the main binary of the browser package", 130 OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck }, 131{ "Media Type", "The current installation media type.", 132 OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck }, 133{ "Package Temp", "The directory where package temporary files should go", | 49 return cp; 50} 51 52/* Show our little logo */ 53static char * 54resetLogo(char *str) 55{ 56 return "[RESET!]"; --- 69 unchanged lines hidden (view full) --- 126 OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck }, 127{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs", 128 OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck }, 129{ "Browser Exec", "This is the path to the main binary of the browser package", 130 OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck }, 131{ "Media Type", "The current installation media type.", 132 OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck }, 133{ "Package Temp", "The directory where package temporary files should go", |
134 OPT_IS_VAR, PKG_PROMPT, "PKG_TMPDIR", varCheck }, | 134 OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck }, |
135{ "Use Defaults", "Reset all values to startup defaults", 136 OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, 137{ NULL }, 138}; 139 140#define OPT_START_ROW 4 141#define OPT_END_ROW 19 142#define OPT_NAME_COL 0 --- 61 unchanged lines hidden (view full) --- 204 for (i = 0; i < 2; i++) { 205 mvaddstr(OPT_START_ROW - 2, OPT_NAME_COL + (i * GROUP_OFFSET), "Name"); 206 mvaddstr(OPT_START_ROW - 1, OPT_NAME_COL + (i * GROUP_OFFSET), "----"); 207 208 mvaddstr(OPT_START_ROW - 2, OPT_VALUE_COL + (i * GROUP_OFFSET), "Value"); 209 mvaddstr(OPT_START_ROW - 1, OPT_VALUE_COL + (i * GROUP_OFFSET), "-----"); 210 } 211 /* And the footer */ | 135{ "Use Defaults", "Reset all values to startup defaults", 136 OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, 137{ NULL }, 138}; 139 140#define OPT_START_ROW 4 141#define OPT_END_ROW 19 142#define OPT_NAME_COL 0 --- 61 unchanged lines hidden (view full) --- 204 for (i = 0; i < 2; i++) { 205 mvaddstr(OPT_START_ROW - 2, OPT_NAME_COL + (i * GROUP_OFFSET), "Name"); 206 mvaddstr(OPT_START_ROW - 1, OPT_NAME_COL + (i * GROUP_OFFSET), "----"); 207 208 mvaddstr(OPT_START_ROW - 2, OPT_VALUE_COL + (i * GROUP_OFFSET), "Value"); 209 mvaddstr(OPT_START_ROW - 1, OPT_VALUE_COL + (i * GROUP_OFFSET), "-----"); 210 } 211 /* And the footer */ |
212 mvprintw(OPT_END_ROW + 0, 0, "Use SPACE to select/toggle an option, arrow keys to move,"); 213 mvprintw(OPT_END_ROW + 1, 0, "? or F1 for more help. When you're done, type Q to Quit."); | 212 mvprintw(OPT_END_ROW + 1, 0, "Use SPACE to select/toggle an option, arrow keys to move,"); 213 mvprintw(OPT_END_ROW + 2, 0, "? or F1 for more help. When you're done, type Q to Quit."); |
214 215 optrow = OPT_START_ROW; 216 optcol = OPT_NAME_COL; 217 for (i = 0; Options[i].name; i++) { 218 /* Names are painted somewhat gratuitously each time, but it's easier this way */ 219 mvprintw(optrow, OPT_NAME_COL + optcol, Options[i].name); 220 if (currOpt == i) 221 attrset(ATTR_SELECTED); 222 mvprintw(optrow++, OPT_VALUE_COL + optcol, value_of(Options[i])); 223 if (currOpt == i) 224 attrset(A_NORMAL); 225 if (optrow == OPT_END_ROW) { 226 optrow = OPT_START_ROW; 227 optcol += GROUP_OFFSET; 228 } 229 clrtoeol(); 230 } | 214 215 optrow = OPT_START_ROW; 216 optcol = OPT_NAME_COL; 217 for (i = 0; Options[i].name; i++) { 218 /* Names are painted somewhat gratuitously each time, but it's easier this way */ 219 mvprintw(optrow, OPT_NAME_COL + optcol, Options[i].name); 220 if (currOpt == i) 221 attrset(ATTR_SELECTED); 222 mvprintw(optrow++, OPT_VALUE_COL + optcol, value_of(Options[i])); 223 if (currOpt == i) 224 attrset(A_NORMAL); 225 if (optrow == OPT_END_ROW) { 226 optrow = OPT_START_ROW; 227 optcol += GROUP_OFFSET; 228 } 229 clrtoeol(); 230 } |
231 attrset(item_attr); 232 mvaddstr(OPT_END_ROW + 3, 0, Options[currOpt].desc); | 231 attrset(ATTR_TITLE); 232 mvaddstr(OPT_END_ROW + 4, 0, Options[currOpt].desc); |
233 attrset(A_NORMAL); 234 clrtoeol(); 235 move(0, 14); 236 refresh(); 237 238 /* Start the edit loop */ 239 key = toupper(getch()); 240 switch (key) { 241 case KEY_F(1): 242 case '?': 243 systemDisplayHelp("options"); 244 break; 245 246 case KEY_UP: 247 if (currOpt) 248 --currOpt; 249 else | 233 attrset(A_NORMAL); 234 clrtoeol(); 235 move(0, 14); 236 refresh(); 237 238 /* Start the edit loop */ 239 key = toupper(getch()); 240 switch (key) { 241 case KEY_F(1): 242 case '?': 243 systemDisplayHelp("options"); 244 break; 245 246 case KEY_UP: 247 if (currOpt) 248 --currOpt; 249 else |
250 beep(); | 250 for (currOpt = 0; Options[currOpt + 1].name; currOpt++); |
251 continue; 252 253 case KEY_DOWN: 254 if (Options[currOpt + 1].name) 255 ++currOpt; 256 else | 251 continue; 252 253 case KEY_DOWN: 254 if (Options[currOpt + 1].name) 255 ++currOpt; 256 else |
257 beep(); | 257 currOpt = 0; |
258 continue; 259 260 case KEY_HOME: 261 currOpt = 0; 262 continue; 263 264 case KEY_END: 265 while (Options[currOpt + 1].name) --- 22 unchanged lines hidden --- | 258 continue; 259 260 case KEY_HOME: 261 currOpt = 0; 262 continue; 263 264 case KEY_END: 265 while (Options[currOpt + 1].name) --- 22 unchanged lines hidden --- |