diff options
| author | Murray Stokely <murray@FreeBSD.org> | 2001-09-22 18:10:56 +0000 |
|---|---|---|
| committer | Murray Stokely <murray@FreeBSD.org> | 2001-09-22 18:10:56 +0000 |
| commit | eba8393e91f7b6965ac29b170c0356812871bb99 (patch) | |
| tree | c80fbd758ae04d9625cfdb8e1669e7cd204fafb3 /usr.sbin/sysinstall/variable.c | |
| parent | 8f217e4c8bd00ce6bcbfe5eb4776164a7466da16 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/sysinstall/variable.c')
| -rw-r--r-- | usr.sbin/sysinstall/variable.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index ee5627958853..2def090ac272 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -171,8 +171,8 @@ variable_get_value(char *var, char *prompt, int dirty) return cp; } -/* Check if value passed in data (in the form "variable=value") is equal to value of - variable stored in env */ +/* 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) { @@ -227,3 +227,33 @@ dump_variables(dialogMenuItem *unused) return DITEM_SUCCESS; } + +/* Free all of the variables, useful to really start over as when the + user selects "restart" from the interrupt menu. */ +void +free_variables(void) +{ + Variable *vp; + + /* Free the variables from our list, if we have one.. */ + if (!VarHead) + return; + else if (!VarHead->next) { + unsetenv(VarHead->name); + safe_free(VarHead->name); + safe_free(VarHead->value); + free(VarHead); + VarHead = NULL; + } + else { + for (vp = VarHead; vp; ) { + Variable *save = vp; + unsetenv(vp->name); + safe_free(vp->name); + safe_free(vp->value); + vp = vp->next; + safe_free(save); + } + VarHead = NULL; + } +} |
