home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume29 / remind / patch05 < prev    next >
Encoding:
Text File  |  1992-04-15  |  13.0 KB  |  414 lines

  1. Newsgroups: comp.sources.misc
  2. From: dfs@doe.carleton.ca (David F. Skoll)
  3. Subject:  v29i073:  remind - A replacement for calendar, Patch05
  4. Message-ID: <1992Apr11.195315.7446@sparky.imd.sterling.com>
  5. X-Md4-Signature: c6731dece7d20ecec0a4012da90f9694
  6. Date: Sat, 11 Apr 1992 19:53:15 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: dfs@doe.carleton.ca (David F. Skoll)
  10. Posting-number: Volume 29, Issue 73
  11. Archive-name: remind/patch05
  12. Environment: UNIX, MS-DOS
  13. Patch-To: remind: Volume 17, Issue 3-6
  14.  
  15. This is Patch 5 for Remind version 2.3, a replacement for calendar(1).
  16.  
  17. This is not the major update to Remind I've been promising :-), it's just
  18. a useful little feature added to the calendar printing routine.
  19.  
  20. Before applying this patch, make sure you have Remind 2.3.4 source code.
  21. Check the file patchlevel.h to ensure this.
  22.  
  23. Change to the Remind source directory, unshar the patch file, and type:
  24.  
  25.     patch < patch.05
  26.  
  27. Re-make and re-install Remind.  To make sure that everything worked, type:
  28.  
  29.     make test
  30.  
  31. This patch adds a feature to Remind which allows you to create a calendar
  32. for a given number of weeks as well as a given number of months.  This
  33. is useful for popping up a calendar in a window.  In addition, the current
  34. date is highlighted when the "calendar by weeks" option is used.
  35.  
  36. The modifications to Remind were done by Dennis Cottel
  37. <dennis@peanuts.nosc.mil>.  Thanks, Dennis!
  38.  
  39. You can FTP a copy of Remind 2.3.5 from data.doe.carleton.ca
  40. (134.117.9.15) in the directory /pub.  The patch is there also, if
  41. you already have Remind 2.3.4.
  42.  
  43. --
  44. David F. Skoll
  45.  
  46. -------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
  47. #!/bin/sh
  48. # This is Remind 2.3 Official Patch #5, a shell archive (shar 3.32)
  49. # made 03/31/1992 16:46 UTC by dfs@pulaski
  50. # Source directory /enterprise/turbolift/dfs/work/.rem/patch5-work
  51. #
  52. # existing files will NOT be overwritten
  53. #
  54. # This shar contains:
  55. # length  mode       name
  56. # ------ ---------- ------------------------------------------
  57. #  10390 -rw------- patch.05
  58. #
  59. if touch 2>&1 | fgrep 'amc' > /dev/null
  60.  then TOUCH=touch
  61.  else TOUCH=true
  62. fi
  63. # ============= patch.05 ==============
  64. if test X"$1" != X"-c" -a -f 'patch.05'; then
  65.     echo "File already exists: skipping 'patch.05'"
  66. else
  67. echo "x - extracting patch.05 (Text)"
  68. sed 's/^X//' << 'SHAR_EOF' > patch.05 &&
  69. XThis set of patches adds support for the "calendar by weeks" option,
  70. Xprovided by Dennis Cottel.
  71. X*** ../patch4-work/COPYRIGHT    Wed Jul 17 13:18:07 1991
  72. X--- ./COPYRIGHT    Tue Mar 31 11:43:14 1992
  73. X***************
  74. X*** 42,47 ****
  75. X--- 42,50 ----
  76. X  <rhys@batserver.cs.uq.OZ.AU> and Anthony Cheng for providing the Turbo
  77. X  C compiler support
  78. X  
  79. X+ Dennis Cottel <dennis@peanuts.nosc.mil> for providing the patch to produce
  80. X+ calendars by weeks as well as by months.
  81. X+ 
  82. X  Bill Silvert <bill%biomel@cs.dal.ca> and Dennis Cottel
  83. X  <dennis@peanuts.nosc.mil> for suggesting many of the new features in
  84. X  REMIND.
  85. X*** ../patch4-work/WHATSNEW.23    Thu Oct  3 12:16:38 1991
  86. X--- ./WHATSNEW.23    Tue Mar 31 11:43:39 1992
  87. X***************
  88. X*** 71,73 ****
  89. X--- 71,76 ----
  90. X  
  91. X  * Version 2.3 Patch 4 - Made the init.c file nicer.  Made the Makefile
  92. X  prettier.  Added "make test", "make tar" and "make shar" Makefile targets.
  93. X+ 
  94. X+ * Version 2.4 Patch 5 - Added the "c+n" option for printing a calendar by
  95. X+ weeks instead of months, courtesy Dennis Cottel (dennis@peanuts.nosc.mil).
  96. X*** ../patch4-work/calendar.c    Mon Feb 18 13:05:17 1991
  97. X--- ./calendar.c    Tue Mar 31 11:40:42 1992
  98. X***************
  99. X*** 42,47 ****
  100. X--- 42,48 ----
  101. X  CalEntry entry[7];
  102. X  int used[7];  /* These hold the day of the month for corresponding
  103. X                   entry - 0 if not used */
  104. X+ int todayflag[7]; /* set to 1 for today when doing CalendarByWeeks */
  105. X  
  106. X  /* Static integers for various stuff */
  107. X  static int TotalWidth;
  108. X***************
  109. X*** 78,101 ****
  110. X  
  111. X     TotalWidth = 7*CalWidth + 8;
  112. X  
  113. X!    /* Move back until beginning of month */
  114. X!    FromJulian(JulianToday, &d, &m, &y);
  115. X!    JulianToday -= (d-1);
  116. X  
  117. X     init = 0;
  118. X     InitCache();
  119. X     while (Calendar) {
  120. X        FromJulian(JulianToday, &d, &m, &y);
  121. X        CurDay = d;
  122. X        CurMon = m;
  123. X        CurYear = y;
  124. X!       if (init == 0 || CurDay == 1) { InitCalendar(m, y); init = 1; }
  125. X        DoEntries();
  126. X!       if (d == DaysInMonth(m, y)) Calendar--;
  127. X        JulianToday++;
  128. X        if (Calendar) ResetCache();
  129. X     }
  130. X!    if (CurDay != DaysInMonth(CurMon, CurYear)) FinishCalendar();
  131. X     DestroyCache();
  132. X     FreeStackedOmits();
  133. X  }
  134. X--- 79,114 ----
  135. X  
  136. X     TotalWidth = 7*CalWidth + 8;
  137. X  
  138. X!    if (!CalendarByWeeks) {
  139. X!       /* Move back until beginning of month */
  140. X!       FromJulian(JulianToday, &d, &m, &y);
  141. X!       JulianToday -= (d-1);
  142. X!    } else {
  143. X!       /* Move back to the beginning of the week */
  144. X!       while (DayOfWeek(JulianToday) != 0) JulianToday--;
  145. X!    }
  146. X  
  147. X     init = 0;
  148. X     InitCache();
  149. X+    if (CalendarByWeeks) Calendar = CalendarByWeeks;
  150. X     while (Calendar) {
  151. X        FromJulian(JulianToday, &d, &m, &y);
  152. X        CurDay = d;
  153. X        CurMon = m;
  154. X        CurYear = y;
  155. X!       if (init == 0 || (!CalendarByWeeks && (CurDay == 1)))
  156. X!          { InitCalendar(m, y); init = 1; }
  157. X        DoEntries();
  158. X!       if (CalendarByWeeks) {
  159. X!          if (DayOfWeek(JulianToday) == 6) Calendar--;
  160. X!       } else {
  161. X!          if (d == DaysInMonth(m, y)) Calendar--;
  162. X!       }
  163. X        JulianToday++;
  164. X        if (Calendar) ResetCache();
  165. X     }
  166. X!    if (CurDay != DaysInMonth(CurMon, CurYear) || CalendarByWeeks)
  167. X!       FinishCalendar();
  168. X     DestroyCache();
  169. X     FreeStackedOmits();
  170. X  }
  171. X***************
  172. X*** 206,211 ****
  173. X--- 219,225 ----
  174. X  #endif
  175. X  {
  176. X     if (SimpleCalendar) return;
  177. X+    if (CalendarByWeeks) return;
  178. X     putchar('\f');
  179. X  }
  180. X  
  181. X***************
  182. X*** 221,231 ****
  183. X  void DoEntries()
  184. X  #endif
  185. X  {
  186. X!    int i;
  187. X     CalEntry *e;
  188. X  
  189. X     while (1) {
  190. X!       used[DayOfWeek(JulianToday)] = CurDay;
  191. X        if (GetLine()) break;
  192. X        i = ProcessLine();
  193. X        if (i>0) if (e = CreateCalEntry(i)) AddCalEntry(e);
  194. X--- 235,247 ----
  195. X  void DoEntries()
  196. X  #endif
  197. X  {
  198. X!    int i, whichday;
  199. X     CalEntry *e;
  200. X  
  201. X+    whichday = DayOfWeek(JulianToday);
  202. X     while (1) {
  203. X!       used[whichday] = CurDay;
  204. X!       todayflag[whichday] = (JulianToday == RealToday) ? 1 : 0;
  205. X        if (GetLine()) break;
  206. X        i = ProcessLine();
  207. X        if (i>0) if (e = CreateCalEntry(i)) AddCalEntry(e);
  208. X***************
  209. X*** 232,240 ****
  210. X     }
  211. X  
  212. X     /* Now figure out if we should print the calendar */
  213. X!    if ((DayOfWeek(JulianToday) == 6 ) || CurDay == DaysInMonth(CurMon, CurYear))
  214. X!       EmitOneCalendarLine();
  215. X!    if (CurDay == DaysInMonth(CurMon, CurYear)) FinishCalendar();
  216. X  }
  217. X  
  218. X  /***************************************************************/
  219. X--- 248,260 ----
  220. X     }
  221. X  
  222. X     /* Now figure out if we should print the calendar */
  223. X!    if (CalendarByWeeks) {
  224. X!       if (whichday == 6) EmitOneCalendarLine();
  225. X!    } else {
  226. X!       if ((whichday == 6) || (CurDay == DaysInMonth(CurMon, CurYear)))
  227. X!          EmitOneCalendarLine();
  228. X!       if (CurDay == DaysInMonth(CurMon, CurYear)) FinishCalendar();
  229. X!    }
  230. X  }
  231. X  
  232. X  /***************************************************************/
  233. X***************
  234. X*** 412,417 ****
  235. X--- 432,438 ----
  236. X  #endif
  237. X  {
  238. X     int i, nlines, emit, j;
  239. X+    char c;
  240. X     char *s, *dst;
  241. X     CalEntry *e;
  242. X     char pend[7];  /* Reminders with following blanks pending */
  243. X***************
  244. X*** 427,433 ****
  245. X        else {
  246. X           sprintf(TmpBuf, "%d", used[i]);
  247. X           printf(TmpBuf);
  248. X!          PrintChars(CalWidth-strlen(TmpBuf), ' ');
  249. X        }
  250. X        putchar('|');
  251. X     }
  252. X--- 448,455 ----
  253. X        else {
  254. X           sprintf(TmpBuf, "%d", used[i]);
  255. X           printf(TmpBuf);
  256. X!          c = (CalendarByWeeks && todayflag[i]) ? '*' : ' ';
  257. X!          PrintChars(CalWidth-strlen(TmpBuf), c);
  258. X        }
  259. X        putchar('|');
  260. X     }
  261. X*** ../patch4-work/globals.h    Tue Sep 10 10:14:41 1991
  262. X--- ./globals.h    Tue Mar 31 11:40:43 1992
  263. X***************
  264. X*** 43,48 ****
  265. X--- 43,49 ----
  266. X  extern char  QueueAts;
  267. X  extern char  PrintAts;
  268. X  extern int   Calendar;
  269. X+ extern int   CalendarByWeeks;
  270. X  extern int   CalTime;
  271. X  extern int   CalWidth;
  272. X  extern int   SimpleCalendar;
  273. X*** ../patch4-work/init.c    Mon Sep 30 16:40:04 1991
  274. X--- ./init.c    Tue Mar 31 11:40:45 1992
  275. X***************
  276. X*** 46,51 ****
  277. X--- 46,52 ----
  278. X     IgOnce   = 0;
  279. X     IgRun    = 0;
  280. X     Calendar = 0;
  281. X+    CalendarByWeeks = 0;
  282. X     Next     = 0;
  283. X     PrintAts = 1;
  284. X     QueueAts = 1;
  285. X***************
  286. X*** 114,121 ****
  287. X                  Debug = Purge = 0;
  288. X              fprintf(stderr, DPCMsg);
  289. X                   }
  290. X!                      t = atoi(s + 1);
  291. X!              if (t > 0 && t <= 12) Calendar = t;
  292. X                       /* Skip remaining chars on this option */
  293. X                   while (*++s) ;
  294. X                   s--;
  295. X--- 115,127 ----
  296. X                  Debug = Purge = 0;
  297. X              fprintf(stderr, DPCMsg);
  298. X                   }
  299. X!                      if (*(s+1) == '+') {
  300. X!                         s++;
  301. X!                         CalendarByWeeks = atoi(s + 1);
  302. X!                      } else {
  303. X!                         t = atoi(s + 1);
  304. X!                         if (t > 0 && t <= 12) Calendar = t;
  305. X!                      }
  306. X                       /* Skip remaining chars on this option */
  307. X                   while (*++s) ;
  308. X                   s--;
  309. X***************
  310. X*** 251,263 ****
  311. X       "\nREMIND %d.%d Patch Level %d Copyright 1990, 1991 by David Skoll.\n\n", 
  312. X          VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL);
  313. X  #ifdef UNIX
  314. X!   fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-voraqthf] filename [date]\n\n");
  315. X  #else
  316. X!   fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-vorth] filename [date]\n\n");
  317. X  #endif
  318. X    fprintf(stderr, "-n   Output next occurrence of reminders in simple format\n");
  319. X    fprintf(stderr, "-d   Debug reminder file\n-p   Purge reminder file\n");
  320. X    fprintf(stderr, "-c#  Produce calendar for # months\n");
  321. X    fprintf(stderr, "-w#  Make calendar # columns wide\n");
  322. X    fprintf(stderr, "-s   Produce simple calendar listing (used with -c)\n");
  323. X    fprintf(stderr, "-v   Verbose messages\n-o   Ignore ONCE directives\n");
  324. X--- 257,270 ----
  325. X       "\nREMIND %d.%d Patch Level %d Copyright 1990, 1991 by David Skoll.\n\n", 
  326. X          VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL);
  327. X  #ifdef UNIX
  328. X!   fprintf(stderr, "Usage: remind [-n | -d | -p | -c[+]# [-w# | -s]] [-voraqthf] filename [date]\n\n");
  329. X  #else
  330. X!   fprintf(stderr, "Usage: remind [-n | -d | -p | -c[+]# [-w# | -s]] [-vorth] filename [date]\n\n");
  331. X  #endif
  332. X    fprintf(stderr, "-n   Output next occurrence of reminders in simple format\n");
  333. X    fprintf(stderr, "-d   Debug reminder file\n-p   Purge reminder file\n");
  334. X    fprintf(stderr, "-c#  Produce calendar for # months\n");
  335. X+   fprintf(stderr, "-c+# Produce calendar for # contiguous weeks\n");
  336. X    fprintf(stderr, "-w#  Make calendar # columns wide\n");
  337. X    fprintf(stderr, "-s   Produce simple calendar listing (used with -c)\n");
  338. X    fprintf(stderr, "-v   Verbose messages\n-o   Ignore ONCE directives\n");
  339. X*** ../patch4-work/main.c    Tue Sep 10 10:11:40 1991
  340. X--- ./main.c    Tue Mar 31 11:40:45 1992
  341. X***************
  342. X*** 119,124 ****
  343. X--- 119,125 ----
  344. X  char QueueAts, PrintAts;
  345. X  int  NumAtsQueued;
  346. X  int Calendar, CalTime, CalWidth, SimpleCalendar;
  347. X+ int CalendarByWeeks;
  348. X  int Foreground;
  349. X  
  350. X  static int JulFirst; /* Julian date of 1 Jan Current_year */
  351. X*** ../patch4-work/patchlevel.h    Fri Sep 13 15:25:40 1991
  352. X--- ./patchlevel.h    Tue Mar 31 11:41:01 1992
  353. X***************
  354. X*** 3,6 ****
  355. X  #define VERSION_MAJOR 2
  356. X  #define VERSION_MINOR 3
  357. X  
  358. X! #define PATCHLEVEL 4
  359. X--- 3,6 ----
  360. X  #define VERSION_MAJOR 2
  361. X  #define VERSION_MINOR 3
  362. X  
  363. X! #define PATCHLEVEL 5
  364. X*** ../patch4-work/remind.1    Fri Sep 13 15:25:35 1991
  365. X--- ./remind.1    Tue Mar 31 11:40:48 1992
  366. X***************
  367. X*** 4,10 ****
  368. X  remind \- a sophisticated reminder service
  369. X  .SH SYNOPSIS
  370. X  .B remind
  371. X! [\fB\-n | \fB\-d\fR | \fB\-p\fR | \fB\-c\fR\fIn\fR [\fB\-w\fR\fIn\fR | \fB\-s\fR]]
  372. X  [\fB\-voraqthf\fR]
  373. X  .I filename
  374. X  [\fIdate\fR]
  375. X--- 4,11 ----
  376. X  remind \- a sophisticated reminder service
  377. X  .SH SYNOPSIS
  378. X  .B remind
  379. X! [\fB\-n | \fB\-d\fR | \fB\-p\fR |
  380. X! \fB\-c\fR[\fB+\fR]\fIn\fR [\fB\-w\fR\fIn\fR | \fB\-s\fR]]
  381. X  [\fB\-voraqthf\fR]
  382. X  .I filename
  383. X  [\fIdate\fR]
  384. X***************
  385. X*** 60,65 ****
  386. X--- 61,74 ----
  387. X  produce a calendar for one month only.  The
  388. X  .B \-c
  389. X  option is not compatible with the \fB\-p\fR or \fB\-d\fR options.
  390. X+ .PP
  391. X+ .RS
  392. X+ If the number starts with a ``+'' (e.g., ``\-c+4''), then the value given is
  393. X+ interpreted as the number of contiguous weeks to print starting with the
  394. X+ current week.
  395. X+ In this mode, there are no line or page breaks between months
  396. X+ and the current date is highlighted.
  397. X+ .RE
  398. X  .TP
  399. X  .B \-w\fR\fIn\fR
  400. X  The \fB\-w\fR flag, when used in conjunction with \fB\-c\fR,
  401. SHAR_EOF
  402. $TOUCH -am 0331114692 patch.05 &&
  403. chmod 0600 patch.05 ||
  404. echo "restore of patch.05 failed"
  405. set `wc -c patch.05`;Wc_c=$1
  406. if test "$Wc_c" != "10390"; then
  407.     echo original size 10390, current size $Wc_c
  408. fi
  409. fi
  410. exit 0
  411.  
  412.  
  413. exit 0 # Just in case...
  414.