From e7f10875fa66bbbdec2ab4c1a946b44852b068ee Mon Sep 17 00:00:00 2001 From: jwise Date: Mon, 29 Nov 2004 18:25:14 +0000 Subject: [PATCH] On further thought, always search for calendar files in the caller's home directory when called directly (this was already done for calendar -a, by definition). Old behavior is still available by setting "CALENDAR_DIR=.". --- usr.bin/calendar/calendar.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index ba28bd1fc41b..60d60d6b830d 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $NetBSD: calendar.c,v 1.31 2004/11/29 17:03:43 jwise Exp $ */ +/* $NetBSD: calendar.c,v 1.32 2004/11/29 18:25:14 jwise Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)calendar.c 8.4 (Berkeley) 1/7/95"; #endif -__RCSID("$NetBSD: calendar.c,v 1.31 2004/11/29 17:03:43 jwise Exp $"); +__RCSID("$NetBSD: calendar.c,v 1.32 2004/11/29 18:25:14 jwise Exp $"); #endif /* not lint */ #include @@ -171,7 +171,8 @@ main(argc, argv) if(!chdir(caldir)) cal(); } else { - cal(); + if (((pw = getpwuid(geteuid())) != NULL) && !chdir(pw->pw_dir)) + cal(); } exit(0); }