From 4f718b5d5dce425cd7d4b8dffc42ead31b97e8be Mon Sep 17 00:00:00 2001 From: pst Date: Wed, 17 Sep 1997 16:18:22 +0000 Subject: [PATCH] Put all variables in VAR_ #define's to force a single location for all of these magic knobs. This is purely cosmetic and a documentation issue so we don't have to glop through the source code looking for gems. --- release/sysinstall/config.c | 12 ++++++++---- release/sysinstall/dispatch.c | 4 ++-- release/sysinstall/dmenu.c | 4 ++-- release/sysinstall/package.c | 4 ++-- release/sysinstall/sysinstall.h | 9 +++++++-- release/sysinstall/tcpip.c | 5 +++-- usr.sbin/sade/config.c | 12 ++++++++---- usr.sbin/sade/dispatch.c | 4 ++-- usr.sbin/sade/dmenu.c | 4 ++-- usr.sbin/sade/sade.h | 9 +++++++-- usr.sbin/sysinstall/config.c | 12 ++++++++---- usr.sbin/sysinstall/dispatch.c | 4 ++-- usr.sbin/sysinstall/dmenu.c | 4 ++-- usr.sbin/sysinstall/package.c | 4 ++-- usr.sbin/sysinstall/sysinstall.h | 9 +++++++-- usr.sbin/sysinstall/tcpip.c | 5 +++-- 16 files changed, 67 insertions(+), 38 deletions(-) diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index cb70bce7b136..2b37c899e156 100644 --- a/release/sysinstall/config.c +++ b/release/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.102 1997/08/17 10:08:25 jkh Exp $ + * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -469,7 +469,8 @@ configSaver(dialogMenuItem *self) int configSaverTimeout(dialogMenuItem *self) { - return (variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? + return (variable_get_value(VAR_BLANKTIME, + "Enter time-out period in seconds for screen saver") ? DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE; } @@ -484,11 +485,14 @@ configNTP(dialogMenuItem *self) { int status; - status = variable_get_value("ntpdate_flags", "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + status = variable_get_value(VAR_NTPDATE_FLAGS, + "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; if (status == DITEM_SUCCESS) { static char tmp[255]; - snprintf(tmp, 255, "ntpdate_enable=YES,ntpdate_flags=%s", variable_get("ntpdate_flags")); + snprintf(tmp, sizeof(tmp), "ntpdate_enable=YES,ntpdate_flags=%s", + variable_get(VAR_NTPDATE_FLAGS)); self->data = tmp; dmenuSetVariables(self); } diff --git a/release/sysinstall/dispatch.c b/release/sysinstall/dispatch.c index 181ccd52b782..67e09d6a15c2 100644 --- a/release/sysinstall/dispatch.c +++ b/release/sysinstall/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.22 1997/09/08 11:09:08 jkh Exp $ + * $Id: dispatch.c,v 1.23 1997/09/16 18:57:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -173,7 +173,7 @@ dispatch_shutdown(dialogMenuItem *unused) static int dispatch_systemExecute(dialogMenuItem *unused) { - char *cmd = variable_get("command"); + char *cmd = variable_get(VAR_COMMAND); if (cmd) return systemExecute(cmd) ? DITEM_FAILURE : DITEM_SUCCESS; diff --git a/release/sysinstall/dmenu.c b/release/sysinstall/dmenu.c index 3f769776364f..c806ab959b37 100644 --- a/release/sysinstall/dmenu.c +++ b/release/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: dmenu.c,v 1.32 1997/02/22 14:11:35 peter Exp $ + * $Id: dmenu.c,v 1.33 1997/06/13 14:21:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -115,7 +115,7 @@ dmenuSetKmapVariable(dialogMenuItem *tmp) int err; variable_set((char *)tmp->data); - lang = variable_get("keymap"); + lang = variable_get(VAR_KEYMAP); if (lang != NULL) { err = loadKeymap(lang); diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 25cd40b4bf1a..ff9415e51378 100644 --- a/release/sysinstall/package.c +++ b/release/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.62 1997/06/13 17:55:32 jkh Exp $ + * $Id: package.c,v 1.63 1997/09/16 10:14:22 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -64,7 +64,7 @@ packageAdd(dialogMenuItem *self) { char *cp; - cp = variable_get("package"); + cp = variable_get(VAR_PACKAGE); if (!cp) { msgDebug("packageAdd: No package name passed in package variable\n"); return DITEM_FAILURE; diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 0b77928c3bb0..fad032aec9fb 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/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.139 1997/07/31 11:08:41 jkh Exp $ + * $Id: sysinstall.h,v 1.140 1997/09/16 18:57:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -106,7 +106,8 @@ #define VAR_DOMAINNAME "domainname" #define VAR_EDITOR "editor" #define VAR_EXTRAS "ifconfig_" -#define VAR_CONFIG_FILE "configFile" +#define VAR_COMMAND "command" +#define VAR_CONFIG_FILE "configFile" #define VAR_FTP_DIR "ftpDirectory" #define VAR_FTP_PASS "ftpPass" #define VAR_FTP_PATH "ftp" @@ -123,11 +124,13 @@ #define VAR_INSTALL_CFG "installConfig" #define VAR_INSTALL_ROOT "installRoot" #define VAR_IPADDR "ipaddr" +#define VAR_KEYMAP "keymap" #define VAR_LABEL "label" #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" #define VAR_NAMESERVER "nameserver" +#define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" #define VAR_NETWORK_DEVICE "netDev" #define VAR_NFS_PATH "nfs" @@ -139,6 +142,8 @@ #define VAR_NO_WARN "noWarn" #define VAR_NONINTERACTIVE "nonInteractive" #define VAR_NOVELL "novell" +#define VAR_NTPDATE_FLAGS "ntpdate_flags" +#define VAR_PACKAGE "package" #define VAR_PARTITION "partition" #define VAR_PCNFSD "pcnfsd" #define VAR_PCNFSD_PKG "pcnfsd_pkg" diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c index f702e71706e4..a78bc8537695 100644 --- a/release/sysinstall/tcpip.c +++ b/release/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.70 1997/09/08 11:09:11 jkh Exp $ + * $Id: tcpip.c,v 1.71 1997/09/17 13:33:14 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -211,7 +211,8 @@ tcpOpenDialog(Device *devp) save = savescr(); /* If non-interactive, jump straight over the dialog crap and into config section */ - if (variable_get(VAR_NONINTERACTIVE) && !variable_get("netInteractive")) { + if (variable_get(VAR_NONINTERACTIVE) && + !variable_get(VAR_NETINTERACTIVE)) { if (!hostname[0]) msgConfirm("WARNING: hostname variable not set and is a non-optional\n" "parameter. Please add this to your installation script\n" diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index cb70bce7b136..2b37c899e156 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.102 1997/08/17 10:08:25 jkh Exp $ + * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -469,7 +469,8 @@ configSaver(dialogMenuItem *self) int configSaverTimeout(dialogMenuItem *self) { - return (variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? + return (variable_get_value(VAR_BLANKTIME, + "Enter time-out period in seconds for screen saver") ? DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE; } @@ -484,11 +485,14 @@ configNTP(dialogMenuItem *self) { int status; - status = variable_get_value("ntpdate_flags", "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + status = variable_get_value(VAR_NTPDATE_FLAGS, + "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; if (status == DITEM_SUCCESS) { static char tmp[255]; - snprintf(tmp, 255, "ntpdate_enable=YES,ntpdate_flags=%s", variable_get("ntpdate_flags")); + snprintf(tmp, sizeof(tmp), "ntpdate_enable=YES,ntpdate_flags=%s", + variable_get(VAR_NTPDATE_FLAGS)); self->data = tmp; dmenuSetVariables(self); } diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c index 181ccd52b782..67e09d6a15c2 100644 --- a/usr.sbin/sade/dispatch.c +++ b/usr.sbin/sade/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.22 1997/09/08 11:09:08 jkh Exp $ + * $Id: dispatch.c,v 1.23 1997/09/16 18:57:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -173,7 +173,7 @@ dispatch_shutdown(dialogMenuItem *unused) static int dispatch_systemExecute(dialogMenuItem *unused) { - char *cmd = variable_get("command"); + char *cmd = variable_get(VAR_COMMAND); if (cmd) return systemExecute(cmd) ? DITEM_FAILURE : DITEM_SUCCESS; diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c index 3f769776364f..c806ab959b37 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: dmenu.c,v 1.32 1997/02/22 14:11:35 peter Exp $ + * $Id: dmenu.c,v 1.33 1997/06/13 14:21:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -115,7 +115,7 @@ dmenuSetKmapVariable(dialogMenuItem *tmp) int err; variable_set((char *)tmp->data); - lang = variable_get("keymap"); + lang = variable_get(VAR_KEYMAP); if (lang != NULL) { err = loadKeymap(lang); diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 0b77928c3bb0..fad032aec9fb 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.139 1997/07/31 11:08:41 jkh Exp $ + * $Id: sysinstall.h,v 1.140 1997/09/16 18:57:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -106,7 +106,8 @@ #define VAR_DOMAINNAME "domainname" #define VAR_EDITOR "editor" #define VAR_EXTRAS "ifconfig_" -#define VAR_CONFIG_FILE "configFile" +#define VAR_COMMAND "command" +#define VAR_CONFIG_FILE "configFile" #define VAR_FTP_DIR "ftpDirectory" #define VAR_FTP_PASS "ftpPass" #define VAR_FTP_PATH "ftp" @@ -123,11 +124,13 @@ #define VAR_INSTALL_CFG "installConfig" #define VAR_INSTALL_ROOT "installRoot" #define VAR_IPADDR "ipaddr" +#define VAR_KEYMAP "keymap" #define VAR_LABEL "label" #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" #define VAR_NAMESERVER "nameserver" +#define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" #define VAR_NETWORK_DEVICE "netDev" #define VAR_NFS_PATH "nfs" @@ -139,6 +142,8 @@ #define VAR_NO_WARN "noWarn" #define VAR_NONINTERACTIVE "nonInteractive" #define VAR_NOVELL "novell" +#define VAR_NTPDATE_FLAGS "ntpdate_flags" +#define VAR_PACKAGE "package" #define VAR_PARTITION "partition" #define VAR_PCNFSD "pcnfsd" #define VAR_PCNFSD_PKG "pcnfsd_pkg" diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index cb70bce7b136..2b37c899e156 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.102 1997/08/17 10:08:25 jkh Exp $ + * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -469,7 +469,8 @@ configSaver(dialogMenuItem *self) int configSaverTimeout(dialogMenuItem *self) { - return (variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? + return (variable_get_value(VAR_BLANKTIME, + "Enter time-out period in seconds for screen saver") ? DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE; } @@ -484,11 +485,14 @@ configNTP(dialogMenuItem *self) { int status; - status = variable_get_value("ntpdate_flags", "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + status = variable_get_value(VAR_NTPDATE_FLAGS, + "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; if (status == DITEM_SUCCESS) { static char tmp[255]; - snprintf(tmp, 255, "ntpdate_enable=YES,ntpdate_flags=%s", variable_get("ntpdate_flags")); + snprintf(tmp, sizeof(tmp), "ntpdate_enable=YES,ntpdate_flags=%s", + variable_get(VAR_NTPDATE_FLAGS)); self->data = tmp; dmenuSetVariables(self); } diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c index 181ccd52b782..67e09d6a15c2 100644 --- a/usr.sbin/sysinstall/dispatch.c +++ b/usr.sbin/sysinstall/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.22 1997/09/08 11:09:08 jkh Exp $ + * $Id: dispatch.c,v 1.23 1997/09/16 18:57:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -173,7 +173,7 @@ dispatch_shutdown(dialogMenuItem *unused) static int dispatch_systemExecute(dialogMenuItem *unused) { - char *cmd = variable_get("command"); + char *cmd = variable_get(VAR_COMMAND); if (cmd) return systemExecute(cmd) ? DITEM_FAILURE : DITEM_SUCCESS; diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c index 3f769776364f..c806ab959b37 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: dmenu.c,v 1.32 1997/02/22 14:11:35 peter Exp $ + * $Id: dmenu.c,v 1.33 1997/06/13 14:21:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -115,7 +115,7 @@ dmenuSetKmapVariable(dialogMenuItem *tmp) int err; variable_set((char *)tmp->data); - lang = variable_get("keymap"); + lang = variable_get(VAR_KEYMAP); if (lang != NULL) { err = loadKeymap(lang); diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 25cd40b4bf1a..ff9415e51378 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.62 1997/06/13 17:55:32 jkh Exp $ + * $Id: package.c,v 1.63 1997/09/16 10:14:22 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -64,7 +64,7 @@ packageAdd(dialogMenuItem *self) { char *cp; - cp = variable_get("package"); + cp = variable_get(VAR_PACKAGE); if (!cp) { msgDebug("packageAdd: No package name passed in package variable\n"); return DITEM_FAILURE; diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 0b77928c3bb0..fad032aec9fb 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.139 1997/07/31 11:08:41 jkh Exp $ + * $Id: sysinstall.h,v 1.140 1997/09/16 18:57:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -106,7 +106,8 @@ #define VAR_DOMAINNAME "domainname" #define VAR_EDITOR "editor" #define VAR_EXTRAS "ifconfig_" -#define VAR_CONFIG_FILE "configFile" +#define VAR_COMMAND "command" +#define VAR_CONFIG_FILE "configFile" #define VAR_FTP_DIR "ftpDirectory" #define VAR_FTP_PASS "ftpPass" #define VAR_FTP_PATH "ftp" @@ -123,11 +124,13 @@ #define VAR_INSTALL_CFG "installConfig" #define VAR_INSTALL_ROOT "installRoot" #define VAR_IPADDR "ipaddr" +#define VAR_KEYMAP "keymap" #define VAR_LABEL "label" #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" #define VAR_NAMESERVER "nameserver" +#define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" #define VAR_NETWORK_DEVICE "netDev" #define VAR_NFS_PATH "nfs" @@ -139,6 +142,8 @@ #define VAR_NO_WARN "noWarn" #define VAR_NONINTERACTIVE "nonInteractive" #define VAR_NOVELL "novell" +#define VAR_NTPDATE_FLAGS "ntpdate_flags" +#define VAR_PACKAGE "package" #define VAR_PARTITION "partition" #define VAR_PCNFSD "pcnfsd" #define VAR_PCNFSD_PKG "pcnfsd_pkg" diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c index f702e71706e4..a78bc8537695 100644 --- a/usr.sbin/sysinstall/tcpip.c +++ b/usr.sbin/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.70 1997/09/08 11:09:11 jkh Exp $ + * $Id: tcpip.c,v 1.71 1997/09/17 13:33:14 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -211,7 +211,8 @@ tcpOpenDialog(Device *devp) save = savescr(); /* If non-interactive, jump straight over the dialog crap and into config section */ - if (variable_get(VAR_NONINTERACTIVE) && !variable_get("netInteractive")) { + if (variable_get(VAR_NONINTERACTIVE) && + !variable_get(VAR_NETINTERACTIVE)) { if (!hostname[0]) msgConfirm("WARNING: hostname variable not set and is a non-optional\n" "parameter. Please add this to your installation script\n"