summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-08-23 19:05:09 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-08-23 19:05:09 +0000
commitcd20f799577f922d48105b607102b8a9150f4a9b (patch)
tree00ef7cd380e674c209a0923dd2b4f93a8ccb3afc
parent899d3ca7ae28885eda1ed48d1624305ce8030388 (diff)
Clear options before setting up HOME and SHELL, not after. Fixes parsing
.tiprc reported by nick@.
-rw-r--r--usr.bin/tip/value.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c
index c9db6119d94..7dbfc892f4e 100644
--- a/usr.bin/tip/value.c
+++ b/usr.bin/tip/value.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: value.c,v 1.32 2010/07/11 23:16:42 chl Exp $ */
+/* $OpenBSD: value.c,v 1.33 2010/08/23 19:05:08 nicm Exp $ */
/* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */
/*
@@ -239,6 +239,19 @@ vinit(void)
int written;
FILE *fp;
+ /* Clear the table and set the defaults. */
+ for (vp = vtable; vp->v_name != NULL; vp++) {
+ vp->v_string = NULL;
+ vp->v_number = 0;
+ }
+ vsetnum(BEAUTIFY, 1);
+ vsetnum(ESCAPE, '~');
+ vsetnum(FORCE, CTRL('p'));
+ vsetnum(PROMPT, '\n');
+ vsetnum(TAND, 1);
+ vsetnum(VERBOSE, 1);
+ vsetstr(LOG, _PATH_ACULOG);
+
/* Read environment variables. */
if ((cp = getenv("HOME")) != NULL)
vsetstr(HOME, cp);
@@ -254,19 +267,6 @@ vinit(void)
else
vsetstr(SHELL, _PATH_BSHELL);
- /* Clear the table and set the defaults. */
- for (vp = vtable; vp->v_name != NULL; vp++) {
- vp->v_string = NULL;
- vp->v_number = 0;
- }
- vsetnum(BEAUTIFY, 1);
- vsetnum(ESCAPE, '~');
- vsetnum(FORCE, CTRL('p'));
- vsetnum(PROMPT, '\n');
- vsetnum(TAND, 1);
- vsetnum(VERBOSE, 1);
- vsetstr(LOG, _PATH_ACULOG);
-
/* Read the .tiprc file in the HOME directory. */
written = snprintf(file, sizeof(file), "%s/.tiprc", vgetstr(HOME));
if (written < 0 || written >= sizeof(file)) {