diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1997-06-13 14:21:22 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1997-06-13 14:21:22 +0000 |
| commit | 08e6881746b463b181beea4826aeefc61514d82c (patch) | |
| tree | a3f04ad8ff700bdc413fcac1f83fd2bb5e248d92 /usr.sbin/sade/variable.c | |
| parent | 4b59b68956db28d242d56a36296890b29dd7c54b (diff) | |
Notes
Diffstat (limited to 'usr.sbin/sade/variable.c')
| -rw-r--r-- | usr.sbin/sade/variable.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c index 0c579d676dab..0e31ae39ccbd 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); +} |
