From owner-svn-ports-all@freebsd.org Fri Nov 6 22:04:14 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D3352D4904; Fri, 6 Nov 2020 22:04:14 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CSZDG41Ftz4qpK; Fri, 6 Nov 2020 22:04:14 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9D62BCC4; Fri, 6 Nov 2020 22:04:14 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6M4E4d099715; Fri, 6 Nov 2020 22:04:14 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6M4CDL099707; Fri, 6 Nov 2020 22:04:12 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011062204.0A6M4CDL099707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Fri, 6 Nov 2020 22:04:12 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r554325 - in head/deskutils/calendar: . files X-SVN-Group: ports-head X-SVN-Commit-Author: se X-SVN-Commit-Paths: in head/deskutils/calendar: . files X-SVN-Commit-Revision: 554325 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 22:04:14 -0000 Author: se Date: Fri Nov 6 22:04:12 2020 New Revision: 554325 URL: https://svnweb.freebsd.org/changeset/ports/554325 Log: Update to FreeBSD base SVN revision r367364 This upgrade improves the compatibility with prior versions that used cpp to pre-process the calendar files.. Added: head/deskutils/calendar/files/patch-calendar.h (contents, props changed) head/deskutils/calendar/files/patch-parsedata.c (contents, props changed) head/deskutils/calendar/files/patch-tests_Makefile (contents, props changed) Modified: head/deskutils/calendar/Makefile head/deskutils/calendar/distinfo head/deskutils/calendar/files/patch-calendar.1 head/deskutils/calendar/files/patch-dates.c head/deskutils/calendar/files/patch-events.c head/deskutils/calendar/files/patch-io.c Modified: head/deskutils/calendar/Makefile ============================================================================== --- head/deskutils/calendar/Makefile Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/Makefile Fri Nov 6 22:04:12 2020 (r554325) @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= calendar -DISTVERSION= 0.8 +DISTVERSION= 0.9 CATEGORIES= deskutils MAINTAINER= se@FreeBSD.org Modified: head/deskutils/calendar/distinfo ============================================================================== --- head/deskutils/calendar/distinfo Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/distinfo Fri Nov 6 22:04:12 2020 (r554325) @@ -1,3 +1,3 @@ -TIMESTAMP = 1604437341 -SHA256 (bsdimp-calendar-0.8-fcc5d31_GH0.tar.gz) = ad7d0b51c4b834241aebbf6c50d187e5720f6c46c02615b27841a923e082aebc -SIZE (bsdimp-calendar-0.8-fcc5d31_GH0.tar.gz) = 132824 +TIMESTAMP = 1604699934 +SHA256 (bsdimp-calendar-0.9-fcc5d31_GH0.tar.gz) = ad7d0b51c4b834241aebbf6c50d187e5720f6c46c02615b27841a923e082aebc +SIZE (bsdimp-calendar-0.9-fcc5d31_GH0.tar.gz) = 132824 Modified: head/deskutils/calendar/files/patch-calendar.1 ============================================================================== --- head/deskutils/calendar/files/patch-calendar.1 Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/files/patch-calendar.1 Fri Nov 6 22:04:12 2020 (r554325) @@ -5,26 +5,50 @@ .\" $FreeBSD$ .\" -.Dd September 29, 2020 -+.Dd October 28, 2020 ++.Dd November 5, 2020 .Dt CALENDAR 1 .Os .Sh NAME -@@ -198,7 +198,13 @@ file is preprocessed by a limited subset of +@@ -198,18 +198,35 @@ file is preprocessed by a limited subset of .Xr cpp 1 internally, allowing the inclusion of shared files such as lists of company holidays or meetings. -This limited subset consists of \fB#include #ifndef #endif\fR and \fB#define\fR. -+This limited subset consists of \fB#include #ifdef #ifndef #else -+#endif\fR and \fB#define\fR. Conditions can be nested, but not check -+for matching begin and end directives is performed. -+Included files are parsed in their own scope. -+They have no read or write access to condition variables defined in -+an outer scope and open conditional blocks are implicitly closed. ++This limited subset consists of \fB#include\fR, \fB#define\fR, ++\fB#undef\fR, \fB#ifdef\fR, \fB#ifndef\fR, \fB#else\fR, \fB#warning\fR, ++and \fB#error\fR. +.Pp ++Conditions can be nested and the consistency of opening and closing ++instructions is checked. ++Only the first word after #define is used as the name of the ++condition variable being defined. ++More than word following #ifdef, #ifndef, or #undef is considered a syntax ++error, since names cannot include white-space. ++Included files are parsed in a global scope with regard to the condition ++variables being defined or tested therein. ++All conditional blocks are implicitly closed at the end of a file, ++and missing #endif instructions are assumed to be present on implied ++succeeding lines. ++.Pp If the shared file is not referenced by a full pathname, .Nm searches in the current (or home) directory first, and then in the -@@ -245,11 +251,19 @@ A chdir is done into this directory if it exists. + directory + .Pa /usr/share/calendar . +-Empty lines and lines protected by the C commenting syntax ++Empty lines and text protected by the C commenting syntax + .Pq Li /* ... */ ++or ++.Pq Li // + are ignored. + .Pp + Some possible calendar entries ( characters highlighted by +-\fB\et\fR sequence) ++\fB\et\fR sequence): + .Bd -unfilled -offset indent + LANG=C + Easter=Ostern +@@ -245,11 +262,19 @@ A chdir is done into this directory if it exists. calendar file to use if no calendar file exists in the current directory. .It Pa ~/.calendar/nomail do not send mail if this file exists. @@ -46,7 +70,7 @@ .Bl -tag -width calendar.southafrica -compact .It Pa calendar.all File which includes all the default files. -@@ -283,8 +297,8 @@ Other holidays, including the not-well-known, obscure, +@@ -283,8 +308,8 @@ Other holidays, including the not-well-known, obscure, obscure. .It Pa calendar.judaic Jewish holidays. @@ -57,7 +81,7 @@ .It Pa calendar.music Musical events, births, and deaths. Strongly oriented toward rock 'n' roll. -@@ -338,11 +352,12 @@ double-check the start and end time of solar and lunar +@@ -338,11 +363,12 @@ double-check the start and end time of solar and lunar .Sh BUGS The .Nm Added: head/deskutils/calendar/files/patch-calendar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/deskutils/calendar/files/patch-calendar.h Fri Nov 6 22:04:12 2020 (r554325) @@ -0,0 +1,28 @@ +--- calendar.h.orig 2020-10-18 03:01:26 UTC ++++ calendar.h +@@ -122,7 +122,7 @@ extern int year1, year2; + * - Use event_continue() to add more text to the last added event + * - Use event_print_all() to display them in time chronological order + */ +-struct event *event_add(int, int, int, char *, int, char *, char *); ++struct event *event_add(int, int, int, int, char *, char *); + void event_continue(struct event *events, char *txt); + void event_print_all(FILE *fp); + struct event { +@@ -130,7 +130,6 @@ struct event { + int month; + int day; + int var; +- char *date; + char *text; + char *extra; + struct event *next; +@@ -189,7 +188,7 @@ int remember_yd(int y, int d, int *rm, int *rd); + int first_dayofweek_of_year(int y); + int first_dayofweek_of_month(int y, int m); + int walkthrough_dates(struct event **e); +-void addtodate(struct event *e, int year, int month, int day); ++void addtodate(struct event *e); + + /* pom.c */ + #define MAXMOONS 18 Modified: head/deskutils/calendar/files/patch-dates.c ============================================================================== --- head/deskutils/calendar/files/patch-dates.c Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/files/patch-dates.c Fri Nov 6 22:04:12 2020 (r554325) @@ -1,14 +1,5 @@ --- dates.c.orig 2020-10-18 03:01:26 UTC +++ dates.c -@@ -28,7 +28,7 @@ - */ - - #include --__FBSDID("$FreeBSD$"); -+__FBSDID("$FreeBSD: head/usr.bin/calendar/dates.c 367173 2020-10-30 15:43:52Z se $"); - - #include - #include @@ -64,6 +64,7 @@ struct cal_day { struct cal_month *month; /* points back */ struct cal_year *year; /* points back */ @@ -17,15 +8,20 @@ }; int debug_remember = 0; -@@ -446,8 +447,13 @@ void - addtodate(struct event *e, int year, int month, int day) +@@ -443,11 +444,16 @@ find_day(int yy, int mm, int dd) + } + + void +-addtodate(struct event *e, int year, int month, int day) ++addtodate(struct event *e) { struct cal_day *d; + struct event *ee; - d = find_day(year, month, day); +- d = find_day(year, month, day); - e->next = d->events; - d->events = e; ++ d = find_day(e->year, e->month, e->day); + ee = d->lastevent; + if (ee != NULL) + ee->next = e; Modified: head/deskutils/calendar/files/patch-events.c ============================================================================== --- head/deskutils/calendar/files/patch-events.c Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/files/patch-events.c Fri Nov 6 22:04:12 2020 (r554325) @@ -1,14 +1,75 @@ --- events.c.orig 2020-10-18 03:01:26 UTC +++ events.c -@@ -207,8 +207,9 @@ event_print_all(FILE *fp) +@@ -150,8 +150,7 @@ convert(char *input) + } + struct event * +-event_add(int year, int month, int day, char *date, int var, char *txt, +- char *extra) ++event_add(int year, int month, int day, int var, char *txt, char *extra) + { + struct event *e; + +@@ -159,25 +158,22 @@ event_add(int year, int month, int day, char *date, in + * Creating a new event: + * - Create a new event + * - Copy the machine readable day and month +- * - Copy the human readable and language specific date + * - Copy the text of the event + */ + e = (struct event *)calloc(1, sizeof(struct event)); + if (e == NULL) + errx(1, "event_add: cannot allocate memory"); ++ e->year = year; + e->month = month; + e->day = day; + e->var = var; +- e->date = convert(date); +- if (e->date == NULL) +- errx(1, "event_add: cannot allocate memory"); + e->text = convert(txt); + if (e->text == NULL) + errx(1, "event_add: cannot allocate memory"); + e->extra = NULL; + if (extra != NULL && extra[0] != '\0') + e->extra = convert(extra); +- addtodate(e, year, month, day); ++ addtodate(e); + return (e); + } + +@@ -204,19 +200,31 @@ void + event_print_all(FILE *fp) + { + struct event *e; ++ struct tm tm; ++ char dbuf[80]; ++ static int d_first; + ++ d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); ++ while (walkthrough_dates(&e) != 0) { ++ if (e) { #ifdef DEBUG - fprintf(stderr, "event_print_allmonth: %d, day: %d\n", - month, day); -+ if (e) + fprintf(stderr, "event_print_all month: %d, day: %d\n", + e->month, e->day); #endif ++ memset(&tm, 0, sizeof(struct tm)); ++ tm.tm_mday = e->day; ++ tm.tm_mon = e->month - 1; ++ tm.tm_year = e->year - 1900; ++ (void)strftime(dbuf, sizeof(dbuf), d_first ? "%e %b" : "%b %e", &tm); ++ } /* + * Go through all events and print the text of the matching + * dates + */ + while (e != NULL) { +- (void)fprintf(fp, "%s%c%s%s%s%s\n", e->date, ++ (void)fprintf(fp, "%s%c%s%s%s%s\n", dbuf, + e->var ? '*' : ' ', e->text, + e->extra != NULL ? " (" : "", + e->extra != NULL ? e->extra : "", Modified: head/deskutils/calendar/files/patch-io.c ============================================================================== --- head/deskutils/calendar/files/patch-io.c Fri Nov 6 21:30:52 2020 (r554324) +++ head/deskutils/calendar/files/patch-io.c Fri Nov 6 22:04:12 2020 (r554325) @@ -1,6 +1,14 @@ --- io.c.orig 2020-10-18 03:01:26 UTC +++ io.c -@@ -71,10 +71,14 @@ enum { +@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); + #include + #include + #include +-#include + #include + #include + #include +@@ -71,10 +70,14 @@ enum { }; const char *calendarFile = "calendar"; /* default calendar file */ @@ -16,7 +24,7 @@ struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon; struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice; -@@ -85,22 +89,29 @@ static StringList *definitions = NULL; +@@ -85,22 +88,29 @@ static StringList *definitions = NULL; static struct event *events[MAXCOUNT]; static char *extradata[MAXCOUNT]; @@ -50,7 +58,7 @@ } static FILE * -@@ -116,7 +127,7 @@ cal_fopen(const char *file) +@@ -116,7 +126,7 @@ cal_fopen(const char *file) } if (chdir(home) != 0) { @@ -59,7 +67,7 @@ return (NULL); } -@@ -124,8 +135,12 @@ cal_fopen(const char *file) +@@ -124,8 +134,12 @@ cal_fopen(const char *file) if (chdir(calendarHomes[i]) != 0) continue; @@ -73,7 +81,7 @@ } warnx("can't open calendar file \"%s\"", file); -@@ -133,60 +148,154 @@ cal_fopen(const char *file) +@@ -133,96 +147,236 @@ cal_fopen(const char *file) return (NULL); } @@ -82,7 +90,9 @@ +{ + static char buffer[MAXPATHLEN + 10]; + -+ if (cal_dir[0] == '/') ++ if (cal_dir == NULL) ++ snprintf(buffer, sizeof(buffer), "%s", cal_file); ++ else if (cal_dir[0] == '/') + snprintf(buffer, sizeof(buffer), "%s/%s", cal_dir, cal_file); + else + snprintf(buffer, sizeof(buffer), "%s/%s/%s", cal_home, cal_dir, cal_file); @@ -94,6 +104,16 @@ +#define WARN1(format, arg1) \ + warnx(format " in %s line %d", arg1, cal_path(), cal_line) + ++static char* ++cmptoken(char *line, const char* token) ++{ ++ char len = strlen(token); ++ ++ if (strncmp(line, token, len) != 0) ++ return NULL; ++ return (line + len); ++} ++ static int -token(char *line, FILE *out, bool *skip) +token(char *line, FILE *out, int *skip, int *unskip) @@ -105,23 +125,27 @@ + const char *this_cal_file; + int this_cal_line; - if (strncmp(line, "endif", 5) == 0) { +- if (strncmp(line, "endif", 5) == 0) { - *skip = false; -+ if (*skip > 0) -+ --*skip; -+ else if (*unskip > 0) -+ --*unskip; -+ else { ++ while (isspace(*line)) ++ line++; ++ ++ if (cmptoken(line, "endif")) { ++ if (*skip + *unskip == 0) { + WARN0("#endif without prior #ifdef or #ifndef"); + return (T_ERR); + } ++ if (*skip > 0) ++ --*skip; ++ else ++ --*unskip; + return (T_OK); } - if (*skip) -+ if (strncmp(line, "ifdef", 5) == 0) { -+ walk = line + 5; ++ walk = cmptoken(line, "ifdef"); ++ if (walk != NULL) { + sep = trimlr(&walk); + + if (*walk == '\0') { @@ -143,10 +167,13 @@ return (T_OK); + } -+ if (strncmp(line, "ifndef", 6) == 0) { -+ walk = line + 6; +- if (strncmp(line, "include", 7) == 0) { +- walk = line + 7; ++ walk = cmptoken(line, "ifndef"); ++ if (walk != NULL) { + sep = trimlr(&walk); -+ + +- trimlr(&walk); + if (*walk == '\0') { + WARN0("Expecting arguments after #ifndef"); + return (T_ERR); @@ -156,7 +183,7 @@ + "but got \"%s\"", walk); + return (T_ERR); + } -+ + + if (*skip != 0 || + (definitions != NULL && sl_find(definitions, walk) != NULL)) + ++*skip; @@ -166,26 +193,25 @@ + return (T_OK); + } + -+ if (strncmp(line, "else", 4) == 0) { -+ walk = line + 4; ++ walk = cmptoken(line, "else"); ++ if (walk != NULL) { + (void)trimlr(&walk); + + if (*walk != '\0') { + WARN0("Expecting no arguments after #else"); + return (T_ERR); + } ++ if (*skip + *unskip == 0) { ++ WARN0("#else without prior #ifdef or #ifndef"); ++ return (T_ERR); ++ } + -+ if (*unskip == 0) { -+ if (*skip == 0) { -+ WARN0("#else without prior #ifdef or #ifndef"); -+ return (T_ERR); -+ } else if (*skip == 1) { -+ *skip = 0; -+ *unskip = 1; -+ } -+ } else if (*unskip == 1) { -+ *skip = 1; -+ *unskip = 0; ++ if (*skip == 0) { ++ ++*skip; ++ --*unskip; ++ } else if (*skip == 1) { ++ --*skip; ++ ++*unskip; + } + + return (T_OK); @@ -194,12 +220,10 @@ + if (*skip != 0) + return (T_OK); + - if (strncmp(line, "include", 7) == 0) { - walk = line + 7; - -- trimlr(&walk); ++ walk = cmptoken(line, "include"); ++ if (walk != NULL) { + (void)trimlr(&walk); - ++ if (*walk == '\0') { - warnx("Expecting arguments after #include"); + WARN0("Expecting arguments after #include"); @@ -252,10 +276,13 @@ return (T_OK); } -@@ -195,29 +304,38 @@ token(char *line, FILE *out, bool *skip) + +- if (strncmp(line, "define", 6) == 0) { ++ walk = cmptoken(line, "define"); ++ if (walk != NULL) { if (definitions == NULL) definitions = sl_init(); - walk = line + 6; +- walk = line + 6; - trimlr(&walk); + sep = trimlr(&walk); + *sep = '\0'; @@ -275,15 +302,14 @@ - if (strncmp(line, "ifndef", 6) == 0) { - walk = line + 6; - trimlr(&walk); -+ if (strncmp(line, "undef", 5) == 0) { ++ walk = cmptoken(line, "undef"); ++ if (walk != NULL) { + if (definitions != NULL) { -+ walk = line + 5; + sep = trimlr(&walk); - if (*walk == '\0') { - warnx("Expecting arguments after #ifndef"); - return (T_ERR); -- } + if (*walk == '\0') { + WARN0("Expecting arguments after #undef"); + return (T_ERR); @@ -293,34 +319,79 @@ + "but got \"%s\"", walk); + return (T_ERR); + } - -- if (definitions != NULL && sl_find(definitions, walk) != NULL) -- *skip = true; -- ++ + walk = sl_find(definitions, walk); + if (walk != NULL) + walk[0] = '\0'; -+ } - return (T_OK); + } ++ return (T_OK); ++ } + +- if (definitions != NULL && sl_find(definitions, walk) != NULL) +- *skip = true; ++ walk = cmptoken(line, "warning"); ++ if (walk != NULL) { ++ (void)trimlr(&walk); ++ WARN1("Warning: %s", walk); ++ } + +- return (T_OK); ++ walk = cmptoken(line, "error"); ++ if (walk != NULL) { ++ (void)trimlr(&walk); ++ WARN1("Error: %s", walk); ++ return (T_ERR); } -@@ -248,11 +366,14 @@ cal_parse(FILE *in, FILE *out) +- return (T_PROCESS); ++ WARN1("Undefined pre-processor command \"#%s\"", line); ++ return (T_ERR); ++} + ++static void ++setup_locale(const char *locale) ++{ ++ (void)setlocale(LC_ALL, locale); ++#ifdef WITH_ICONV ++ if (!doall) ++ set_new_encoding(); ++#endif ++ setnnames(); + } + + #define REPLACE(string, slen, struct_) \ +@@ -237,35 +391,82 @@ token(char *line, FILE *out, bool *skip) + static int + cal_parse(FILE *in, FILE *out) + { ++ char *mylocale = NULL; + char *line = NULL; + char *buf; + size_t linecap = 0; + ssize_t linelen; + ssize_t l; +- static int d_first = -1; + static int count = 0; + int i; int month[MAXCOUNT]; int day[MAXCOUNT]; int year[MAXCOUNT]; - bool skip = false; +- char dbuf[80]; + int skip = 0; + int unskip = 0; - char dbuf[80]; char *pp, p; - struct tm tm; +- struct tm tm; int flags; + char *c, *cc; + bool incomment = false; - /* Unused */ - tm.tm_sec = 0; -@@ -263,9 +384,61 @@ cal_parse(FILE *in, FILE *out) +- /* Unused */ +- tm.tm_sec = 0; +- tm.tm_min = 0; +- tm.tm_hour = 0; +- tm.tm_wday = 0; +- if (in == NULL) return (1); @@ -384,7 +455,7 @@ case T_ERR: free(line); return (1); -@@ -278,18 +451,9 @@ cal_parse(FILE *in, FILE *out) +@@ -278,18 +479,9 @@ cal_parse(FILE *in, FILE *out) } } @@ -404,17 +475,24 @@ /* * Setting LANG in user's calendar was an old workaround * for 'calendar -a' being run with C locale to properly -@@ -298,8 +462,7 @@ cal_parse(FILE *in, FILE *out) +@@ -298,13 +490,9 @@ 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) +-#ifdef WITH_ICONV +- if (!doall) +- set_new_encoding(); +-#endif +- setnnames(); ++ if (mylocale == NULL) ++ mylocale = strdup(setlocale(LC_ALL, NULL)); ++ setup_locale(buf + 5); + continue; + } + /* Parse special definitions: Easter, Paskha etc */ +@@ -353,7 +541,7 @@ cal_parse(FILE *in, FILE *out) if (count < 0) { /* Show error status based on return value */ if (debug) @@ -423,20 +501,47 @@ if (count == -1) continue; count = -count + 1; -@@ -373,11 +536,15 @@ cal_parse(FILE *in, FILE *out) - (void)strftime(dbuf, sizeof(dbuf), - d_first ? "%e %b" : "%b %e", &tm); +@@ -363,25 +551,25 @@ cal_parse(FILE *in, FILE *out) + while (pp[1] == '\t') + pp++; + +- if (d_first < 0) +- d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); +- + for (i = 0; i < count; i++) { +- tm.tm_mon = month[i] - 1; +- tm.tm_mday = day[i]; +- tm.tm_year = year[i] - 1900; +- (void)strftime(dbuf, sizeof(dbuf), +- d_first ? "%e %b" : "%b %e", &tm); if (debug) - fprintf(stderr, "got %s\n", pp); +- events[i] = event_add(year[i], month[i], day[i], dbuf, + WARN1("got \"%s\"", pp); - events[i] = event_add(year[i], month[i], day[i], dbuf, ++ events[i] = event_add(year[i], month[i], day[i], ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp, extradata[i]); } -+ } + } + while (skip-- > 0 || unskip-- > 0) { + cal_line++; + WARN0("Missing #endif assumed"); - } ++ } free(line); + fclose(in); ++ if (mylocale != NULL) { ++ setup_locale(mylocale); ++ free(mylocale); ++ } + + return (0); + } +@@ -419,6 +607,7 @@ opencalin(void) + FILE *fpin; + + /* open up calendar file */ ++ cal_file = calendarFile; + if ((fpin = fopen(calendarFile, "r")) == NULL) { + if (doall) { + if (chdir(calendarHomes[0]) != 0) Added: head/deskutils/calendar/files/patch-parsedata.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/deskutils/calendar/files/patch-parsedata.c Fri Nov 6 22:04:12 2020 (r554325) @@ -0,0 +1,23 @@ +--- parsedata.c.orig 2020-10-18 03:01:26 UTC ++++ parsedata.c +@@ -28,7 +28,7 @@ + */ + + #include +-__FBSDID("$FreeBSD$"); ++__FBSDID("$FreeBSD: head/usr.bin/calendar/parsedata.c 367203 2020-10-31 13:32:08Z se $"); + + #include + #include +@@ -312,10 +312,7 @@ allfine: + + } + +-void +-remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm, +- int dd, char *extra); +-void ++static void + remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm, + int dd, char *extra) + { Added: head/deskutils/calendar/files/patch-tests_Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/deskutils/calendar/files/patch-tests_Makefile Fri Nov 6 22:04:12 2020 (r554325) @@ -0,0 +1,21 @@ +--- tests/Makefile.orig 2020-10-18 03:01:26 UTC ++++ tests/Makefile +@@ -2,9 +2,17 @@ + + PACKAGE= tests + +-TAP_TESTS_SH= legacy_test ++TAP_TESTS_SH= comment_test cond_test legacy_test + ++TEST_METADATA.comment_test+= timeout="600" ++TEST_METADATA.cond_test+= timeout="600" + TEST_METADATA.legacy_test+= timeout="600" ++ ++${PACKAGE}FILES+= calendar.comment ++${PACKAGE}FILES+= regress.comment.out ++ ++${PACKAGE}FILES+= calendar.cond ++${PACKAGE}FILES+= regress.cond.out + + ${PACKAGE}FILES+= calendar.calibrate + ${PACKAGE}FILES+= regress.a1.out