summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorGravatar Dan Winship <danw@mit.edu>1999-06-03 10:52:13 +0000
committerGravatar Dan Winship <danw@mit.edu>1999-06-03 10:52:13 +0000
commit3c18a8f332355c218d6954c514ef8ff6026c3dcd (patch)
tree82c203bd30e97a946dc0aa4ef5ce12bcd48edc6f /clients
parent00e3fd8dfe9b567016fde52cf96df704b86b7f58 (diff)
use ZEPHYR_SUBS environment variable (if it exists) to determine location
of subs file
Diffstat (limited to 'clients')
-rw-r--r--clients/zctl/zctl.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/clients/zctl/zctl.c b/clients/zctl/zctl.c
index 8e59c79..e68065a 100644
--- a/clients/zctl/zctl.c
+++ b/clients/zctl/zctl.c
@@ -73,25 +73,30 @@ main(argc,argv)
if ((retval = ZInitLocationInfo(NULL, tty)) != ZERR_NONE)
com_err(argv[0], retval, "initializing location information");
- envptr = getenv("HOME");
+ envptr = getenv("ZEPHYR_SUBS");
if (envptr)
strcpy(subsname,envptr);
else {
- if (!(pwd = getpwuid((int) getuid()))) {
- fprintf(stderr,"Who are you?\n");
- exit (1);
- }
+ envptr = getenv("HOME");
+ if (envptr)
+ strcpy(subsname,envptr);
+ else {
+ if (!(pwd = getpwuid((int) getuid()))) {
+ fprintf(stderr,"Who are you?\n");
+ exit (1);
+ }
- strcpy(subsname,pwd->pw_dir);
- }
- strcpy(oldsubsname,subsname);
- strcat(oldsubsname,OLD_SUBS);
- strcat(subsname,USERS_SUBS);
- if (!access(oldsubsname,F_OK) && access(subsname, F_OK)) {
- /* only if old one exists and new one does not exist */
- printf("The .subscriptions file in your home directory is now being used as\n.zephyr.subs . I will rename it to .zephyr.subs for you.\n");
- if (rename(oldsubsname,subsname))
- com_err(argv[0], errno, "renaming .subscriptions");
+ strcpy(subsname,pwd->pw_dir);
+ }
+ strcpy(oldsubsname,subsname);
+ strcat(oldsubsname,OLD_SUBS);
+ strcat(subsname,USERS_SUBS);
+ if (!access(oldsubsname,F_OK) && access(subsname, F_OK)) {
+ /* only if old one exists and new one does not exist */
+ printf("The .subscriptions file in your home directory is now being used as\n.zephyr.subs . I will rename it to .zephyr.subs for you.\n");
+ if (rename(oldsubsname,subsname))
+ com_err(argv[0], errno, "renaming .subscriptions");
+ }
}
#ifdef HAVE_SYS_UTSNAME