options.c (121245) | options.c (156123) |
---|---|
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 * $FreeBSD: head/usr.sbin/sysinstall/options.c 121245 2003-10-19 13:37:12Z des $ | 7 * $FreeBSD: head/usr.sbin/sysinstall/options.c 156123 2006-02-28 21:49:33Z jhb $ |
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 --- 21 unchanged lines hidden (view full) --- 37#include "sysinstall.h" 38#include <ctype.h> 39#include <curses.h> 40#include <term.h> 41 42int fixitTtyWhich(dialogMenuItem *); 43 44static char * | 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 --- 21 unchanged lines hidden (view full) --- 37#include "sysinstall.h" 38#include <ctype.h> 39#include <curses.h> 40#include <term.h> 41 42int fixitTtyWhich(dialogMenuItem *); 43 44static char * |
45varCheck(Option opt) | 45varCheck(Option *opt) |
46{ 47 char *cp = NULL; 48 | 46{ 47 char *cp = NULL; 48 |
49 if (opt.aux) 50 cp = variable_get((char *)opt.aux); | 49 if (opt->aux) 50 cp = variable_get((char *)opt->aux); |
51 if (!cp) 52 return "NO"; 53 return cp; 54} 55 56/* Show our little logo */ 57static char * | 51 if (!cp) 52 return "NO"; 53 return cp; 54} 55 56/* Show our little logo */ 57static char * |
58resetLogo(char *str) | 58resetLogo(Option *opt) |
59{ 60 return "[RESET!]"; 61} 62 63static char * | 59{ 60 return "[RESET!]"; 61} 62 63static char * |
64mediaCheck(Option opt) | 64mediaCheck(Option *opt) |
65{ 66 if (mediaDevice) { 67 switch(mediaDevice->type) { 68 case DEVICE_TYPE_UFS: 69 case DEVICE_TYPE_DISK: 70 return "File system"; 71 72 case DEVICE_TYPE_FLOPPY: --- 77 unchanged lines hidden (view full) --- 150 OPT_IS_VAR, TIMEOUT_PROMPT, VAR_MEDIA_TIMEOUT, varCheck }, 151{ "Package Temp", "The directory where package temporary files should go", 152 OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck }, 153{ "Newfs Args", "Default parameters for newfs(8)", 154 OPT_IS_VAR, NEWFS_PROMPT, VAR_NEWFS_ARGS, varCheck }, 155{ "Fixit Console", "Which tty to use for the Fixit action.", 156 OPT_IS_FUNC, fixitTtyWhich, VAR_FIXIT_TTY, varCheck }, 157{ "Re-scan Devices", "Re-run sysinstall's initial device probe", | 65{ 66 if (mediaDevice) { 67 switch(mediaDevice->type) { 68 case DEVICE_TYPE_UFS: 69 case DEVICE_TYPE_DISK: 70 return "File system"; 71 72 case DEVICE_TYPE_FLOPPY: --- 77 unchanged lines hidden (view full) --- 150 OPT_IS_VAR, TIMEOUT_PROMPT, VAR_MEDIA_TIMEOUT, varCheck }, 151{ "Package Temp", "The directory where package temporary files should go", 152 OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck }, 153{ "Newfs Args", "Default parameters for newfs(8)", 154 OPT_IS_VAR, NEWFS_PROMPT, VAR_NEWFS_ARGS, varCheck }, 155{ "Fixit Console", "Which tty to use for the Fixit action.", 156 OPT_IS_FUNC, fixitTtyWhich, VAR_FIXIT_TTY, varCheck }, 157{ "Re-scan Devices", "Re-run sysinstall's initial device probe", |
158 OPT_IS_FUNC, deviceRescan }, | 158 OPT_IS_FUNC, deviceRescan, NULL, NULL }, |
159{ "Use Defaults", "Reset all values to startup defaults", | 159{ "Use Defaults", "Reset all values to startup defaults", |
160 OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, 161{ NULL }, | 160 OPT_IS_FUNC, installVarDefaults, NULL, resetLogo }, 161{ NULL, NULL, 0, NULL, NULL, NULL }, |
162}; 163 164#define OPT_START_ROW 4 165#define OPT_END_ROW 19 166#define OPT_NAME_COL 0 167#define OPT_VALUE_COL 16 168#define GROUP_OFFSET 40 169 --- 8 unchanged lines hidden (view full) --- 178 179 case OPT_IS_INT: 180 sprintf(ival, "%lu", (long)opt.data); 181 return ival; 182 183 case OPT_IS_FUNC: 184 case OPT_IS_VAR: 185 if (opt.check) | 162}; 163 164#define OPT_START_ROW 4 165#define OPT_END_ROW 19 166#define OPT_NAME_COL 0 167#define OPT_VALUE_COL 16 168#define GROUP_OFFSET 40 169 --- 8 unchanged lines hidden (view full) --- 178 179 case OPT_IS_INT: 180 sprintf(ival, "%lu", (long)opt.data); 181 return ival; 182 183 case OPT_IS_FUNC: 184 case OPT_IS_VAR: 185 if (opt.check) |
186 return opt.check(opt); | 186 return opt.check(&opt); |
187 else 188 return "<*>"; 189 } 190 return "<unknown>"; 191} 192 193static int 194fire(Option opt) --- 16 unchanged lines hidden (view full) --- 211 variable_set2(opt.aux, "NO", -1); 212 else 213 variable_set2(opt.aux, "YES", -1); 214 } 215 else 216 variable_set2(opt.aux, "YES", 0); 217 } 218 if (opt.check) | 187 else 188 return "<*>"; 189 } 190 return "<unknown>"; 191} 192 193static int 194fire(Option opt) --- 16 unchanged lines hidden (view full) --- 211 variable_set2(opt.aux, "NO", -1); 212 else 213 variable_set2(opt.aux, "YES", -1); 214 } 215 else 216 variable_set2(opt.aux, "YES", 0); 217 } 218 if (opt.check) |
219 opt.check(opt); | 219 opt.check(&opt); |
220 refresh(); 221 return status; 222} 223 224int 225optionsEditor(dialogMenuItem *self) 226{ 227 int i, optcol, optrow, key; --- 114 unchanged lines hidden --- | 220 refresh(); 221 return status; 222} 223 224int 225optionsEditor(dialogMenuItem *self) 226{ 227 int i, optcol, optrow, key; --- 114 unchanged lines hidden --- |