about summary refs log tree commit diff
path: root/src/usr.bin/calendar/calendar.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-01-22 18:43:14 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-01-22 18:43:14 +0100
commit372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5 (patch)
tree6bb3109b362610f3024cff3e42a946d154737f20 /src/usr.bin/calendar/calendar.c
parent193f150ac3a87fad164b3911bb69280b0728f6f1 (diff)
downloadoutils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.tar.gz
outils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.tar.xz
outils-372fdabc1fcb5eda5a90a05da3d9f9b3b5857ba5.zip
cvs update
Diffstat (limited to 'src/usr.bin/calendar/calendar.c')
-rw-r--r--src/usr.bin/calendar/calendar.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/usr.bin/calendar/calendar.c b/src/usr.bin/calendar/calendar.c
index 094001f..547ba08 100644
--- a/src/usr.bin/calendar/calendar.c
+++ b/src/usr.bin/calendar/calendar.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: calendar.c,v 1.32 2015/10/23 11:43:16 zhuk Exp $	*/
+/*	$OpenBSD: calendar.c,v 1.35 2015/12/07 18:46:35 espie Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -53,6 +53,7 @@ char *calendarNoMail = "nomail";  /* don't sent mail if this file exists */
 
 struct passwd *pw;
 int doall = 0;
+int daynames = 0;
 time_t f_time = 0;
 int bodun_always = 0;
 
@@ -73,7 +74,7 @@ main(int argc, char *argv[])
 
 	(void)setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "abf:t:A:B:-")) != -1)
+	while ((ch = getopt(argc, argv, "abwf:t:A:B:-")) != -1)
 		switch (ch) {
 		case '-':		/* backward contemptible */
 		case 'a':
@@ -108,6 +109,10 @@ main(int argc, char *argv[])
 				errx(1, "-B %s: %s", optarg, errstr);
 			break;
 
+		case 'w':
+			daynames = 1;
+			break;
+
 		default:
 			usage();
 		}
@@ -117,6 +122,15 @@ main(int argc, char *argv[])
 	if (argc)
 		usage();
 
+	if (doall) {
+		if (pledge("stdio rpath tmppath fattr getpw id proc exec", NULL)
+		    == -1)
+			err(1, "pledge");
+	} else {
+		if (pledge("stdio rpath proc exec", NULL) == -1)
+			err(1, "pledge");
+	}
+
 	/* use current time */
 	if (f_time <= 0)
 	    (void)time(&f_time);
@@ -249,7 +263,7 @@ void
 usage(void)
 {
 	(void)fprintf(stderr,
-	    "usage: calendar [-ab] [-A num] [-B num] [-f calendarfile] "
+	    "usage: calendar [-abw] [-A num] [-B num] [-f calendarfile] "
 	    "[-t [[[cc]yy]mm]dd]\n");
 	exit(1);
 }