diff options
author | jkh <jkh@FreeBSD.org> | 1998-03-10 17:24:08 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1998-03-10 17:24:08 +0000 |
commit | e87fd2716b04ff0159c7b9cdd217b3e8e2dfe3a0 (patch) | |
tree | e06d26dadf47e16bc37e47e259ab897f74fc22ef /usr.sbin/sysinstall | |
parent | 29b4135e6e482b2938c2441a8ea9c474ccbeff2a (diff) | |
download | FreeBSD-src-e87fd2716b04ff0159c7b9cdd217b3e8e2dfe3a0.zip FreeBSD-src-e87fd2716b04ff0159c7b9cdd217b3e8e2dfe3a0.tar.gz |
Correct misfeature with quoting, better error reporting.
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/config.c | 9 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dmenu.c | 16 | ||||
-rw-r--r-- | usr.sbin/sysinstall/variable.c | 16 |
3 files changed, 25 insertions, 16 deletions
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index e7a07bb..ca9e68a 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.106 1998/03/09 08:39:46 jkh Exp $ + * $Id: config.c,v 1.107 1998/03/09 15:00:43 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -320,7 +320,8 @@ configEnvironmentRC_conf(char *config) /* If valid quotes, use it */ if (cp2) { *cp2 = '\0'; - if (strlen(cp)) + /* If we have a legit value and it's not already set, set it */ + if (strlen(cp) && !variable_get(lines[i])) variable_set2(lines[i], cp); } free(lines[i]); @@ -338,9 +339,9 @@ configEnvironmentResolv(char *config) if (nlines == -1) return; for (i = 0; i < nlines; i++) { - Boolean name_set = FALSE; + Boolean name_set = (Boolean)variable_get(VAR_NAMESERVER); - if (!strncmp(lines[i], "domain", 6)) + if (!strncmp(lines[i], "domain", 6) && !variable_get(VAR_DOMAINNAME)) variable_set2(VAR_DOMAINNAME, string_skipwhite(string_prune(lines[i] + 6))); else if (!strncmp(lines[i], "nameserver", 10) && !name_set) { /* Only take the first nameserver setting - we're lame */ diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c index 45c861e..174f7cb 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.34 1997/09/17 16:18:14 pst Exp $ + * $Id: dmenu.c,v 1.35 1997/10/14 18:17:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -130,10 +130,16 @@ dmenuSetKmapVariable(dialogMenuItem *tmp) int dmenuToggleVariable(dialogMenuItem *tmp) { - if (!variable_get((char *)tmp->data)) - variable_set((char *)tmp->data); + char *var; + + if (!(var = (char *)tmp->data)) { + msgConfirm("Incorrect data field for `%s'!", tmp->title); + return DITEM_FAILURE; + } + if (!variable_get(var)) + variable_set(var); else - variable_unset((char *)tmp->data); + variable_unset(var); return DITEM_SUCCESS; } @@ -201,8 +207,6 @@ dmenuVarCheck(dialogMenuItem *item) w = (char *)item->aux; if (!w) w = (char *)item->data; - if (!w) - return FALSE; return variable_check(w); } diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index a13b71d..c5fcc27 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.20 1997/06/13 14:21:22 jkh Exp $ + * $Id: variable.c,v 1.21 1997/10/12 16:21:21 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -171,14 +171,18 @@ variable_get_value(char *var, char *prompt) int variable_check(char *data) { - char *w, *cp, *cp2, *cp3, tmp[256]; + char *cp, *cp2, *cp3, tmp[256]; - w = data; - if (!w) + if (!data) return FALSE; - SAFE_STRCPY(tmp, w); + SAFE_STRCPY(tmp, data); if ((cp = index(tmp, '=')) != NULL) { *(cp++) = '\0'; + if (*cp == '"') { /* smash quotes if present */ + ++cp; + if ((cp3 = index(cp, '"')) != NULL) + *cp3 = '\0'; + } if ((cp3 = index(cp, ',')) != NULL) *cp3 = '\0'; cp2 = getenv(tmp); @@ -189,5 +193,5 @@ variable_check(char *data) return FALSE; } else - return (int)getenv(tmp); + return getenv(tmp) ? 1 : 0; } |