aboutsummaryrefslogtreecommitdiffstats
path: root/deskutils
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-11-04 05:11:00 +0800
committerStefan Eßer <se@FreeBSD.org>2020-11-04 05:11:00 +0800
commit0691aef8f56f8d84ea522dafaa6457a397478288 (patch)
treeb8ce202047ec03081d69c4537d607ef424d7f447 /deskutils
parent3a56f9304eb995e805fb5eb959ece0c6dbf06cc0 (diff)
downloadfreebsd-ports-gnome-0691aef8f56f8d84ea522dafaa6457a397478288.tar.gz
freebsd-ports-gnome-0691aef8f56f8d84ea522dafaa6457a397478288.tar.zst
freebsd-ports-gnome-0691aef8f56f8d84ea522dafaa6457a397478288.zip
Update to -CURRENT SVN rev. r367293
This version processes conditionals with similar restrictions as were effective when the data files were piped through the C pre-processor. Specifically, only the first word after #define is considered as the name being defined. An error is signalled if more than one word is found as argument of #ifdef, #ifndef, or #undef. All calendar files distributed with FreeBSD or in the deskutils/calendar port comply with the newly enforced syntax checks. Dates are now printed as defined for the locale of the user, not as defined by a LANG= assignment in a data file, which is now only considered for character-set translations (if ICONV is set to its default value of ON).
Diffstat (limited to 'deskutils')
-rw-r--r--deskutils/calendar/Makefile4
-rw-r--r--deskutils/calendar/distinfo6
-rw-r--r--deskutils/calendar/files/patch-io.c104
3 files changed, 91 insertions, 23 deletions
diff --git a/deskutils/calendar/Makefile b/deskutils/calendar/Makefile
index 5e3a26c31a5e..3ba85b965777 100644
--- a/deskutils/calendar/Makefile
+++ b/deskutils/calendar/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PORTNAME= calendar
-DISTVERSION= 0.7.2
+DISTVERSION= 0.8
CATEGORIES= deskutils
MAINTAINER= se@FreeBSD.org
@@ -15,7 +15,7 @@ USE_GITHUB= yes
GH_ACCOUNT= bsdimp
GH_TAGNAME= fcc5d31
-CFLAGS+= -D_PATH_LOCALBASE="\"${LOCALBASE}\""
+CFLAGS+= -D_PATH_LOCALBASE='\"${LOCALBASE}\"'
LDFLAGS+= -lm -lutil
PLIST_FILES= bin/calendar \
diff --git a/deskutils/calendar/distinfo b/deskutils/calendar/distinfo
index 485b97618d13..db18a9c925e6 100644
--- a/deskutils/calendar/distinfo
+++ b/deskutils/calendar/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1604263248
-SHA256 (bsdimp-calendar-0.7.2-fcc5d31_GH0.tar.gz) = ad7d0b51c4b834241aebbf6c50d187e5720f6c46c02615b27841a923e082aebc
-SIZE (bsdimp-calendar-0.7.2-fcc5d31_GH0.tar.gz) = 132824
+TIMESTAMP = 1604437341
+SHA256 (bsdimp-calendar-0.8-fcc5d31_GH0.tar.gz) = ad7d0b51c4b834241aebbf6c50d187e5720f6c46c02615b27841a923e082aebc
+SIZE (bsdimp-calendar-0.8-fcc5d31_GH0.tar.gz) = 132824
diff --git a/deskutils/calendar/files/patch-io.c b/deskutils/calendar/files/patch-io.c
index 83b32dce3d15..9f61bdf66fce 100644
--- a/deskutils/calendar/files/patch-io.c
+++ b/deskutils/calendar/files/patch-io.c
@@ -16,7 +16,41 @@
struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
-@@ -116,7 +120,7 @@ cal_fopen(const char *file)
+@@ -85,22 +89,29 @@ static StringList *definitions = NULL;
+ static struct event *events[MAXCOUNT];
+ static char *extradata[MAXCOUNT];
+
+-static void
++static char *
+ trimlr(char **buf)
+ {
+ char *walk = *buf;
++ char *sep;
+ char *last;
+
+ while (isspace(*walk))
+ walk++;
+- if (*walk != '\0') {
+- last = walk + strlen(walk) - 1;
++ *buf = walk;
++
++ sep = walk;
++ while (*sep != '\0' && !isspace(*sep))
++ sep++;
++
++ if (*sep != '\0') {
++ last = sep + strlen(sep) - 1;
+ while (last > walk && isspace(*last))
+ last--;
+ *(last+1) = 0;
+ }
+
+- *buf = walk;
++ return (sep);
+ }
+
+ static FILE *
+@@ -116,7 +127,7 @@ cal_fopen(const char *file)
}
if (chdir(home) != 0) {
@@ -25,7 +59,7 @@
return (NULL);
}
-@@ -124,8 +128,12 @@ cal_fopen(const char *file)
+@@ -124,8 +135,12 @@ cal_fopen(const char *file)
if (chdir(calendarHomes[i]) != 0)
continue;
@@ -39,7 +73,7 @@
}
warnx("can't open calendar file \"%s\"", file);
-@@ -133,60 +141,142 @@ cal_fopen(const char *file)
+@@ -133,60 +148,154 @@ cal_fopen(const char *file)
return (NULL);
}
@@ -64,7 +98,8 @@
-token(char *line, FILE *out, bool *skip)
+token(char *line, FILE *out, int *skip, int *unskip)
{
- char *walk, c, a;
+- char *walk, c, a;
++ char *walk, *sep, a, c;
+ const char *this_cal_home;
+ const char *this_cal_dir;
+ const char *this_cal_file;
@@ -87,14 +122,20 @@
- if (*skip)
+ if (strncmp(line, "ifdef", 5) == 0) {
+ walk = line + 5;
-+ trimlr(&walk);
++ sep = trimlr(&walk);
+
+ if (*walk == '\0') {
+ WARN0("Expecting arguments after #ifdef");
+ return (T_ERR);
+ }
++ if (*sep != '\0') {
++ WARN1("Expecting a single word after #ifdef "
++ "but got \"%s\"", walk);
++ return (T_ERR);
++ }
+
-+ if (*skip != 0 || definitions == NULL || sl_find(definitions, walk) == NULL)
++ if (*skip != 0 ||
++ definitions == NULL || sl_find(definitions, walk) == NULL)
+ ++*skip;
+ else
+ ++*unskip;
@@ -104,14 +145,20 @@
+ if (strncmp(line, "ifndef", 6) == 0) {
+ walk = line + 6;
-+ trimlr(&walk);
++ sep = trimlr(&walk);
+
+ if (*walk == '\0') {
+ WARN0("Expecting arguments after #ifndef");
+ return (T_ERR);
+ }
++ if (*sep != '\0') {
++ WARN1("Expecting a single word after #ifndef "
++ "but got \"%s\"", walk);
++ return (T_ERR);
++ }
+
-+ if (*skip != 0 || (definitions != NULL && sl_find(definitions, walk) != NULL))
++ if (*skip != 0 ||
++ (definitions != NULL && sl_find(definitions, walk) != NULL))
+ ++*skip;
+ else
+ ++*unskip;
@@ -121,7 +168,7 @@
+
+ if (strncmp(line, "else", 4) == 0) {
+ walk = line + 4;
-+ trimlr(&walk);
++ (void)trimlr(&walk);
+
+ if (*walk != '\0') {
+ WARN0("Expecting no arguments after #else");
@@ -150,7 +197,8 @@
if (strncmp(line, "include", 7) == 0) {
walk = line + 7;
- trimlr(&walk);
+- trimlr(&walk);
++ (void)trimlr(&walk);
if (*walk == '\0') {
- warnx("Expecting arguments after #include");
@@ -204,8 +252,13 @@
return (T_OK);
}
-@@ -198,26 +288,29 @@ token(char *line, FILE *out, bool *skip)
- trimlr(&walk);
+@@ -195,29 +304,38 @@ token(char *line, FILE *out, bool *skip)
+ if (definitions == NULL)
+ definitions = sl_init();
+ walk = line + 6;
+- trimlr(&walk);
++ sep = trimlr(&walk);
++ *sep = '\0';
if (*walk == '\0') {
- warnx("Expecting arguments after #define");
@@ -225,7 +278,7 @@
+ if (strncmp(line, "undef", 5) == 0) {
+ if (definitions != NULL) {
+ walk = line + 5;
-+ trimlr(&walk);
++ sep = trimlr(&walk);
- if (*walk == '\0') {
- warnx("Expecting arguments after #ifndef");
@@ -235,6 +288,11 @@
+ WARN0("Expecting arguments after #undef");
+ return (T_ERR);
+ }
++ if (*sep != '\0') {
++ WARN1("Expecting a single word after #undef "
++ "but got \"%s\"", walk);
++ return (T_ERR);
++ }
- if (definitions != NULL && sl_find(definitions, walk) != NULL)
- *skip = true;
@@ -246,7 +304,7 @@
return (T_OK);
}
-@@ -248,11 +341,14 @@ cal_parse(FILE *in, FILE *out)
+@@ -248,11 +366,14 @@ cal_parse(FILE *in, FILE *out)
int month[MAXCOUNT];
int day[MAXCOUNT];
int year[MAXCOUNT];
@@ -262,7 +320,7 @@
/* Unused */
tm.tm_sec = 0;
-@@ -263,9 +359,61 @@ cal_parse(FILE *in, FILE *out)
+@@ -263,9 +384,61 @@ cal_parse(FILE *in, FILE *out)
if (in == NULL)
return (1);
@@ -326,7 +384,7 @@
case T_ERR:
free(line);
return (1);
-@@ -278,18 +426,9 @@ cal_parse(FILE *in, FILE *out)
+@@ -278,18 +451,9 @@ cal_parse(FILE *in, FILE *out)
}
}
@@ -346,7 +404,17 @@
/*
* Setting LANG in user's calendar was an old workaround
* for 'calendar -a' being run with C locale to properly
-@@ -353,7 +492,7 @@ cal_parse(FILE *in, FILE *out)
+@@ -298,8 +462,7 @@ cal_parse(FILE *in, FILE *out)
+ * and does not run iconv(), this variable has little use.
+ */
+ if (strncmp(buf, "LANG=", 5) == 0) {
+- (void)setlocale(LC_ALL, buf + 5);
+- d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
++ (void)setlocale(LC_CTYPE, buf + 5);
+ #ifdef WITH_ICONV
+ if (!doall)
+ set_new_encoding();
+@@ -353,7 +516,7 @@ cal_parse(FILE *in, FILE *out)
if (count < 0) {
/* Show error status based on return value */
if (debug)
@@ -355,7 +423,7 @@
if (count == -1)
continue;
count = -count + 1;
-@@ -373,11 +512,15 @@ cal_parse(FILE *in, FILE *out)
+@@ -373,11 +536,15 @@ cal_parse(FILE *in, FILE *out)
(void)strftime(dbuf, sizeof(dbuf),
d_first ? "%e %b" : "%b %e", &tm);
if (debug)