diff options
author | ache <ache@FreeBSD.org> | 1994-12-31 12:15:27 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-12-31 12:15:27 +0000 |
commit | fa1a1014f5bd2620eb37b17c30710002bdaa108f (patch) | |
tree | 9353aaff9e5577f25b1dcd7c6bacba5d2c33ab85 /usr.bin | |
parent | 8a28c497664bb8b09ba7349f371e0c086a9fb9ba (diff) | |
download | FreeBSD-src-fa1a1014f5bd2620eb37b17c30710002bdaa108f.zip FreeBSD-src-fa1a1014f5bd2620eb37b17c30710002bdaa108f.tar.gz |
Fix for two problems:
Calendar not cd $HOME when running by user
Calendar calls cpp with # lines allowed
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/calendar.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 95f1898..09bbe26 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -80,6 +80,7 @@ main(argc, argv) { extern int optind; int ch; + char *s; while ((ch = getopt(argc, argv, "-a")) != EOF) switch (ch) { @@ -110,8 +111,11 @@ main(argc, argv) cal(); (void)seteuid(0); } - else + else { + if ((s = getenv("HOME")) != NULL) + chdir(s); cal(); + } exit(0); } @@ -301,7 +305,7 @@ opencal() (void)close(pdes[1]); } (void)close(pdes[0]); - execl(_PATH_CPP, "cpp", "-I.", _PATH_INCLUDE, NULL); + execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL); (void)fprintf(stderr, "calendar: execl: %s: %s.\n", _PATH_CPP, strerror(errno)); _exit(1); |