summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dan Winship <danw@mit.edu>1999-06-03 10:51:42 +0000
committerGravatar Dan Winship <danw@mit.edu>1999-06-03 10:51:42 +0000
commit00e3fd8dfe9b567016fde52cf96df704b86b7f58 (patch)
tree0956917aeff6f683052eca4f20e7186546610168
parentd11b2e655baac3e477c400aadeefa39d91558dc4 (diff)
use ZEPHYR_VARS environment variable (if it exists) to determine the
location of the .zephyr.vars file
-rw-r--r--lib/ZVariables.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/ZVariables.c b/lib/ZVariables.c
index 29b5417..1d9cd06 100644
--- a/lib/ZVariables.c
+++ b/lib/ZVariables.c
@@ -116,19 +116,24 @@ static int get_localvarfile(bfr)
char *envptr;
struct passwd *pwd;
- envptr = getenv("HOME");
+ envptr = getenv("ZEPHYR_VARS");
if (envptr)
- (void) strcpy(bfr, envptr);
+ (void) strcpy(bfr, envptr);
else {
- if (!(pwd = getpwuid((int) getuid()))) {
- fprintf(stderr, "Zephyr internal failure: Can't determine your home directory.\n");
- return (1);
+ envptr = getenv("HOME");
+ if (envptr)
+ (void) strcpy(bfr, envptr);
+ else {
+ if (!(pwd = getpwuid((int) getuid()))) {
+ fprintf(stderr, "Zephyr internal failure: Can't determine your home directory.\n");
+ return (1);
+ }
+ (void) strcpy(bfr, pwd->pw_dir);
}
- (void) strcpy(bfr, pwd->pw_dir);
- }
- (void) strcat(bfr, "/");
- (void) strcat(bfr, ".zephyr.vars");
+ (void) strcat(bfr, "/");
+ (void) strcat(bfr, ".zephyr.vars");
+ }
return (0);
}