File: calendar_default.diff

package info (click to toggle)
bsdmainutils 12.1.8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,108 kB
  • sloc: ansic: 2,356; sh: 131; python: 105; makefile: 50; perl: 39
file content (37 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- bsdmainutils/usr.bin/calendar/pathnames.h	2016-03-07 15:26:49.186659640 +0100
+++ bsdmainutils/usr.bin/calendar/pathnames.h	2016-03-07 15:31:37.841085036 +0100
@@ -37,3 +37,6 @@
 
 			/* XXX -- fix when cpp parses arguments rationally */
 #define	_PATH_INCLUDE	"-I/usr/share/calendar"
+#define _PATH_EINCLUDE  "-I/etc/calendar"
+#define _PATH_DEFAULT   "/etc/calendar/default"
+
--- bsdmainutils/usr.bin/calendar/io.c	2020-04-28 10:12:03.591564682 +0200
+++ bsdmainutils/usr.bin/calendar/io.c	2020-04-28 10:21:38.941473630 +0200
@@ -325,9 +325,13 @@
 				errx(1, "cannot get home directory");
 			if (!(chdir(home) == 0 &&
 			    chdir(calendarHome) == 0 &&
-			    (fdin = open(calendarFile, O_RDONLY)) != -1))
-				errx(1, "no calendar file: \"%s\" or \"~/%s/%s\"",
-				    calendarFile, calendarHome, calendarFile);
+			    (fdin = open(calendarFile, O_RDONLY)) != -1)) {
+				/* Try the system-wide calendar file. */
+				if ((fdin = open(_PATH_DEFAULT, O_RDONLY)) == -1) {
+					errx(1, "no calendar file: \"%s\" or \"~/%s/%s\"",
+					    calendarFile, calendarHome, calendarFile);
+				}
+			}
 		}
 	}
 
@@ -362,7 +366,7 @@
 			(void)close(fderr);
 		}
 		execl(_PATH_CPP, "cpp", "-traditional", "-undef", "-U__GNUC__",
-		    "-P", "-I.", _PATH_INCLUDE, (char *)NULL);
+		    "-P", "-I.", _PATH_EINCLUDE, _PATH_INCLUDE, (char *)NULL);
 		warn(_PATH_CPP);
 		_exit(1);
 	}