diff options
Diffstat (limited to 'usr.bin/tip')
-rw-r--r-- | usr.bin/tip/tip.h | 6 | ||||
-rw-r--r-- | usr.bin/tip/value.c | 23 | ||||
-rw-r--r-- | usr.bin/tip/vars.c | 6 |
3 files changed, 15 insertions, 20 deletions
diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index 3657dde10e9..e45a0e6a954 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.h,v 1.45 2010/06/29 23:38:05 nicm Exp $ */ +/* $OpenBSD: tip.h,v 1.46 2010/06/30 00:26:49 nicm Exp $ */ /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */ /* @@ -74,9 +74,7 @@ typedef struct { #define V_CHANGED 020 /* to show modification */ #define V_READONLY 040 /* variable is not writable */ - -#define V_ENVIRON 0100 /* initialize out of the environment */ -#define V_INIT 0400 /* static data space used for initialization */ +#define V_INIT 0100 /* static data space used for initialization */ /* * variable manipulation stuff -- diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c index 888b66cdfd1..df5d8d16dcc 100644 --- a/usr.bin/tip/value.c +++ b/usr.bin/tip/value.c @@ -1,4 +1,4 @@ -/* $OpenBSD: value.c,v 1.22 2010/06/29 23:10:56 nicm Exp $ */ +/* $OpenBSD: value.c,v 1.23 2010/06/30 00:26:49 nicm Exp $ */ /* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */ /* @@ -53,16 +53,13 @@ vinit(void) value_t *p; FILE *fp; - for (p = vtable; p->v_name != NULL; p++) { - if (p->v_flags & V_ENVIRON) { - if ((cp = getenv(p->v_name))) - p->v_value = cp; - } - } - /* - * Read the .tiprc file in the HOME directory - * for sets - */ + /* Read environment variables. */ + if (cp = getenv("HOME")) + value(HOME) = cp; + if (cp = getenv("SHELL")) + value(SHELL) = cp; + + /* Read the .tiprc file in the HOME directory. */ written = snprintf(file, sizeof(file), "%s/.tiprc", value(HOME)); if (written < 0 || written >= sizeof(file)) { (void)fprintf(stderr, "Home directory path too long: %s\n", @@ -96,13 +93,13 @@ vassign(value_t *p, char *v) case V_STRING: if (p->v_value && strcmp(p->v_value, v) == 0) return; - if (!(p->v_flags & (V_ENVIRON|V_INIT))) + if (!(p->v_flags & V_INIT)) free(p->v_value); if ((p->v_value = strdup(v)) == NULL) { printf("out of core\r\n"); return; } - p->v_flags &= ~(V_ENVIRON|V_INIT); + p->v_flags &= ~V_INIT; break; case V_NUMBER: if (number(p->v_value) == number(v)) diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c index e53788d93c1..ba572b6ae30 100644 --- a/usr.bin/tip/vars.c +++ b/usr.bin/tip/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.15 2010/06/29 23:38:05 nicm Exp $ */ +/* $OpenBSD: vars.c,v 1.16 2010/06/30 00:26:49 nicm Exp $ */ /* $NetBSD: vars.c,v 1.3 1994/12/08 09:31:19 jtc Exp $ */ /* @@ -79,9 +79,9 @@ value_t vtable[] = { "tab", (char *)0 }, { "verbose", V_BOOL, "verb", (char *)1 }, - { "SHELL", V_STRING|V_ENVIRON|V_INIT, + { "SHELL", V_STRING|V_INIT, NULL, _PATH_BSHELL }, - { "HOME", V_STRING|V_ENVIRON, + { "HOME", V_STRING|V_INIT, NULL, NULL }, { "echocheck", V_BOOL, "ec", (char *)0 }, |