diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/config.c | 9 | ||||
-rw-r--r-- | usr.sbin/sade/dmenu.c | 44 | ||||
-rw-r--r-- | usr.sbin/sade/menus.c | 69 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 5 | ||||
-rw-r--r-- | usr.sbin/sade/variable.c | 28 | ||||
-rw-r--r-- | usr.sbin/sysinstall/config.c | 9 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dmenu.c | 44 | ||||
-rw-r--r-- | usr.sbin/sysinstall/menus.c | 69 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/variable.c | 28 |
10 files changed, 222 insertions, 88 deletions
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index 314deab..0a3ea5f 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.51.2.52 1997/06/11 08:39:26 jkh Exp $ + * $Id: config.c,v 1.99 1997/06/11 08:41:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -482,12 +482,13 @@ configNTP(dialogMenuItem *self) { int status; - status = variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + status = variable_get_value("ntpdate_flags", "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; if (status == DITEM_SUCCESS) { static char tmp[255]; - snprintf(tmp, 255, "%s=%s", VAR_NTPDATE, variable_get(VAR_NTPDATE)); - self->aux = (int)tmp; + snprintf(tmp, 255, "ntpdate_enable=YES,ntpdate_flags=%s", variable_get("ntpdate_flags")); + self->data = tmp; + dmenuSetVariables(self); } return status | DITEM_RESTORE; } diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c index cafcaa0..3f76977 100644 --- a/usr.sbin/sade/dmenu.c +++ b/usr.sbin/sade/dmenu.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id$ + * $Id: dmenu.c,v 1.32 1997/02/22 14:11:35 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -174,26 +174,42 @@ dmenuFlagCheck(dialogMenuItem *item) int dmenuVarCheck(dialogMenuItem *item) { - char *w, *cp, *cp2, *cp3, tmp[256]; + char *w; w = (char *)item->aux; if (!w) w = (char *)item->data; if (!w) return FALSE; - SAFE_STRCPY(tmp, w); - if ((cp = index(tmp, '=')) != NULL) { - *(cp++) = '\0'; - if ((cp3 = index(cp, ',')) != NULL) - *cp3 = '\0'; - cp2 = getenv(tmp); - if (cp2) - return !strcmp(cp, cp2); - else - return FALSE; + return variable_check(w); +} + +int +dmenuVarsCheck(dialogMenuItem *item) +{ + int res, init; + char *w, *cp1, *cp2; + char *copy; + + w = (char *)item->aux; + if (!w) + w = (char *)item->data; + if (!w) + return FALSE; + + copy = strdup(w); + res = TRUE; + init = FALSE; + for (cp1 = copy; cp1 != NULL;) { + init = TRUE; + cp2 = index(cp1, ','); + if (cp2 != NULL) + *cp2++ = '\0'; + res = res && variable_check(cp1); + cp1 = cp2; } - else - return (int)getenv(tmp); + free(copy); + return res && init; } int diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index 7c7a6b2..82032d8 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.137 1997/06/09 01:19:44 jkh Exp $ + * $Id: menus.c,v 1.138 1997/06/13 14:06:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -1145,7 +1145,7 @@ DMenu MenuNetworking = { dmenuVarCheck, configNovell, NULL, "novell" }, #endif { "Ntpdate", "Select a clock-syncronization server", - dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', (int)VAR_NTPDATE }, + dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', "ntpdate_enable=YES" }, { "router", "Select routing daemon (default: routed)", dmenuVarCheck, configRouter, NULL, "router" }, { "Rwhod", "This machine wants to run the rwho daemon", @@ -1169,46 +1169,69 @@ DMenu MenuNTP = { "close to you to have your system time syncronized accordingly.", "These are the primary open-access NTP servers", NULL, - { { "Other", "Select a site not on this list", - dmenuVarCheck, configNTP, NULL, NULL }, + { { "None", "No ntp server", + dmenuVarCheck, dmenuSetVariables, NULL, + "ntpdate_enable=NO,ntpdate_flags=" }, + { "Other", "Select a site not on this list", + dmenuVarsCheck, configNTP, NULL, + NULL }, { "Australia", "ntp.syd.dms.csiro.au (HP 5061 Cesium Beam)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntp.syd.dms.csiro.au" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntp.syd.dms.csiro.au" }, { "Canada", "tick.usask.ca (GOES clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=tick.usask.ca" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=tick.usask.ca" }, { "France", "canon.inria.fr (TDF clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=canon.inria.fr" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=canon.inria.fr" }, { "Germany", "ntps1-{0,1,2}.uni-erlangen.de (GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntps1-0.uni-erlangen.de" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntps1-0.uni-erlangen.de" }, { "Germany #2", "ntps1-0.cs.tu-berlin.de (GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntps1-0.cs.tu-berlin.de" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntps1-0.cs.tu-berlin.de" }, { "Japan", "clock.nc.fukuoka-u.ac.jp (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.nc.fukuoka-u.ac.jp" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.nc.fukuoka-u.ac.jp" }, { "Japan #2", "clock.tl.fukuoka-u.ac.jp (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.tl.fukuoka-u.ac.jp" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.tl.fukuoka-u.ac.jp" }, { "Netherlands", "ntp0.nl.net (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntp0.nl.net" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntp0.nl.net" }, { "Norway", "timer.unik.no (NTP clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=timer.unik.no" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=timer.unik.no" }, { "Sweden", "Time1.Stupi.SE (Cesium/GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=Time1.Stupi.SE" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=Time1.Stupi.SE" }, { "Switzerland", "swisstime.ethz.ch (DCF77 clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=swisstime.ethz.ch" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=swisstime.ethz.ch" }, { "U.S. East Coast", "bitsy.mit.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=bitsy.mit.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=bitsy.mit.edu" }, { "U.S. East Coast #2", "otc1.psu.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=otc1.psu.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=otc1.psu.edu" }, { "U.S. West Coast", "apple.com (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=apple.com" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=apple.com" }, { "U.S. West Coast #2", "clepsydra.dec.com (GOES clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clepsydra.dec.com" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clepsydra.dec.com" }, { "U.S. West Coast #3", "clock.llnl.gov (WWVB clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.llnl.gov" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.llnl.gov" }, { "U.S. Midwest", "ncar.ucar.edu (WWVB clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ncar.ucar.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ncar.ucar.edu" }, { "U.S. Pacific", "chantry.hawaii.net (WWV/H clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=chantry.hawaii.net" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=chantry.hawaii.net" }, { "U.S. Southwest", "shorty.chpc.utexas.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=shorty.chpc.utexas.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=shorty.chpc.utexas.edu" }, { NULL } }, }; diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index b7926b9..f876f27 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.131 1997/06/05 09:48:01 jkh Exp $ + * $Id: sysinstall.h,v 1.132 1997/06/09 01:19:44 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -137,7 +137,6 @@ #define VAR_NO_CONFIRM "noConfirm" #define VAR_NONINTERACTIVE "nonInteractive" #define VAR_NOVELL "novell" -#define VAR_NTPDATE "ntpdate" #define VAR_PARTITION "partition" #define VAR_PCNFSD "pcnfsd" #define VAR_PCNFSD_PKG "pcnfsd_pkg" @@ -493,6 +492,7 @@ extern int dmenuSetValue(dialogMenuItem *tmp); extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max, Boolean buttons); extern Boolean dmenuOpenSimple(DMenu *menu, Boolean buttons); extern int dmenuVarCheck(dialogMenuItem *item); +extern int dmenuVarsCheck(dialogMenuItem *item); extern int dmenuFlagCheck(dialogMenuItem *item); extern int dmenuRadioCheck(dialogMenuItem *item); @@ -702,6 +702,7 @@ extern void variable_set2(char *name, char *value); extern char *variable_get(char *var); extern void variable_unset(char *var); extern char *variable_get_value(char *var, char *prompt); +extern int variable_check(char *data); /* variable_load.c */ extern int variableLoad(dialogMenuItem *self); diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c index 0c579d6..0e31ae39 100644 --- a/usr.sbin/sade/variable.c +++ b/usr.sbin/sade/variable.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: variable.c,v 1.11.2.5 1997/06/11 08:39:27 jkh Exp $ + * $Id: variable.c,v 1.19 1997/06/11 08:41:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -155,3 +155,29 @@ variable_get_value(char *var, char *prompt) cp = NULL; return cp; } + +/* Check if value passed in data (in the form "variable=value") is equal to value of + variable stored in env */ +int +variable_check(char *data) +{ + char *w, *cp, *cp2, *cp3, tmp[256]; + + w = data; + if (!w) + return FALSE; + SAFE_STRCPY(tmp, w); + if ((cp = index(tmp, '=')) != NULL) { + *(cp++) = '\0'; + if ((cp3 = index(cp, ',')) != NULL) + *cp3 = '\0'; + cp2 = getenv(tmp); + + if (cp2) + return !strcmp(cp, cp2); + else + return FALSE; + } + else + return (int)getenv(tmp); +} diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 314deab..0a3ea5f 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.51.2.52 1997/06/11 08:39:26 jkh Exp $ + * $Id: config.c,v 1.99 1997/06/11 08:41:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -482,12 +482,13 @@ configNTP(dialogMenuItem *self) { int status; - status = variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + status = variable_get_value("ntpdate_flags", "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; if (status == DITEM_SUCCESS) { static char tmp[255]; - snprintf(tmp, 255, "%s=%s", VAR_NTPDATE, variable_get(VAR_NTPDATE)); - self->aux = (int)tmp; + snprintf(tmp, 255, "ntpdate_enable=YES,ntpdate_flags=%s", variable_get("ntpdate_flags")); + self->data = tmp; + dmenuSetVariables(self); } return status | DITEM_RESTORE; } diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c index cafcaa0..3f76977 100644 --- a/usr.sbin/sysinstall/dmenu.c +++ b/usr.sbin/sysinstall/dmenu.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id$ + * $Id: dmenu.c,v 1.32 1997/02/22 14:11:35 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -174,26 +174,42 @@ dmenuFlagCheck(dialogMenuItem *item) int dmenuVarCheck(dialogMenuItem *item) { - char *w, *cp, *cp2, *cp3, tmp[256]; + char *w; w = (char *)item->aux; if (!w) w = (char *)item->data; if (!w) return FALSE; - SAFE_STRCPY(tmp, w); - if ((cp = index(tmp, '=')) != NULL) { - *(cp++) = '\0'; - if ((cp3 = index(cp, ',')) != NULL) - *cp3 = '\0'; - cp2 = getenv(tmp); - if (cp2) - return !strcmp(cp, cp2); - else - return FALSE; + return variable_check(w); +} + +int +dmenuVarsCheck(dialogMenuItem *item) +{ + int res, init; + char *w, *cp1, *cp2; + char *copy; + + w = (char *)item->aux; + if (!w) + w = (char *)item->data; + if (!w) + return FALSE; + + copy = strdup(w); + res = TRUE; + init = FALSE; + for (cp1 = copy; cp1 != NULL;) { + init = TRUE; + cp2 = index(cp1, ','); + if (cp2 != NULL) + *cp2++ = '\0'; + res = res && variable_check(cp1); + cp1 = cp2; } - else - return (int)getenv(tmp); + free(copy); + return res && init; } int diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 7c7a6b2..82032d8 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.137 1997/06/09 01:19:44 jkh Exp $ + * $Id: menus.c,v 1.138 1997/06/13 14:06:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -1145,7 +1145,7 @@ DMenu MenuNetworking = { dmenuVarCheck, configNovell, NULL, "novell" }, #endif { "Ntpdate", "Select a clock-syncronization server", - dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', (int)VAR_NTPDATE }, + dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', "ntpdate_enable=YES" }, { "router", "Select routing daemon (default: routed)", dmenuVarCheck, configRouter, NULL, "router" }, { "Rwhod", "This machine wants to run the rwho daemon", @@ -1169,46 +1169,69 @@ DMenu MenuNTP = { "close to you to have your system time syncronized accordingly.", "These are the primary open-access NTP servers", NULL, - { { "Other", "Select a site not on this list", - dmenuVarCheck, configNTP, NULL, NULL }, + { { "None", "No ntp server", + dmenuVarCheck, dmenuSetVariables, NULL, + "ntpdate_enable=NO,ntpdate_flags=" }, + { "Other", "Select a site not on this list", + dmenuVarsCheck, configNTP, NULL, + NULL }, { "Australia", "ntp.syd.dms.csiro.au (HP 5061 Cesium Beam)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntp.syd.dms.csiro.au" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntp.syd.dms.csiro.au" }, { "Canada", "tick.usask.ca (GOES clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=tick.usask.ca" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=tick.usask.ca" }, { "France", "canon.inria.fr (TDF clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=canon.inria.fr" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=canon.inria.fr" }, { "Germany", "ntps1-{0,1,2}.uni-erlangen.de (GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntps1-0.uni-erlangen.de" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntps1-0.uni-erlangen.de" }, { "Germany #2", "ntps1-0.cs.tu-berlin.de (GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntps1-0.cs.tu-berlin.de" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntps1-0.cs.tu-berlin.de" }, { "Japan", "clock.nc.fukuoka-u.ac.jp (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.nc.fukuoka-u.ac.jp" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.nc.fukuoka-u.ac.jp" }, { "Japan #2", "clock.tl.fukuoka-u.ac.jp (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.tl.fukuoka-u.ac.jp" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.tl.fukuoka-u.ac.jp" }, { "Netherlands", "ntp0.nl.net (GPS clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ntp0.nl.net" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ntp0.nl.net" }, { "Norway", "timer.unik.no (NTP clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=timer.unik.no" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=timer.unik.no" }, { "Sweden", "Time1.Stupi.SE (Cesium/GPS)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=Time1.Stupi.SE" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=Time1.Stupi.SE" }, { "Switzerland", "swisstime.ethz.ch (DCF77 clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=swisstime.ethz.ch" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=swisstime.ethz.ch" }, { "U.S. East Coast", "bitsy.mit.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=bitsy.mit.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=bitsy.mit.edu" }, { "U.S. East Coast #2", "otc1.psu.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=otc1.psu.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=otc1.psu.edu" }, { "U.S. West Coast", "apple.com (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=apple.com" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=apple.com" }, { "U.S. West Coast #2", "clepsydra.dec.com (GOES clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clepsydra.dec.com" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clepsydra.dec.com" }, { "U.S. West Coast #3", "clock.llnl.gov (WWVB clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=clock.llnl.gov" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=clock.llnl.gov" }, { "U.S. Midwest", "ncar.ucar.edu (WWVB clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=ncar.ucar.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=ncar.ucar.edu" }, { "U.S. Pacific", "chantry.hawaii.net (WWV/H clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=chantry.hawaii.net" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=chantry.hawaii.net" }, { "U.S. Southwest", "shorty.chpc.utexas.edu (WWV clock)", - dmenuVarCheck, dmenuSetVariable, NULL, VAR_NTPDATE "=shorty.chpc.utexas.edu" }, + dmenuVarsCheck, dmenuSetVariables, NULL, + "ntpdate_enable=YES,ntpdate_flags=shorty.chpc.utexas.edu" }, { NULL } }, }; diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index b7926b9..f876f27 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.131 1997/06/05 09:48:01 jkh Exp $ + * $Id: sysinstall.h,v 1.132 1997/06/09 01:19:44 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -137,7 +137,6 @@ #define VAR_NO_CONFIRM "noConfirm" #define VAR_NONINTERACTIVE "nonInteractive" #define VAR_NOVELL "novell" -#define VAR_NTPDATE "ntpdate" #define VAR_PARTITION "partition" #define VAR_PCNFSD "pcnfsd" #define VAR_PCNFSD_PKG "pcnfsd_pkg" @@ -493,6 +492,7 @@ extern int dmenuSetValue(dialogMenuItem *tmp); extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max, Boolean buttons); extern Boolean dmenuOpenSimple(DMenu *menu, Boolean buttons); extern int dmenuVarCheck(dialogMenuItem *item); +extern int dmenuVarsCheck(dialogMenuItem *item); extern int dmenuFlagCheck(dialogMenuItem *item); extern int dmenuRadioCheck(dialogMenuItem *item); @@ -702,6 +702,7 @@ extern void variable_set2(char *name, char *value); extern char *variable_get(char *var); extern void variable_unset(char *var); extern char *variable_get_value(char *var, char *prompt); +extern int variable_check(char *data); /* variable_load.c */ extern int variableLoad(dialogMenuItem *self); diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index 0c579d6..0e31ae39 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: variable.c,v 1.11.2.5 1997/06/11 08:39:27 jkh Exp $ + * $Id: variable.c,v 1.19 1997/06/11 08:41:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -155,3 +155,29 @@ variable_get_value(char *var, char *prompt) cp = NULL; return cp; } + +/* Check if value passed in data (in the form "variable=value") is equal to value of + variable stored in env */ +int +variable_check(char *data) +{ + char *w, *cp, *cp2, *cp3, tmp[256]; + + w = data; + if (!w) + return FALSE; + SAFE_STRCPY(tmp, w); + if ((cp = index(tmp, '=')) != NULL) { + *(cp++) = '\0'; + if ((cp3 = index(cp, ',')) != NULL) + *cp3 = '\0'; + cp2 = getenv(tmp); + + if (cp2) + return !strcmp(cp, cp2); + else + return FALSE; + } + else + return (int)getenv(tmp); +} |