Path: utzoo!attcan!uunet!peregrine!ccicpg!felix!zemon From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.unix.ultrix Subject: Re: /etc/init -> /bin/init Message-ID: <35756@felix.UUCP> Date: 16 May 88 19:11:42 GMT References: <33321@felix.UUCP> Sender: zemon@felix.UUCP Reply-To: ado@elsie.UUCP (Arthur David Olson) Organization: NIH-LEC, Bethesda, MD Lines: 78 Approved: zemon@felix.UUCP Reply-Path: In article <33321@felix.UUCP>, nes@prcrs.UUCP (Nancy Shoemaker) writes: > . . . > Section 2.5.18 reports that there are limits to the length of the > regular expression that can be handled by ed, ex and the grep type > commands. [Surprise?] The SPR reported that the limit will sometimes > be exceeded by the command /usr/bin/calendar. When the month ends on > a Saturday or Sunday, the regular expression generated on the last > Friday will be longer than egrep can handle and calendar will abort. > Don't expect Ultrix v{1.1,1.2,2.0,2.2} "calendar" to remind you of > anything important on Friday, April 29, 1988! Don't know if this will work around your April bug; in any event. . . !From ado Sun Nov 30 19:16:40 1986 !... !Subject: MORE/bsd 4.3 /usr/lib/calendar foils egrep on Fridays late in the year !... ! !Index: usr.bin/calendar/calendar.c MORE/bsd 4.3 Fix ! !Description: ! The "egrep" scripts generated by "/usr/lib/calendar" are rejected ! by "egrep" on Fridays late in the year. ! !Repeat-By: ! Run the commands ! date 8611281200 ! /usr/lib/calendar > /tmp/try ! egrep -f /tmp/try < /dev/null ! and note the result: ! egrep: regular expression too long ! !Fix: ! Here are context differences between the version of "calendar.c" ! distributed with MORE/bsd 4.3 and a version that produces a ! different regular expression that egrep can handle. The different ! regular expression does not accept "011" as a synonym for "November" ! but does still accept "01" (. . ."09") as a synonym for "January" ! (. . ."September"). ! !*** old/calendar.c Sun Nov 30 19:08:44 1986 !--- new/calendar.c Sat Nov 29 10:42:20 1986 !*************** !*** 1,3 **** !--- 1,8 ---- !+ #ifndef ASWAS !+ #ifdef OBJECTID !+ static char elsieid[] = "@(#)calendar.c 3.2"; !+ #endif /* OBJECTID */ !+ #endif /* !ASWAS */ ! static char *sccsid = "@(#)calendar.c 4.5 (Berkeley) 84/05/07"; ! /* /usr/lib/calendar produces an egrep -f file ! that will select today's and tomorrow's !*************** !*** 30,35 **** !--- 35,51 ---- ! { ! struct tm *tm; ! tm = localtime(&t); !+ #ifndef ASWAS !+ /* !+ ** Prevent "egrep: regular expression too long" error. !+ */ !+ if ((tm->tm_mon + 1) >= 10) !+ (void) printf( !+ "(^|[ (,;])((%s[^ \t]*[ \t]*|%d/)0*%d)([^0123456789]|$)\n", !+ month[tm->tm_mon], !+ tm->tm_mon + 1, tm->tm_mday); !+ else !+ #endif /* !ASWAS */ ! printf("(^|[ (,;])((%s[^ \t]*[ \t]*|(0%d|%d)/)0*%d)([^0123456789]|$)\n", ! month[tm->tm_mon], ! tm->tm_mon + 1, tm->tm_mon + 1, tm->tm_mday); -- ado@ncifcrf.gov ADO is a trademark of Ampex.