diff options
author | eadler <eadler@FreeBSD.org> | 2013-12-10 01:39:22 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2013-12-10 01:39:22 +0000 |
commit | 501a3fd7bc0b2bef09fc060b1198ae702df8ef5e (patch) | |
tree | fa0ab92d1d685a19d0e2b180a1932e26392b874a /usr.bin/calendar | |
parent | a960b4929d2d5536d953d9bda33dd9f2aebf8823 (diff) | |
download | FreeBSD-src-501a3fd7bc0b2bef09fc060b1198ae702df8ef5e.zip FreeBSD-src-501a3fd7bc0b2bef09fc060b1198ae702df8ef5e.tar.gz |
calendar(1): Add support for #include with absolute paths
Prior to the addition of cpp support into calendar itself
#include </usr/share/calendar/calendar.all>
was a legal construction in a calendar file.
Permit this again
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/calcpp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/calendar/calcpp.c b/usr.bin/calendar/calcpp.c index 6e3b339..413739b 100644 --- a/usr.bin/calendar/calcpp.c +++ b/usr.bin/calendar/calcpp.c @@ -155,8 +155,11 @@ tokenscpp(char *buf, char *string) s = p+1; if ((p = strchr(s, '>')) != NULL) *p = '\0'; - snprintf (string, MAXPATHLEN, "%s/%s", - _PATH_INCLUDE, s); + if (*s != '/') + snprintf (string, MAXPATHLEN, "%s/%s", + _PATH_INCLUDE, s); + else + strncpy(string, s, MAXPATHLEN); } else if (*p == '(') { s = p+1; if ((p = strchr(p, '>')) != NULL) |