home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume34 / remind / patch01a < prev    next >
Encoding:
Text File  |  1992-12-17  |  56.7 KB  |  1,848 lines

  1. Newsgroups: comp.sources.misc
  2. From: <dfs@doe.carleton.ca> (David F. Skoll)
  3. Subject: v34i079:  remind - A replacement for calendar, Patch01a/2
  4. Message-ID: <csm-v34i079=remind.152006@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: cd52f49172f2b2a8d6e9f66ba5b497e6
  6. Date: Fri, 18 Dec 1992 21:20:58 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: <dfs@doe.carleton.ca> (David F. Skoll)
  10. Posting-number: Volume 34, Issue 79
  11. Archive-name: remind/patch01a
  12. Environment: UNIX, MS-DOS
  13. Patch-To: remind: Volume 33, Issue 58-69
  14.  
  15. This official patch will upgrade Remind 03.00.00 to Remind 03.00.01.  Most
  16. changes are fixes to the code to improve portability.  The major change
  17. is a new program to produce a calendar in PostScript format, which
  18. looks a lot better than the old ASCII calendar.  Read the WHATSNEW.30
  19. file for details of all of the changes.
  20.  
  21. To apply the patch:  Unshar both parts into the Remind source directory,
  22. type "patch < patch.01", read the README file, and type "make."
  23.  
  24. These files are available via anonymous ftp to ftp.doe.carleton.ca
  25. (134.117.9.33) in the directory /pub/remind-3.0.  The files are:
  26.  
  27. man-ps.tar.Z        All the man pages in PostScript
  28. man-txt.tar.Z        All the man pages in formatted ASCII text
  29. msdos-exe.tar.Z        The MS-DOS executables
  30. patch01.tar.Z        This patch
  31. remind-3.0.1.tar.Z    The whole Remind 03.00.01 distribution.
  32.  
  33. -------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before this line, then feed it
  36. # into a shell via "sh file" or similar.  To overwrite existing files,
  37. # type "sh file -c".
  38. # Contents:  README.OS2 patch.01.B rem2ps.c remind.def
  39. # Wrapped by kent@sparky on Fri Dec 18 15:00:43 1992
  40. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  41. echo If this archive is complete, you will see the following message:
  42. echo '          "shar: End of archive 1 (of 2)."'
  43. if test -f 'README.OS2' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'README.OS2'\"
  45. else
  46.   echo shar: Extracting \"'README.OS2'\" \(988 characters\)
  47.   sed "s/^X//" >'README.OS2' <<'END_OF_FILE'
  48. XREMIND version 3.0 for OS/2
  49. X
  50. X1 - Read the file COPYRIGHT.  (This may be called COPYRIGH on your
  51. X    MS-DOS system.)
  52. X
  53. X2 - To compile Remind for OS/2, you must use the Microsoft C compiler.
  54. X    You must also have a decent version of 'make', such as dmake.
  55. X
  56. X3 - Examine the file config.h and adjust parameters as needed
  57. X
  58. X4 - Examine the file makefile.os2 and adjust parameters as needed.
  59. X
  60. X5 - Type:
  61. X
  62. X    make -f makefile.os2
  63. X
  64. XThis will make 'remind.exe' which is an OS/2 1.x--2.0 executable, and
  65. X'remindb.exe' which is an OS/2 and MSDOS bound executable.
  66. X
  67. XThe file "defs.rem" has some sample Remind definitions and commands.
  68. X
  69. XNOTE that I do not have access to an OS/2 system, so support for this
  70. Xsystem may not be as good as I'd like.
  71. X
  72. XOS/2 support is courtesy of DARREL HANKERSON <HANK@DUCVAX.AUBURN.EDU>.
  73. XHowever, if you have problems, please contact me and not Darrel.
  74. X
  75. X--
  76. XDavid F. Skoll <dfs@doe.carleton.ca>
  77. X4-317 LeBreton Street South
  78. XOttawa, Ontario K1S 4L4
  79. XCANADA
  80. X
  81. XTel. (613) 567-3662
  82. X
  83. END_OF_FILE
  84.   if test 988 -ne `wc -c <'README.OS2'`; then
  85.     echo shar: \"'README.OS2'\" unpacked with wrong size!
  86.   fi
  87.   # end of 'README.OS2'
  88. fi
  89. if test -f 'patch.01.B' -a "${1}" != "-c" ; then 
  90.   echo shar: Will not clobber existing file \"'patch.01.B'\"
  91. else
  92.   echo shar: Extracting \"'patch.01.B'\" \(34792 characters\)
  93.   sed "s/^X//" >'patch.01.B' <<'END_OF_FILE'
  94. X*** ../p0/expr.h    Mon Nov  9 14:12:08 1992
  95. X--- ./expr.h    Wed Dec 16 10:51:24 1992
  96. X***************
  97. X*** 5,11 ****
  98. X  /*  Contains a few definitions used by expression evaluator.   */
  99. X  /*                                                             */
  100. X  /*  This file is part of REMIND.                               */
  101. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  102. X  /*                                                             */
  103. X  /***************************************************************/
  104. X  
  105. X--- 5,11 ----
  106. X  /*  Contains a few definitions used by expression evaluator.   */
  107. X  /*                                                             */
  108. X  /*  This file is part of REMIND.                               */
  109. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  110. X  /*                                                             */
  111. X  /***************************************************************/
  112. X  
  113. X*** ../p0/files.c    Mon Nov  9 14:12:17 1992
  114. X--- ./files.c    Wed Dec 16 10:51:33 1992
  115. X***************
  116. X*** 33,39 ****
  117. X  #include <dos.h>
  118. X  #endif
  119. X  
  120. X- #include "config.h"
  121. X  #include "types.h"
  122. X  #include "protos.h"
  123. X  #include "globals.h"
  124. X--- 33,38 ----
  125. X***************
  126. X*** 428,434 ****
  127. X  /*  file.  Not needed for UNIX.                                */
  128. X  /*                                                             */
  129. X  /***************************************************************/
  130. X! #ifdef __MSDOS__
  131. X  /*
  132. X   * WARNING WARNING WARNING WARNING
  133. X   * In the version of Turbo C which I have, there is a bug in the
  134. X--- 427,433 ----
  135. X  /*  file.  Not needed for UNIX.                                */
  136. X  /*                                                             */
  137. X  /***************************************************************/
  138. X! #if defined(__MSDOS__) || defined(OS2)
  139. X  /*
  140. X   * WARNING WARNING WARNING WARNING
  141. X   * In the version of Turbo C which I have, there is a bug in the
  142. X***************
  143. X*** 449,463 ****
  144. X  int jul;
  145. X  #endif
  146. X  {
  147. X!    int y, m, d;
  148. X  #ifdef __TURBOC__   
  149. X     struct ftime ft;
  150. X- #endif   
  151. X     FILE *f;
  152. X  
  153. X     FromJulian(jul, &y, &m, &d);
  154. X-    
  155. X- #ifdef __TURBOC__   
  156. X     ft.ft_tsec = 0;
  157. X     ft.ft_min = 0;
  158. X     ft.ft_hour = 12;  /* Arbitrarily set time to noon. */
  159. X--- 448,460 ----
  160. X  int jul;
  161. X  #endif
  162. X  {
  163. X! 
  164. X  #ifdef __TURBOC__   
  165. X+    int y, m, d;
  166. X     struct ftime ft;
  167. X     FILE *f;
  168. X  
  169. X     FromJulian(jul, &y, &m, &d);
  170. X     ft.ft_tsec = 0;
  171. X     ft.ft_min = 0;
  172. X     ft.ft_hour = 12;  /* Arbitrarily set time to noon. */
  173. X***************
  174. X*** 464,488 ****
  175. X     ft.ft_day = (unsigned int) d;
  176. X     ft.ft_month = (unsigned int) m+1;
  177. X     ft.ft_year = (unsigned int) (y - 1980);
  178. X- #endif
  179. X  
  180. X!    f = fopen(fname, "r");
  181. X! 
  182. X! #ifdef __TURBOC__   
  183. X     if (!f || setftime(fileno(f) , &ft)) {
  184. X- #endif
  185. X  
  186. X! #ifdef __MSC__
  187. X!    if (!f || _dos_setftime(fileno(f),
  188. X!     ((y-1980)<<9) + (m+1)<<5 + d,
  189. X!     (12<<11))) {
  190. X  #endif       
  191. X        fprintf(ErrFp, "Can't reset access date of %s\n", fname);
  192. X        if (f) fclose(f);
  193. X        return -1;
  194. X     }
  195. X  
  196. X     fclose(f);
  197. X     return 0;
  198. X  }
  199. X  #endif /* __MSDOS__ */
  200. X--- 461,485 ----
  201. X     ft.ft_day = (unsigned int) d;
  202. X     ft.ft_month = (unsigned int) m+1;
  203. X     ft.ft_year = (unsigned int) (y - 1980);
  204. X  
  205. X!    f = fopen(fname, "r"); 
  206. X     if (!f || setftime(fileno(f) , &ft)) {
  207. X  
  208. X! #else /* Must be MSC */
  209. X!    if (utime(fname, (struct utimbuf *) NULL)) {
  210. X  #endif       
  211. X        fprintf(ErrFp, "Can't reset access date of %s\n", fname);
  212. X+ 
  213. X+ #ifdef __TURBOC__
  214. X        if (f) fclose(f);
  215. X+ #endif
  216. X        return -1;
  217. X     }
  218. X  
  219. X+ #ifdef __TURBOC__
  220. X     fclose(f);
  221. X+ #endif
  222. X+ 
  223. X     return 0;
  224. X  }
  225. X  #endif /* __MSDOS__ */
  226. X*** ../p0/funcs.c    Mon Nov  9 14:23:22 1992
  227. X--- ./funcs.c    Wed Dec 16 10:51:34 1992
  228. X***************
  229. X*** 6,16 ****
  230. X  /*  expressions.                                               */
  231. X  /*                                                             */
  232. X  /*  This file is part of REMIND.                               */
  233. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  234. X  /*                                                             */
  235. X  /***************************************************************/
  236. X- #include <stdio.h>
  237. X  #include "config.h"
  238. X  #ifdef HAVE_STDLIB_H
  239. X  #include <stdlib.h>
  240. X  #endif
  241. X--- 6,16 ----
  242. X  /*  expressions.                                               */
  243. X  /*                                                             */
  244. X  /*  This file is part of REMIND.                               */
  245. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  246. X  /*                                                             */
  247. X  /***************************************************************/
  248. X  #include "config.h"
  249. X+ #include <stdio.h>
  250. X  #ifdef HAVE_STDLIB_H
  251. X  #include <stdlib.h>
  252. X  #endif
  253. X***************
  254. X*** 26,32 ****
  255. X  #include <sys/file.h>
  256. X  #endif
  257. X  #endif
  258. X- /* May have to change previous line to <sys/file.h> for some unixes */
  259. X  #ifdef __MSDOS__
  260. X  #include <io.h>
  261. X  #define R_OK 4
  262. X--- 26,31 ----
  263. X***************
  264. X*** 127,134 ****
  265. X  #define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
  266. X  
  267. X  /* Convenience macros */
  268. X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
  269. X! #define LOWER(c) ( ((c) >= 'A' && (c) <= 'Z') ? (c) + 'a' - 'A' : (c) )
  270. X  
  271. X  /* The array holding the built-in functions. */
  272. X  Operator Func[] = {
  273. X--- 126,133 ----
  274. X  #define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
  275. X  
  276. X  /* Convenience macros */
  277. X! #define UPPER(c) (islower(c) ? toupper(c) : c)
  278. X! #define LOWER(c) (isupper(c) ? tolower(c) : c)
  279. X  
  280. X  /* The array holding the built-in functions. */
  281. X  Operator Func[] = {
  282. X***************
  283. X*** 834,840 ****
  284. X  
  285. X  /***************************************************************/
  286. X  /*                                                             */
  287. X! /*  FOstype - the type of operating system (UNIX or MSDOS)     */
  288. X  /*                                                             */
  289. X  /***************************************************************/
  290. X  #ifdef HAVE_PROTOS
  291. X--- 833,840 ----
  292. X  
  293. X  /***************************************************************/
  294. X  /*                                                             */
  295. X! /*  FOstype - the type of operating system                     */
  296. X! /*  (UNIX, OS/2, or MSDOS)                                     */
  297. X  /*                                                             */
  298. X  /***************************************************************/
  299. X  #ifdef HAVE_PROTOS
  300. X***************
  301. X*** 846,851 ****
  302. X--- 846,855 ----
  303. X  #ifdef UNIX
  304. X     return RetStrVal("UNIX");
  305. X  #else
  306. X+ #ifdef __MSC__
  307. X+     if (_osmode == OS2_MODE)
  308. X+         return RetStrVal("OS/2");
  309. X+ #endif
  310. X     return RetStrVal("MSDOS");
  311. X  #endif  
  312. X  }
  313. X***************
  314. X*** 1362,1368 ****
  315. X  PRIVATE FILE *popen(char *cmd, char *mode)
  316. X  #else
  317. X  static FILE *popen(cmd, mode)
  318. X! char *cmd, *mode
  319. X  #endif
  320. X  {
  321. X     char *s;
  322. X--- 1366,1372 ----
  323. X  PRIVATE FILE *popen(char *cmd, char *mode)
  324. X  #else
  325. X  static FILE *popen(cmd, mode)
  326. X! char *cmd, *mode;
  327. X  #endif
  328. X  {
  329. X     char *s;
  330. X*** ../p0/globals.h    Mon Nov  9 14:12:09 1992
  331. X--- ./globals.h    Wed Dec 16 10:51:25 1992
  332. X***************
  333. X*** 7,13 ****
  334. X  /*  MK_GLOBALS.  Also contains useful macro definitions.       */
  335. X  /*                                                             */
  336. X  /*  This file is part of REMIND.                               */
  337. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  338. X  /*                                                             */
  339. X  /***************************************************************/
  340. X  
  341. X--- 7,13 ----
  342. X  /*  MK_GLOBALS.  Also contains useful macro definitions.       */
  343. X  /*                                                             */
  344. X  /*  This file is part of REMIND.                               */
  345. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  346. X  /*                                                             */
  347. X  /***************************************************************/
  348. X  
  349. X***************
  350. X*** 40,45 ****
  351. X--- 40,46 ----
  352. X  EXTERN  INIT(    int     DebugFlag, 0);
  353. X  EXTERN  INIT(   char    DoCalendar, 0);
  354. X  EXTERN  INIT(   char    DoSimpleCalendar, 0);
  355. X+ EXTERN  INIT(   char    PsCal, 0);
  356. X  EXTERN  INIT(   int     CalWidth, 80);
  357. X  EXTERN  INIT(   int     CalWeeks, 0);
  358. X  EXTERN  INIT(   int     CalMonths, 0);
  359. X*** ../p0/init.c    Mon Nov  9 14:12:19 1992
  360. X--- ./init.c    Wed Dec 16 10:51:35 1992
  361. X***************
  362. X*** 36,41 ****
  363. X--- 36,42 ----
  364. X   *  -c[n]    = Produce a calendar for n months (default = 1)
  365. X   *  -w[n]    = Specify output device width (default = 80)
  366. X   *  -s[n]    = Produce calendar in "simple calendar" format
  367. X+  *  -p[n]    = Produce calendar in format compatible with rem2ps
  368. X   *  -v       = Verbose mode
  369. X   *  -o       = Ignore ONCE directives
  370. X   *  -a       = Don't issue timed reminders which will be queued
  371. X***************
  372. X*** 187,192 ****
  373. X--- 188,201 ----
  374. X             if (!CalMonths) CalMonths = 1;
  375. X             break;
  376. X  
  377. X+         case 'p':
  378. X+         case 'P':
  379. X+            DoSimpleCalendar = 1;
  380. X+            PsCal = 1;
  381. X+            PARSENUM(CalMonths, arg);
  382. X+            if (!CalMonths) CalMonths = 1;
  383. X+            break;
  384. X+ 
  385. X          case 'w':
  386. X          case 'W':
  387. X             PARSENUM(CalWidth, arg);
  388. X***************
  389. X*** 303,309 ****
  390. X  #endif
  391. X  {
  392. X     fprintf(ErrFp, "\nREMIND %s Copyright 1992 by David F. Skoll\n\n", VERSION);
  393. X!    fprintf(ErrFp, "Usage: remind [options] filename [date]\n\n");
  394. X     fprintf(ErrFp, "Options:\n");
  395. X     fprintf(ErrFp, " -n     Output next occurrence of reminders in simple format\n");
  396. X     fprintf(ErrFp, " -r     Disable RUN directives\n");
  397. X--- 312,318 ----
  398. X  #endif
  399. X  {
  400. X     fprintf(ErrFp, "\nREMIND %s Copyright 1992 by David F. Skoll\n\n", VERSION);
  401. X!    fprintf(ErrFp, "        Usage: remind [options] filename [date]\n");
  402. X     fprintf(ErrFp, "Options:\n");
  403. X     fprintf(ErrFp, " -n     Output next occurrence of reminders in simple format\n");
  404. X     fprintf(ErrFp, " -r     Disable RUN directives\n");
  405. X***************
  406. X*** 311,316 ****
  407. X--- 320,326 ----
  408. X     fprintf(ErrFp, " -c+[n] Produce a calendar for n (default 1) weeks\n");
  409. X     fprintf(ErrFp, " -w[n]  Specify width (default 80) of calendar output\n");
  410. X     fprintf(ErrFp, " -s[n]  Produce 'simple calendar' for n (1) months\n");
  411. X+    fprintf(ErrFp, " -p[n]  Same as -s, but input compatible with rem2ps\n");
  412. X     fprintf(ErrFp, " -v     Verbose mode\n");
  413. X     fprintf(ErrFp, " -o     Ignore ONCE directives\n");
  414. X     fprintf(ErrFp, " -t     Trigger all future reminders regardless of delta\n");
  415. X*** ../p0/main.c    Mon Nov  9 14:12:20 1992
  416. X--- ./main.c    Wed Dec 16 10:51:37 1992
  417. X***************
  418. X*** 16,21 ****
  419. X--- 16,24 ----
  420. X  #ifdef HAVE_MALLOC_H
  421. X  #include <malloc.h>
  422. X  #endif
  423. X+ #ifdef HAVE_UNISTD
  424. X+ #include <unistd.h>
  425. X+ #endif
  426. X  #include <stdio.h>
  427. X  #include <string.h>
  428. X  #ifdef HAVE_STDARG
  429. X***************
  430. X*** 27,32 ****
  431. X--- 30,38 ----
  432. X  
  433. X  #ifdef __MSDOS__
  434. X  #include <dos.h>
  435. X+ # ifdef __MSC__
  436. X+ # include <time.h>
  437. X+ # endif
  438. X  #endif
  439. X  
  440. X  
  441. X***************
  442. X*** 101,108 ****
  443. X  #endif
  444. X     }
  445. X  
  446. X!    /* If it's MS-DOS, reset the file access date */
  447. X! #ifdef __MSDOS__
  448. X     if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
  449. X  #endif
  450. X  
  451. X--- 107,114 ----
  452. X  #endif
  453. X     }
  454. X  
  455. X!    /* If it's MS-DOS or OS2, reset the file access date */
  456. X! #if defined(__MSDOS__) || defined(OS2)
  457. X     if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
  458. X  #endif
  459. X  
  460. X***************
  461. X*** 569,575 ****
  462. X     (void) vfprintf(ErrFp, fmt, argptr);
  463. X     (void) fputc('\n', ErrFp);
  464. X  #ifndef HAVE_STDARG
  465. X!    va_end(argptr)
  466. X  #endif
  467. X     return;
  468. X  }
  469. X--- 575,581 ----
  470. X     (void) vfprintf(ErrFp, fmt, argptr);
  471. X     (void) fputc('\n', ErrFp);
  472. X  #ifndef HAVE_STDARG
  473. X!    va_end(argptr);
  474. X  #endif
  475. X     return;
  476. X  }
  477. X***************
  478. X*** 676,683 ****
  479. X  long SystemTime()
  480. X  #endif
  481. X  {
  482. X! #ifdef __MSDOS__
  483. X! #ifdef __TURBOC__
  484. X  /* Get time in Turbo C */
  485. X  
  486. X     struct time t;
  487. X--- 682,688 ----
  488. X  long SystemTime()
  489. X  #endif
  490. X  {
  491. X! #if defined( __MSDOS__ ) && defined( __TURBOC__ )
  492. X  /* Get time in Turbo C */
  493. X  
  494. X     struct time t;
  495. X***************
  496. X*** 685,701 ****
  497. X     gettime(&t);
  498. X     return (long) t.ti_hour * 3600L + (long) t.ti_min * 60L +
  499. X        (long) t.ti_sec;
  500. X- 
  501. X  #else
  502. X! /* Get time in Microsoft C */
  503. X!    struct dostime_t tloc;
  504. X!    _dos_gettime(&tloc);
  505. X!    return (long) tloc.hour * 3600L + (long) tloc.minute * 60L +
  506. X!       (long) tloc.second;
  507. X! 
  508. X! #endif
  509. X! #else
  510. X! /* Get time in Unix */
  511. X    time_t tloc;
  512. X    struct tm *t;
  513. X  
  514. X--- 690,697 ----
  515. X     gettime(&t);
  516. X     return (long) t.ti_hour * 3600L + (long) t.ti_min * 60L +
  517. X        (long) t.ti_sec;
  518. X  #else
  519. X! /* Get time in Unix or with MSC */
  520. X    time_t tloc;
  521. X    struct tm *t;
  522. X  
  523. X***************
  524. X*** 723,730 ****
  525. X  int *y;
  526. X  #endif
  527. X  {
  528. X! #ifdef __MSDOS__
  529. X! #ifdef __TURBOC__
  530. X  /* Get today's date in Turbo C */
  531. X     struct date da;
  532. X  
  533. X--- 719,725 ----
  534. X  int *y;
  535. X  #endif
  536. X  {
  537. X! #if defined( __MSDOS__ ) && defined( __TURBOC__ )
  538. X  /* Get today's date in Turbo C */
  539. X     struct date da;
  540. X  
  541. X***************
  542. X*** 733,751 ****
  543. X     *m = da.da_mon - 1;
  544. X     *d = da.da_day;
  545. X  #else
  546. X! /* Get today's date in Microsoft C */
  547. X!    struct dosdate_t buf;
  548. X! 
  549. X!    _dos_getdate(&buf);
  550. X! 
  551. X!    *d = buf.day;
  552. X!    *m = buf.month - 1;
  553. X!    *y = buf.year;
  554. X! #endif
  555. X! #else
  556. X! /* Get today's date in UNIX */
  557. X!   time_t tloc;
  558. X!   struct tm *t;
  559. X  
  560. X     (void) time(&tloc);
  561. X     t = localtime(&tloc);
  562. X--- 728,736 ----
  563. X     *m = da.da_mon - 1;
  564. X     *d = da.da_day;
  565. X  #else
  566. X! /* Get today's date in UNIX or with MSC */
  567. X!    time_t tloc;
  568. X!    struct tm *t;
  569. X  
  570. X     (void) time(&tloc);
  571. X     t = localtime(&tloc);
  572. X*** ../p0/makefile.msc    Mon Nov  9 14:12:34 1992
  573. X--- ./makefile.msc    Wed Dec 16 10:51:53 1992
  574. X***************
  575. X*** 55,57 ****
  576. X--- 55,64 ----
  577. X  
  578. X  remind.exe: $(OBJS)
  579. X      link /NOI @lnk.msc
  580. X+ 
  581. X+ rem2ps.obj: rem2ps.c
  582. X+     cl /c $(DEFINES) $(MODEL) /Forem2ps.obj rem2ps.c
  583. X+ 
  584. X+ rem2ps.exe: rem2ps.obj
  585. X+     link /NOI rem2ps,rem2ps.exe,,,
  586. X+ 
  587. X*** ../p0/makefile.tc    Mon Nov  9 14:12:33 1992
  588. X--- ./makefile.tc    Wed Dec 16 10:51:51 1992
  589. X***************
  590. X*** 1,6 ****
  591. X  # Makefile for REMIND for Turbo C for MSDOS
  592. X  
  593. X! VERSION= 03.00.00
  594. X  
  595. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h
  596. X  
  597. X--- 1,6 ----
  598. X  # Makefile for REMIND for Turbo C for MSDOS
  599. X  
  600. X! VERSION= 03.00.01
  601. X  
  602. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h
  603. X  
  604. X***************
  605. X*** 15,27 ****
  606. X  
  607. X  MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
  608. X  remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
  609. X! makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1
  610. X  
  611. X  remind.exe: $(OBJS)
  612. X      tcc @lnk.tc
  613. X  
  614. X  .c.obj:
  615. X      tcc -A -w-pia -c -O -ms {$< }
  616. X  
  617. X  calendar.obj: calendar.c $(STDHDRS) expr.h
  618. X  
  619. X--- 15,35 ----
  620. X  
  621. X  MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
  622. X  remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
  623. X! makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
  624. X! defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1
  625. X  
  626. X+ all: remind.exe rem2ps.exe
  627. X+ 
  628. X  remind.exe: $(OBJS)
  629. X      tcc @lnk.tc
  630. X  
  631. X+ rem2ps.exe: rem2ps.obj
  632. X+     tcc -erem2ps.exe rem2ps.obj
  633. X+ 
  634. X  .c.obj:
  635. X      tcc -A -w-pia -c -O -ms {$< }
  636. X+ 
  637. X+ rem2ps.obj: rem2ps.c rem2ps.h config.h
  638. X  
  639. X  calendar.obj: calendar.c $(STDHDRS) expr.h
  640. X  
  641. X*** ../p0/protos.h    Mon Nov  9 14:12:10 1992
  642. X--- ./protos.h    Wed Dec 16 10:51:26 1992
  643. X***************
  644. X*** 5,11 ****
  645. X  /*  Function Prototypes.                                       */
  646. X  /*                                                             */
  647. X  /*  This file is part of REMIND.                               */
  648. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  649. X  /*                                                             */
  650. X  /***************************************************************/
  651. X  #ifdef HAVE_PROTOS
  652. X--- 5,11 ----
  653. X  /*  Function Prototypes.                                       */
  654. X  /*                                                             */
  655. X  /*  This file is part of REMIND.                               */
  656. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  657. X  /*                                                             */
  658. X  /***************************************************************/
  659. X  #ifdef HAVE_PROTOS
  660. X***************
  661. X*** 110,112 ****
  662. X--- 110,113 ----
  663. X  int DoPreserve  ARGS ((Parser *p));
  664. X  int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
  665. X  int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
  666. X+ int HashVal ARGS ((const char *str));
  667. X*** ../p0/queue.c    Mon Nov  9 14:12:22 1992
  668. X--- ./queue.c    Wed Dec 16 10:51:38 1992
  669. X***************
  670. X*** 8,18 ****
  671. X  /*  Copyright (C) 1992 by David F. Skoll.                      */
  672. X  /*                                                             */
  673. X  /***************************************************************/
  674. X  #include <stdio.h>
  675. X  #include <signal.h>
  676. X  #include <sys/types.h>
  677. X  #include <sys/stat.h>
  678. X- #include "config.h"
  679. X  #ifdef HAVE_STDLIB_H
  680. X  #include <stdlib.h>
  681. X  #endif
  682. X--- 8,18 ----
  683. X  /*  Copyright (C) 1992 by David F. Skoll.                      */
  684. X  /*                                                             */
  685. X  /***************************************************************/
  686. X+ #include "config.h"
  687. X  #include <stdio.h>
  688. X  #include <signal.h>
  689. X  #include <sys/types.h>
  690. X  #include <sys/stat.h>
  691. X  #ifdef HAVE_STDLIB_H
  692. X  #include <stdlib.h>
  693. X  #endif
  694. X***************
  695. X*** 19,24 ****
  696. X--- 19,27 ----
  697. X  #ifdef HAVE_MALLOC_H
  698. X  #include <malloc.h>
  699. X  #endif
  700. X+ #ifdef HAVE_UNISTD
  701. X+ #include <unistd.h>
  702. X+ #endif
  703. X  #include "globals.h"
  704. X  #include "err.h"
  705. X  #include "types.h"
  706. X***************
  707. X*** 174,179 ****
  708. X--- 177,183 ----
  709. X        /* Trigger the reminder */
  710. X        CreateParser(q->text, &p);
  711. X        trig.typ = q->typ;
  712. X+       RunDisabled = q->RunDisabled;
  713. X        (void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
  714. X        fflush(stdout);
  715. X        
  716. X*** ../p0/remind.1    Mon Nov  9 14:12:29 1992
  717. X--- ./remind.1    Wed Dec 16 10:51:48 1992
  718. X***************
  719. X*** 1,4 ****
  720. X! .TH REMIND 1 "20 October 1992"
  721. X  .UC4
  722. X  .SH NAME
  723. X  remind \- a sophisticated reminder service
  724. X--- 1,4 ----
  725. X! .TH REMIND 1 "11 November 1992"
  726. X  .UC4
  727. X  .SH NAME
  728. X  remind \- a sophisticated reminder service
  729. X***************
  730. X*** 38,43 ****
  731. X--- 38,48 ----
  732. X  format" which can be used as input for more sophisticated calendar-drawing
  733. X  programs.
  734. X  .TP
  735. X+ .B \-p\fR\fIn\fR
  736. X+ The \fB\-p\fR option is very similar to the \fB\-s\fR option, except
  737. X+ that the output contains additional information for use by the
  738. X+ \fBrem2ps\fR program, which creates a PostScript calendar.
  739. X+ .TP
  740. X  .B \-v
  741. X  The \fB\-v\fR option makes the output of \fBRemind\fR slightly more verbose.
  742. X  .TP
  743. X***************
  744. X*** 1149,1163 ****
  745. X  .RE
  746. X  .TP
  747. X  .B DATE constants
  748. X! \fBDATE\fR constants have no readable representation.  They must be
  749. X! created with the \fBdate()\fR function, which takes the year, month
  750. X! and day as arguments:
  751. X  .PP
  752. X  .RS
  753. X! date(1992, 2, 29), date(1996, 4, 2), date(2001, 12, 17)
  754. X  .PP
  755. X! However, \fBDATE\fR constants are \fIprinted\fR as
  756. X! \fIyyyy\fR/\fImm\fR/\fIdd\fR.
  757. X  .RE
  758. X  .PP
  759. X  .B OPERATORS
  760. X--- 1154,1170 ----
  761. X  .RE
  762. X  .TP
  763. X  .B DATE constants
  764. X! \fBDATE\fR constants are expressed as 'yyyy/mm/dd', and the single
  765. X! quotes \fImust\fR be supplied.  This distinguishes date constants
  766. X! from division of integers.  Examples:
  767. X  .PP
  768. X  .RS
  769. X! '1993/02/22', '1992/12/25', '1999/01/01'
  770. X  .PP
  771. X! Note that \fBDATE\fR constants are \fIprinted\fR as
  772. X! \fIyyyy\fR/\fImm\fR/\fIdd\fR without the quotes.  Note also that versions
  773. X! of \fBRemind\fR prior to 03.00.01 did not support date constants.  In those
  774. X! versions, you must create dates using the \fBdate()\fR function.
  775. X  .RE
  776. X  .PP
  777. X  .B OPERATORS
  778. X***************
  779. X*** 1372,1377 ****
  780. X--- 1379,1389 ----
  781. X  a \fBSTRING\fR consisting of the characters specified by the arguments.
  782. X  Note that none of the arguments can be 0, unless there is only one
  783. X  argument.  As a special case, \fBchar(0)\fR returns "".
  784. X+ .PP
  785. X+ Note that because \fBRemind\fR does not support escaping of characters
  786. X+ in strings, the only way to get a double-quote in a string is to use
  787. X+ \fBchar(34)\fR.  Yes, I know it's not portable - it assumes ASCII
  788. X+ coding.
  789. X  .TP
  790. X  .B choose(i_index, x_arg1 [,x_arg2...])
  791. X  \fBChoose\fR must take at least two arguments, the first of which is
  792. X***************
  793. X*** 1525,1531 ****
  794. X  \fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
  795. X  .TP
  796. X  .B ostype()
  797. X! Returns "UNIX" on UNIX systems, and "MSDOS" on MS-DOS systems.
  798. X  .TP
  799. X  .B plural(i_num [,s_str1 [,s_str2]])
  800. X  Can take from one to three arguments.  If one argument is supplied, returns
  801. X--- 1537,1545 ----
  802. X  \fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
  803. X  .TP
  804. X  .B ostype()
  805. X! Returns "UNIX" on UNIX systems, "MSDOS" on MS-DOS systems, and "OS/2"
  806. X! on OS/2 systems.  If you run \fBRemind\fR in an MS-DOS box under OS/2,
  807. X! this function returns "MSDOS".
  808. X  .TP
  809. X  .B plural(i_num [,s_str1 [,s_str2]])
  810. X  Can take from one to three arguments.  If one argument is supplied, returns
  811. X***************
  812. X*** 1615,1621 ****
  813. X  .TP
  814. X  .B version()
  815. X  Returns a string specifying the version of \fBRemind\fR.  For version 
  816. X! 03.00.00, returns "03.00.00".  It is guaranteed that as new versions of
  817. X  \fBRemind\fR are released, the value returned by \fBversion()\fR will
  818. X  strictly increase, according to the rules for string ordering.
  819. X  .TP
  820. X--- 1629,1635 ----
  821. X  .TP
  822. X  .B version()
  823. X  Returns a string specifying the version of \fBRemind\fR.  For version 
  824. X! 03.00.01, returns "03.00.01".  It is guaranteed that as new versions of
  825. X  \fBRemind\fR are released, the value returned by \fBversion()\fR will
  826. X  strictly increase, according to the rules for string ordering.
  827. X  .TP
  828. X***************
  829. X*** 2009,2024 ****
  830. X  .PP
  831. X  .SH CALENDAR MODE
  832. X  .PP
  833. X! If you supply the \fB\-c\fR or \fB\-s\fR command-line option, the \fBRemind\fR
  834. X  runs in "calendar mode."  In this mode, \fBRemind\fR interprets the script
  835. X  repeatedly, performing one iteration through the whole file for each day
  836. X  in the calendar.  Reminders which trigger are saved in internal buffers,
  837. X  and then inserted into the calendar in the appropriate places.
  838. X  .PP
  839. X! For example, if you have a reminder script called ".reminders", and you
  840. X! executed this command:
  841. X  .PP
  842. X  .nf
  843. X      remind -c .reminders jan 1993
  844. X  .fi
  845. X  .PP
  846. X--- 2023,2049 ----
  847. X  .PP
  848. X  .SH CALENDAR MODE
  849. X  .PP
  850. X! If you supply the \fB\-c\fR, \fB\-s\fR or \fB\-p\fR
  851. X! command-line option, then \fBRemind\fR
  852. X  runs in "calendar mode."  In this mode, \fBRemind\fR interprets the script
  853. X  repeatedly, performing one iteration through the whole file for each day
  854. X  in the calendar.  Reminders which trigger are saved in internal buffers,
  855. X  and then inserted into the calendar in the appropriate places.
  856. X  .PP
  857. X! The \fB\-p\fR option is used in conjunction with the \fBrem2ps\fR
  858. X! program to produce a calendar in PostScript format.  For example, the
  859. X! following command will send PostScript code to standard output:
  860. X  .PP
  861. X  .nf
  862. X+     remind -p .reminders | rem2ps
  863. X+ .fi
  864. X+ .PP
  865. X+ You can print a PostScript calendar by piping this to the \fBlpr\fR command.
  866. X+ .PP
  867. X+ If you have a reminder script called ".reminders", and you
  868. X+ execute this command:
  869. X+ .PP
  870. X+ .nf
  871. X      remind -c .reminders jan 1993
  872. X  .fi
  873. X  .PP
  874. X***************
  875. X*** 2205,2210 ****
  876. X--- 2230,2249 ----
  877. X  that the trigger date is issued only in election years, which are
  878. X  multiples of 4.  The second \fBREM\fR command actually issues the
  879. X  reminder.
  880. X+ .PP
  881. X+ .B DETAILS ABOUT TRIGVALID()
  882. X+ .PP
  883. X+ The \fBtrigvalid()\fR function returns 1 if \fBRemind\fR could find a trigger
  884. X+ date for the previous \fBREM\fR or \fBIFTRIG\fR command.  More specifically,
  885. X+ it returns 1 if \fBRemind\fR finds a date \fInot in the past\fR which
  886. X+ satisfies the trigger.  In addition, there is one special case in which
  887. X+ \fBtrigvalid()\fR returns 1 and \fBtrigdate()\fR returns a meaningful result:
  888. X+ .PP
  889. X+ If the \fBREM\fR or \fBIFTRIG\fR command did not contain an \fBUNTIL\fR
  890. X+ clause, and contained all of the \fIday\fR, \fImonth\fR and \fIyear\fR
  891. X+ components, then \fBRemind\fR will correctly compute a trigger date, even
  892. X+ if it happens to be in the past.  Note that this behaviour is not true for
  893. X+ versions of \fBRemind\fR prior to 03.00.01.
  894. X  .SH AUTHOR
  895. X  .PP
  896. X  David F. Skoll
  897. X***************
  898. X*** 2212,2218 ****
  899. X  .PP
  900. X  Date calculation is a bit "brute force."
  901. X  .PP
  902. X! The MS-DOS version of \fBRemind\fR does not support queuing or timed
  903. X  activation of reminders.
  904. X  .PP
  905. X  \fBRemind\fR has some built-in limits on total line length,
  906. X--- 2251,2257 ----
  907. X  .PP
  908. X  Date calculation is a bit "brute force."
  909. X  .PP
  910. X! The MS-DOS and OS/2 versions of \fBRemind\fR do not support queuing or timed
  911. X  activation of reminders.
  912. X  .PP
  913. X  \fBRemind\fR has some built-in limits on total line length,
  914. X***************
  915. X*** 2220,2223 ****
  916. X  .PP
  917. X  .SH SEE ALSO
  918. X  .pp
  919. X! rem, elm, kall
  920. X--- 2259,2262 ----
  921. X  .PP
  922. X  .SH SEE ALSO
  923. X  .pp
  924. X! rem, elm, kall, rem2ps
  925. X*** ../p0/test-rem    Mon Nov  9 14:12:33 1992
  926. X--- ./test-rem    Wed Dec 16 10:51:51 1992
  927. X***************
  928. X*** 1,8 ****
  929. X! #!/bin/csh -f
  930. X! setenv TEST_GETENV "foo bar baz"
  931. X  ./remind -e -dxtev ./test.rem 16 feb 1991 > ./test.out
  932. X  cmp -s ./test.out ./test.cmp
  933. X! if ($status == 0) then
  934. X     echo "Remind:  Acceptance test PASSED"
  935. X     exit 0
  936. X  else
  937. X--- 1,8 ----
  938. X! #!/bin/sh
  939. X! TEST_GETENV="foo bar baz" ; export TEST_GETENV
  940. X  ./remind -e -dxtev ./test.rem 16 feb 1991 > ./test.out
  941. X  cmp -s ./test.out ./test.cmp
  942. X! if [ "$?" = "0" ]; then
  943. X     echo "Remind:  Acceptance test PASSED"
  944. X     exit 0
  945. X  else
  946. X***************
  947. X*** 11,14 ****
  948. X     echo "Examine the file test.out to see where it differs from the"
  949. X     echo "reference file test.cmp."
  950. X     exit 1
  951. X! endif
  952. X--- 11,14 ----
  953. X     echo "Examine the file test.out to see where it differs from the"
  954. X     echo "reference file test.cmp."
  955. X     exit 1
  956. X! fi
  957. X*** ../p0/test.cmp    Mon Nov  9 14:12:33 1992
  958. X--- ./test.cmp    Wed Dec 16 10:51:51 1992
  959. X***************
  960. X*** 349,355 ****
  961. X  "a05" + "6" => "a056"
  962. X  value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  963. X  set a058 version()
  964. X! version() => "03.00.00"
  965. X  set a059 wkday(today())
  966. X  today() => 1991/02/16
  967. X  wkday(1991/02/16) => "Saturday"
  968. X--- 349,355 ----
  969. X  "a05" + "6" => "a056"
  970. X  value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  971. X  set a058 version()
  972. X! version() => "03.00.01"
  973. X  set a059 wkday(today())
  974. X  today() => 1991/02/16
  975. X  wkday(1991/02/16) => "Saturday"
  976. X***************
  977. X*** 453,459 ****
  978. X          a048  "foo"
  979. X          a067  "INT"
  980. X          a039  "February"
  981. X!         a058  "03.00.00"
  982. X          a049  21
  983. X          a068  "STRING"
  984. X          a059  "Saturday"
  985. X--- 453,459 ----
  986. X          a048  "foo"
  987. X          a067  "INT"
  988. X          a039  "February"
  989. X!         a058  "03.00.01"
  990. X          a049  21
  991. X          a068  "STRING"
  992. X          a059  "Saturday"
  993. X*** ../p0/token.c    Mon Nov  9 14:12:22 1992
  994. X--- ./token.c    Wed Dec 16 10:51:39 1992
  995. X***************
  996. X*** 6,17 ****
  997. X  /*  classifying the tokens parsed.                             */
  998. X  /*                                                             */
  999. X  /*  This file is part of REMIND.                               */
  1000. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  1001. X  /*                                                             */
  1002. X  /***************************************************************/
  1003. X  #include <stdio.h>
  1004. X  #include <ctype.h>
  1005. X- #include "config.h"
  1006. X  #ifdef HAVE_STDLIB_H
  1007. X  #include <stdlib.h>
  1008. X  #endif
  1009. X--- 6,17 ----
  1010. X  /*  classifying the tokens parsed.                             */
  1011. X  /*                                                             */
  1012. X  /*  This file is part of REMIND.                               */
  1013. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  1014. X  /*                                                             */
  1015. X  /***************************************************************/
  1016. X+ #include "config.h"
  1017. X  #include <stdio.h>
  1018. X  #include <ctype.h>
  1019. X  #ifdef HAVE_STDLIB_H
  1020. X  #include <stdlib.h>
  1021. X  #endif
  1022. X*** ../p0/trigger.c    Mon Nov  9 14:12:23 1992
  1023. X--- ./trigger.c    Wed Dec 16 10:51:40 1992
  1024. X***************
  1025. X*** 5,16 ****
  1026. X  /*  Routines for figuring out the trigger date of a reminder   */
  1027. X  /*                                                             */
  1028. X  /*  This file is part of REMIND.                               */
  1029. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  1030. X  /*                                                             */
  1031. X  /***************************************************************/
  1032. X  
  1033. X- #include <stdio.h>
  1034. X  #include "config.h"
  1035. X  #ifdef HAVE_STDLIB_H
  1036. X  #include <stdlib.h>
  1037. X  #endif
  1038. X--- 5,16 ----
  1039. X  /*  Routines for figuring out the trigger date of a reminder   */
  1040. X  /*                                                             */
  1041. X  /*  This file is part of REMIND.                               */
  1042. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  1043. X  /*                                                             */
  1044. X  /***************************************************************/
  1045. X  
  1046. X  #include "config.h"
  1047. X+ #include <stdio.h>
  1048. X  #ifdef HAVE_STDLIB_H
  1049. X  #include <stdlib.h>
  1050. X  #endif
  1051. X***************
  1052. X*** 439,448 ****
  1053. X--- 439,456 ----
  1054. X           fprintf(ErrFp, "%s(%d): Expired\n",
  1055. X                   FileName, LineNo);
  1056. X           }
  1057. X+          if (result != -1) {
  1058. X+             LastTriggerDate = result;
  1059. X+         LastTrigValid = 1;
  1060. X+          }
  1061. X           return -1;
  1062. X        }
  1063. X        /* Keep scanning... unless there's no point in doing it.*/
  1064. X        if (nextstart <= start) {
  1065. X+            if (result != -1) {
  1066. X+         LastTriggerDate = result;
  1067. X+         LastTrigValid = 1;
  1068. X+      }
  1069. X           if (DebugFlag & DB_PRTTRIG) {
  1070. X          fprintf(ErrFp, "%s(%d): Expired\n",
  1071. X                    FileName, LineNo);
  1072. X*** ../p0/types.h    Mon Nov  9 14:12:10 1992
  1073. X--- ./types.h    Wed Dec 16 10:51:26 1992
  1074. X***************
  1075. X*** 5,11 ****
  1076. X  /*  Type definitions all dumped here.                          */
  1077. X  /*                                                             */
  1078. X  /*  This file is part of REMIND.                               */
  1079. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  1080. X  /*                                                             */
  1081. X  /***************************************************************/
  1082. X  /* Values */
  1083. X--- 5,11 ----
  1084. X  /*  Type definitions all dumped here.                          */
  1085. X  /*                                                             */
  1086. X  /*  This file is part of REMIND.                               */
  1087. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  1088. X  /*                                                             */
  1089. X  /***************************************************************/
  1090. X  /* Values */
  1091. X*** ../p0/utils.c    Mon Nov  9 14:12:24 1992
  1092. X--- ./utils.c    Wed Dec 16 10:51:41 1992
  1093. X***************
  1094. X*** 5,17 ****
  1095. X  /*  Useful utility functions.                                  */
  1096. X  /*                                                             */
  1097. X  /*  This file is part of REMIND.                               */
  1098. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  1099. X  /*                                                             */
  1100. X  /***************************************************************/
  1101. X  
  1102. X  #include <string.h>
  1103. X  #include <stdio.h>
  1104. X- #include "config.h"
  1105. X  #ifdef HAVE_STDLIB_H
  1106. X  #include <stdlib.h>
  1107. X  #endif
  1108. X--- 5,17 ----
  1109. X  /*  Useful utility functions.                                  */
  1110. X  /*                                                             */
  1111. X  /*  This file is part of REMIND.                               */
  1112. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  1113. X  /*                                                             */
  1114. X  /***************************************************************/
  1115. X  
  1116. X+ #include "config.h"
  1117. X  #include <string.h>
  1118. X  #include <stdio.h>
  1119. X  #ifdef HAVE_STDLIB_H
  1120. X  #include <stdlib.h>
  1121. X  #endif
  1122. X***************
  1123. X*** 18,25 ****
  1124. X  #ifdef HAVE_MALLOC_H
  1125. X  #include <malloc.h>
  1126. X  #endif
  1127. X  
  1128. X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
  1129. X  
  1130. X  /***************************************************************/
  1131. X  /*                                                             */
  1132. X--- 18,26 ----
  1133. X  #ifdef HAVE_MALLOC_H
  1134. X  #include <malloc.h>
  1135. X  #endif
  1136. X+ #include <ctype.h>
  1137. X  
  1138. X! #define UPPER(c) (islower(c) ? toupper(c) : c)
  1139. X  
  1140. X  /***************************************************************/
  1141. X  /*                                                             */
  1142. X*** ../p0/var.c    Mon Nov  9 14:12:25 1992
  1143. X--- ./var.c    Wed Dec 16 10:51:42 1992
  1144. X***************
  1145. X*** 6,17 ****
  1146. X  /*  user- and system-defined variables.                        */
  1147. X  /*                                                             */
  1148. X  /*  This file is part of REMIND.                               */
  1149. X! /*  Copyright (C) 1991 by David F. Skoll.                      */
  1150. X  /*                                                             */
  1151. X  /***************************************************************/
  1152. X  
  1153. X- #include <stdio.h>
  1154. X  #include "config.h"
  1155. X  #ifdef HAVE_STDLIB_H
  1156. X  #include <stdlib.h>
  1157. X  #endif
  1158. X--- 6,17 ----
  1159. X  /*  user- and system-defined variables.                        */
  1160. X  /*                                                             */
  1161. X  /*  This file is part of REMIND.                               */
  1162. X! /*  Copyright (C) 1992 by David F. Skoll.                      */
  1163. X  /*                                                             */
  1164. X  /***************************************************************/
  1165. X  
  1166. X  #include "config.h"
  1167. X+ #include <stdio.h>
  1168. X  #ifdef HAVE_STDLIB_H
  1169. X  #include <stdlib.h>
  1170. X  #endif
  1171. X***************
  1172. X*** 18,23 ****
  1173. X--- 18,24 ----
  1174. X  #ifdef HAVE_MALLOC_H
  1175. X  #include <malloc.h>
  1176. X  #endif
  1177. X+ #include <ctype.h>
  1178. X  #include "types.h"
  1179. X  #include "expr.h"
  1180. X  #include "globals.h"
  1181. X***************
  1182. X*** 24,30 ****
  1183. X  #include "protos.h"
  1184. X  #include "err.h"
  1185. X  
  1186. X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
  1187. X  
  1188. X  /* The variable hash table */
  1189. X  #define VAR_HASH_SIZE 64
  1190. X--- 25,31 ----
  1191. X  #include "protos.h"
  1192. X  #include "err.h"
  1193. X  
  1194. X! #define UPPER(c) (islower(c) ? toupper(c) : c)
  1195. X  
  1196. X  /* The variable hash table */
  1197. X  #define VAR_HASH_SIZE 64
  1198. X***************
  1199. X*** 377,383 ****
  1200. X  
  1201. X  /***************************************************************/
  1202. X  /*                                                             */
  1203. X! /*  DoPreserve - delete a bunch of variables.                  */
  1204. X  /*                                                             */
  1205. X  /***************************************************************/
  1206. X  #ifdef HAVE_PROTOS
  1207. X--- 378,384 ----
  1208. X  
  1209. X  /***************************************************************/
  1210. X  /*                                                             */
  1211. X! /*  DoPreserve - preserve a bunch of variables.                */
  1212. X  /*                                                             */
  1213. X  /***************************************************************/
  1214. X  #ifdef HAVE_PROTOS
  1215. END_OF_FILE
  1216.   if test 34792 -ne `wc -c <'patch.01.B'`; then
  1217.     echo shar: \"'patch.01.B'\" unpacked with wrong size!
  1218.   elif test -f 'patch.01.A'; then
  1219.     echo shar: Combining  \"'patch.01'\" \(67490 characters\)
  1220.     cat 'patch.01.A' 'patch.01.B' > 'patch.01'
  1221.     if test 67490 -ne `wc -c <'patch.01'`; then
  1222.       echo shar: \"'patch.01'\" combined with wrong size!
  1223.     else
  1224.       rm patch.01.A patch.01.B
  1225.     fi
  1226.   fi
  1227.   # end of 'patch.01.B'
  1228. fi
  1229. if test -f 'rem2ps.c' -a "${1}" != "-c" ; then 
  1230.   echo shar: Will not clobber existing file \"'rem2ps.c'\"
  1231. else
  1232.   echo shar: Extracting \"'rem2ps.c'\" \(16502 characters\)
  1233.   sed "s/^X//" >'rem2ps.c' <<'END_OF_FILE'
  1234. X/***************************************************************/
  1235. X/*                                                             */
  1236. X/*  REM2PS.C                                                   */
  1237. X/*                                                             */
  1238. X/*  Print a PostScript calendar.                               */
  1239. X/*                                                             */
  1240. X/*  This file is part of REMIND.                               */
  1241. X/*  Copyright (C) 1992 by David F. Skoll.                      */
  1242. X/*                                                             */
  1243. X/***************************************************************/
  1244. X#include "config.h"
  1245. X#include <stdio.h>
  1246. X#include <string.h>
  1247. X#include <ctype.h>
  1248. X#ifdef HAVE_UNISTD
  1249. X#include <unistd.h>
  1250. X#endif
  1251. X#include "rem2ps.h"
  1252. X#ifdef HAVE_MALLOC_H
  1253. X#include <malloc.h>
  1254. X#endif
  1255. X#ifdef HAVE_STDLIB_H
  1256. X#include <stdlib.h>
  1257. X#endif
  1258. X
  1259. X#ifdef HAVE_PROTOS
  1260. X#define ARGS(x) x
  1261. X#else
  1262. X#define ARGS(x) ()
  1263. X#endif
  1264. X#define NEW(type) ((type *) malloc(sizeof(type)))
  1265. X
  1266. Xtypedef struct _CalEntry {
  1267. X   struct _CalEntry *next;
  1268. X   char *entry;
  1269. X} CalEntry;
  1270. X
  1271. Xtypedef struct {
  1272. X   char *name;
  1273. X   int xsize, ysize;
  1274. X} PageType;
  1275. X
  1276. Xchar Days[]="SMTWTFS";
  1277. X
  1278. XPageType Pages[] =
  1279. X{
  1280. X   {"Letter", 612, 792},     /* 8.5 x 11 in. */
  1281. X   {"Tabloid", 792, 1224},   /* 11 x 17 in. */
  1282. X   {"Ledger", 1224, 792},    /* 17 x 11 in. */
  1283. X   {"Legal", 612, 1008},     /* 8.5 x 14 in. */
  1284. X   {"Statement", 396, 612},  /* 5.5 x 8.5 in. */
  1285. X   {"Executive", 540, 720},  /* 7.5 x 10 in. */
  1286. X   {"A3", 842, 1190},
  1287. X   {"A4", 595, 842},
  1288. X   {"A5", 420, 595},
  1289. X   {"B4", 729, 1032},
  1290. X   {"B5", 519, 729},
  1291. X   {"Folio", 612, 936},
  1292. X   {"Quarto", 612, 780},
  1293. X   {"10x14", 720, 1008}
  1294. X};
  1295. X
  1296. X#define NUMPAGES (sizeof(Pages)/sizeof(Pages[0]))
  1297. X
  1298. XCalEntry *CurEntries;
  1299. XPageType *CurPage;
  1300. Xchar PortraitMode;
  1301. Xchar NoSmallCal;
  1302. X
  1303. Xchar LineBuffer[LINELEN];
  1304. X
  1305. Xchar *HeadFont="Helvetica";
  1306. Xchar *DayFont="Helvetica-BoldOblique";
  1307. Xchar *EntryFont="Helvetica";
  1308. Xchar *SmallFont="Helvetica";
  1309. Xchar *LineWidth = "1";
  1310. X
  1311. Xchar *HeadSize="14";
  1312. Xchar *DaySize="14";
  1313. Xchar *EntrySize="8";
  1314. Xchar *BorderSize = "6";
  1315. X
  1316. Xint validfile = 0;
  1317. X
  1318. Xint CurDay;
  1319. Xint MaxDay;
  1320. Xint DayNum;
  1321. Xint WkDayNum;
  1322. X
  1323. Xvoid Init ARGS ((int argc, char *argv[]));
  1324. Xvoid Usage ARGS ((char *s));
  1325. Xvoid DoPsCal ARGS ((void));
  1326. Xvoid DoSmallCal ARGS((char *m, int days, int first, int col));
  1327. Xvoid WriteProlog ARGS ((void));
  1328. Xvoid WriteCalEntry ARGS ((void));
  1329. Xvoid WriteOneEntry ARGS ((char *s));
  1330. X
  1331. X/***************************************************************/
  1332. X/*                                                             */
  1333. X/*   MAIN PROGRAM                                              */
  1334. X/*                                                             */
  1335. X/***************************************************************/
  1336. X#ifdef HAVE_PROTOS
  1337. XPUBLIC int main(int argc, char *argv[])
  1338. X#else
  1339. Xint main(argc, argv)
  1340. Xint argc;
  1341. Xchar argv[];
  1342. X#endif
  1343. X{
  1344. X   /* If stdin is a tty - probably wrong. */
  1345. X
  1346. X   Init(argc, argv);
  1347. X
  1348. X   if (isatty(0)) {
  1349. X      Usage("Input should not come from a terminal");
  1350. X   }
  1351. X
  1352. X   /* Search for a valid input file */
  1353. X   while (!feof(stdin)) {
  1354. X      gets(LineBuffer);
  1355. X      if (!strcmp(LineBuffer, PSBEGIN)) {
  1356. X         if (!validfile) WriteProlog();
  1357. X         validfile++;
  1358. X         DoPsCal();
  1359. X      }
  1360. X   }
  1361. X   if (!validfile) {
  1362. X      fprintf(stderr, "Couldn't find any calendar data!\n");
  1363. X      exit(1);
  1364. X   }
  1365. X   printf("%%%%Trailer\n");
  1366. X   printf("%%%%Pages: %d\n", validfile);
  1367. X   return 0;
  1368. X}
  1369. X
  1370. X/***************************************************************/
  1371. X/*                                                             */
  1372. X/*  DoPsCal - emit PostScript for the calendar.                */
  1373. X/*                                                             */
  1374. X/***************************************************************/
  1375. X#ifdef HAVE_PROTOS
  1376. Xvoid DoPsCal(void)
  1377. X#else
  1378. Xvoid DoPsCal()
  1379. X#endif
  1380. X{
  1381. X   char month[40], year[40];
  1382. X   char prevm[40], nextm[40];
  1383. X   int days, wkday, prevdays, nextdays;
  1384. X   int sfirst;
  1385. X   int i;
  1386. X   int smallcol;
  1387. X   CalEntry *c, *d;
  1388. X
  1389. X   printf("%%%%Page: %d %d\n", validfile, validfile);
  1390. X/* Read the month and year name, followed by # days in month and 1st day of
  1391. X   month */
  1392. X   gets(LineBuffer);
  1393. X   sscanf(LineBuffer, "%s %s %d %d", month, year, &days, &wkday);
  1394. X   gets(LineBuffer);
  1395. X   sscanf(LineBuffer, "%s %d", prevm, &prevdays);
  1396. X   gets(LineBuffer);
  1397. X   sscanf(LineBuffer, "%s %d", nextm, &nextdays);
  1398. X   MaxDay = days;
  1399. X
  1400. X/* Emit PostScript to do the heading */
  1401. X   if (!PortraitMode) printf("XSIZE 0 translate 90 rotate\n");
  1402. X   printf("(%s %s) doheading\n", month, year);
  1403. X
  1404. X/* Calculate the minimum box size */
  1405. X   printf("/MinBoxSize ytop MinY sub 7 div def\n");
  1406. X
  1407. X/* If wkday >= 2, then do the small calendars at the top. */
  1408. X   if (wkday >=2 && !NoSmallCal) {
  1409. X      smallcol = 0;
  1410. X      printf("/ysmall ytop def\n");
  1411. X   }
  1412. X
  1413. X/* Do each entry */
  1414. X
  1415. X   CurEntries = NULL;
  1416. X   CurDay = 1;
  1417. X   WkDayNum = wkday;
  1418. X
  1419. X   while(1) {
  1420. X      gets(LineBuffer);
  1421. X      if (!strcmp(LineBuffer, PSEND)) break;
  1422. X
  1423. X/* Read the day number - a bit of a hack! */
  1424. X      DayNum = (LineBuffer[8] - '0') * 10 + LineBuffer[9] - '0';
  1425. X      if (DayNum != CurDay) {
  1426. X         for(; CurDay<DayNum; CurDay++) {
  1427. X        WriteCalEntry();
  1428. X        WkDayNum = (WkDayNum + 1) % 7;
  1429. X         }
  1430. X      }
  1431. X/* Add the text */
  1432. X      c = NEW(CalEntry);
  1433. X      if (!c) {
  1434. X         fprintf(stderr, "malloc failed - aborting.\n");
  1435. X     exit(1);
  1436. X      }
  1437. X      c->next = NULL;
  1438. X      c->entry = malloc(strlen(LineBuffer+10) + 1);
  1439. X      if (!c->entry) {
  1440. X         fprintf(stderr, "malloc failed - aborting.\n");
  1441. X     exit(1);
  1442. X      }
  1443. X      strcpy(c->entry, LineBuffer+10);
  1444. X
  1445. X/* Put on linked list */
  1446. X      if (!CurEntries) CurEntries = c;
  1447. X      else {
  1448. X         d = CurEntries;
  1449. X     while(d->next) d = d->next;
  1450. X     d->next = c;
  1451. X      }
  1452. X   }
  1453. X   for(; CurDay<=days; CurDay++) {
  1454. X      WriteCalEntry();
  1455. X      WkDayNum = (WkDayNum + 1) % 7;
  1456. X   }
  1457. X
  1458. X/* If wkday < 2, set ysmall.  If necessary (only for feb) increase cal size. */
  1459. X   if (wkday < 2 && !NoSmallCal) {
  1460. X      smallcol = 5;
  1461. X      printf("/ysmall ylast def\n");
  1462. X      if (days == 28 && wkday == 0) {
  1463. X         printf("/ysmall ymin def /ymin ysmall MinBoxSize sub def\n");
  1464. X     printf("MinX ymin MaxX ymin L\n");
  1465. X      }
  1466. X   }
  1467. X       
  1468. X
  1469. X/* Now draw the vertical lines */
  1470. X   for (i=0; i<=7; i++) {
  1471. X      printf("%d xincr mul MinX add ymin %d xincr mul MinX add topy L\n",
  1472. X              i, i);
  1473. X   }
  1474. X
  1475. X/* print the small calendars */
  1476. X   if (!NoSmallCal) {
  1477. X      sfirst = wkday - (prevdays % 7);
  1478. X      if (sfirst < 0) sfirst += 7;
  1479. X      DoSmallCal(prevm, prevdays, sfirst, smallcol);
  1480. X      sfirst = wkday + (days % 7);
  1481. X      if (sfirst >6) sfirst -= 7;
  1482. X      DoSmallCal(nextm, nextdays, sfirst, smallcol+1);
  1483. X   }
  1484. X/* Do it! */
  1485. X   printf("showpage\n");
  1486. X}
  1487. X
  1488. X/***************************************************************/
  1489. X/*                                                             */
  1490. X/*  WriteProlog - write the PostScript prologue                */
  1491. X/*                                                             */
  1492. X/***************************************************************/
  1493. X#ifdef HAVE_PROTOS
  1494. Xvoid WriteProlog(void)
  1495. X#else
  1496. Xvoid WriteProlog()
  1497. X#endif
  1498. X{
  1499. X   int i;
  1500. X   int x = CurPage->xsize;
  1501. X   int y = CurPage->ysize;
  1502. X
  1503. X   if (!PortraitMode) {
  1504. X      i = x; x = y; y = i;
  1505. X   }
  1506. X
  1507. X/* Write the document structuring stuff */
  1508. X   printf("%%!PS-Adobe-\n");
  1509. X   printf("%%%%DocumentFonts: %s", HeadFont);
  1510. X   if (strcmp(HeadFont, DayFont)) printf(" %s", DayFont);
  1511. X   if (strcmp(EntryFont, HeadFont) &&
  1512. X       strcmp(EntryFont, DayFont)) printf(" %s", EntryFont);
  1513. X   if (!NoSmallCal && strcmp(SmallFont, HeadFont) &&
  1514. X       strcmp(SmallFont, DayFont)  &&
  1515. X       strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
  1516. X   putchar('\n');
  1517. X   printf("%%%%Creator: Rem2PS\n");
  1518. X   printf("%%%%Pages: (atend)\n");
  1519. X   printf("%%%%EndComments\n");
  1520. X   for (i=0; PSProlog[i]; i++) puts(PSProlog[i]);
  1521. X   printf("/HeadFont /%s def\n", HeadFont);
  1522. X   if (!NoSmallCal) printf("/SmallFont /%s def\n", SmallFont);
  1523. X   printf("/DayFont /%s def\n", DayFont);
  1524. X   printf("/EntryFont /%s def\n", EntryFont);
  1525. X   printf("/HeadSize %s def\n", HeadSize);
  1526. X   printf("/DaySize %s def\n", DaySize);
  1527. X   printf("/EntrySize %s def\n", EntrySize);
  1528. X   printf("/XSIZE %d def\n", CurPage->xsize);
  1529. X   printf("/MinX 36 def\n");
  1530. X   printf("/MinY 36 def\n");
  1531. X   printf("/MaxX %d def\n", x-36);
  1532. X   printf("/MaxY %d def\n", y-36);
  1533. X   printf("/Border %s def\n", BorderSize);
  1534. X   printf("%s setlinewidth\n", LineWidth);
  1535. X
  1536. X/* Check if smallfont is fixed pitch */
  1537. X   if (!NoSmallCal) {
  1538. X      printf("SmallFont findfont /FontInfo get /isFixedPitch get\n");
  1539. X
  1540. X/* Define SmallString used to set smallfont size */
  1541. X      printf("{/SmallString (WW ) def}\n");
  1542. X      printf("{/SmallString (WW) def}\nifelse\n");
  1543. X   }
  1544. X   printf("%%%%EndProlog\n");
  1545. X/* Set the minimum box size */
  1546. X
  1547. X}
  1548. X
  1549. X/***************************************************************/
  1550. X/*                                                             */
  1551. X/*  WriteCalEntry - write all entries for one day              */
  1552. X/*                                                             */
  1553. X/***************************************************************/
  1554. X#ifdef HAVE_PROTOS
  1555. Xvoid WriteCalEntry(void)
  1556. X#else
  1557. Xvoid WriteCalEntry()
  1558. X#endif
  1559. X{
  1560. X   CalEntry *c = CurEntries;
  1561. X   CalEntry *d;
  1562. X
  1563. X/* Move to appropriate location */
  1564. X   printf("Border ytop %d xincr mul MinX add xincr\n", WkDayNum);
  1565. X
  1566. X/* Set up the text array */
  1567. X   printf("[\n");
  1568. X
  1569. X   CurEntries = NULL;
  1570. X
  1571. X   while(c) {
  1572. X      WriteOneEntry(c->entry);
  1573. X      free(c->entry);
  1574. X      d = c->next;
  1575. X      free(c);
  1576. X      c = d;
  1577. X   }
  1578. X   printf("]\n");
  1579. X
  1580. X/* Print the day number */
  1581. X   printf("(%d)\n", CurDay);
  1582. X/* Do it! */
  1583. X   printf("DoCalBox\n");
  1584. X
  1585. X/* Update ymin */
  1586. X   printf("/y exch def y ymin lt {/ymin y def} if\n");
  1587. X
  1588. X/* If WkDayNum is a Sunday, move to next row. */
  1589. X   if (WkDayNum == 6 || CurDay == MaxDay) {
  1590. X      printf("/y ytop MinBoxSize sub def y ymin lt {/ymin y def} if\n");
  1591. X
  1592. X/* Draw the line at the bottom of the row */
  1593. X      printf("MinX ymin MaxX ymin L\n");
  1594. X
  1595. X/* Update ytop */
  1596. X      printf("/ylast ytop def\n");
  1597. X      printf("/ytop ymin def\n");
  1598. X   }
  1599. X}
  1600. X
  1601. X/***************************************************************/
  1602. X/*                                                             */
  1603. X/*  WriteOneEntry - write an entry for one day                 */
  1604. X/*                                                             */
  1605. X/***************************************************************/
  1606. X#ifdef HAVE_PROTOS
  1607. Xvoid WriteOneEntry(char *s)
  1608. X#else
  1609. Xvoid WriteOneEntry(s)
  1610. Xchar *s;
  1611. X#endif
  1612. X{
  1613. X   int c;
  1614. X   printf("  [");
  1615. X
  1616. X/* Chew up leading spaces */
  1617. X   while(isspace(*s)) s++;
  1618. X
  1619. X   putchar('(');
  1620. X   while(*s) {
  1621. X      c = *s++;
  1622. X      if (c == '\\' || c == '(' || c == ')') putchar('\\');
  1623. X      if (!isspace(c)) putchar(c);
  1624. X      else {
  1625. X         putchar(')');
  1626. X         while(isspace(*s)) s++;
  1627. X     if (!*s) {
  1628. X            printf("]\n");
  1629. X        return;
  1630. X         }
  1631. X         putchar('(');
  1632. X      }
  1633. X   }
  1634. X   printf(")]\n");
  1635. X}
  1636. X
  1637. X/***************************************************************/
  1638. X/*                                                             */
  1639. X/*  Init - set up parameters                                   */
  1640. X/*                                                             */
  1641. X/***************************************************************/
  1642. X#ifdef HAVE_PROTOS
  1643. XPUBLIC void Init(int argc, char *argv[])
  1644. X#else
  1645. Xvoid Init(argc, argv)
  1646. Xint argc;
  1647. Xchar *argv[];
  1648. X#endif
  1649. X{
  1650. X   char *s, *t;
  1651. X   int i=1;
  1652. X   int j;
  1653. X
  1654. X   PortraitMode = 1;
  1655. X   NoSmallCal = 0;
  1656. X
  1657. X   CurPage = Pages;  /* Letter size by default */
  1658. X
  1659. X   while (i < argc) {
  1660. X      s = argv[i];
  1661. X      i++;
  1662. X
  1663. X      if (*s++ != '-') Usage("Options must begin with '-'");
  1664. X
  1665. X      switch(*s++) {
  1666. X         case 's':
  1667. X        if (i == argc) Usage("Size must be supplied");
  1668. X        t = argv[i++];
  1669. X        while(*s) {
  1670. X           switch(*s++) {
  1671. X              case 'h': HeadSize = t; break;
  1672. X          case 'e': EntrySize = t; break;
  1673. X          case 'd': DaySize = t; break;
  1674. X                  default: Usage("Size must specify h, e, or d");        
  1675. X           }
  1676. X            }
  1677. X        break;
  1678. X
  1679. X         case 'f':
  1680. X        if (i == argc) Usage("Font must be supplied");
  1681. X        t = argv[i++];
  1682. X        while(*s) {
  1683. X           switch(*s++) {
  1684. X              case 'h': HeadFont = t; break;
  1685. X          case 'e': EntryFont = t; break;
  1686. X          case 'd': DayFont = t; break;
  1687. X          case 's': SmallFont = t; break;
  1688. X                  default: Usage("Font must specify s, h, e, or d");        
  1689. X           }
  1690. X            }
  1691. X        break;
  1692. X
  1693. X         case 'm':
  1694. X        if (i == argc) Usage("Media must be supplied");
  1695. X        t = argv[i++];
  1696. X        CurPage = NULL;
  1697. X        for (j=0; j<NUMPAGES; j++)
  1698. X           if (!strcmp(t, Pages[j].name)) {
  1699. X              CurPage = &Pages[j]; 
  1700. X          break;
  1701. X               }
  1702. X
  1703. X        if (!CurPage) {
  1704. X           fprintf(stderr, "\nUnknown media specified.\n");
  1705. X               fprintf(stderr, "\nAvailable media types:\n");
  1706. X               for (j=0; j<NUMPAGES; j++)
  1707. X              fprintf(stderr, "   %s\n", Pages[j].name);
  1708. X           exit(1);
  1709. X            }
  1710. X        break;
  1711. X
  1712. X         case 'b':
  1713. X        if (i == argc) Usage("Border must be supplied");
  1714. X        BorderSize = argv[i++];
  1715. X        break;
  1716. X
  1717. X         case 't':
  1718. X        if (i == argc) Usage("Line thickness must be supplied");
  1719. X        LineWidth = argv[i++];
  1720. X        break;
  1721. X
  1722. X     case 'l': PortraitMode = 0; break;
  1723. X
  1724. X     case 'c': NoSmallCal = 1; break;
  1725. X
  1726. X     default: Usage("Unrecognized option");
  1727. X      }
  1728. X   }
  1729. X}
  1730. X
  1731. X/***************************************************************/
  1732. X/*                                                             */
  1733. X/*  Usage - print usage information                            */
  1734. X/*                                                             */
  1735. X/***************************************************************/
  1736. X#ifdef HAVE_PROTOS
  1737. XPUBLIC void Usage(char *s)
  1738. X#else
  1739. Xvoid Usage(s)
  1740. Xchar *s;
  1741. X#endif
  1742. X{
  1743. X   if (s) fprintf(stderr, "\nrem2ps: %s\n\n", s);
  1744. X
  1745. X   fprintf(stderr, "Rem2PS: Produce a PostScript calendar from output of Remind.\n\n");
  1746. X   fprintf(stderr, "Usage: rem2ps [options]\n\n");
  1747. X   fprintf(stderr, "Options:\n\n");
  1748. X   fprintf(stderr, "-l            Do calendar in landscape mode.\n");
  1749. X   fprintf(stderr, "-c            Do NOT generate small calendars for previous\n");
  1750. X   fprintf(stderr, "              and next month.\n");
  1751. X   fprintf(stderr, "-m media      Set page size (eg, Letter, Legal, A4.)  Case sensitive!\n");
  1752. X   fprintf(stderr, "-f[shed] font Set font for small cal, hdr, cal entries and/or day numbers.\n");
  1753. X   fprintf(stderr, "-s[hed] size  Set size for header, calendar entries and/or day numbers.\n");
  1754. X   fprintf(stderr, "-b size       Set border size for calendar entries.\n");
  1755. X   fprintf(stderr, "-t size       Set line thickness.\n");
  1756. X   exit(1);
  1757. X}
  1758. X
  1759. X/***************************************************************/
  1760. X/*                                                             */
  1761. X/*  DoSmallCal - do the small calendar for previous or next    */
  1762. X/*  month.                                                     */
  1763. X/*                                                             */
  1764. X/***************************************************************/
  1765. X#ifdef HAVE_PROTOS
  1766. Xvoid DoSmallCal(char *m, int days, int first, int col)
  1767. X#else
  1768. Xvoid DoSmallCal(m, days, first, col)
  1769. Xchar *m;
  1770. Xint days, first, col;
  1771. X#endif
  1772. X{
  1773. X   /* Do the small calendar */
  1774. X   int i;
  1775. X   int row = 2;
  1776. X
  1777. X   /* Figure out the font size */
  1778. X
  1779. X   printf("/SmallFontSize MinBoxSize Border sub Border sub 8 div 2 sub def\n");
  1780. X   printf("SmallFont findfont setfont\n");
  1781. X   printf("SmallString stringwidth pop /SmallWidth exch def\n");
  1782. X   printf("SmallWidth 7 mul xincr Border sub Border sub exch div /tmp exch def\n");
  1783. X   printf("tmp SmallFontSize lt {/SmallFontSize tmp def} if\n");
  1784. X   printf("SmallFont findfont SmallFontSize scalefont setfont\n");
  1785. X
  1786. X   /* Recalculate SmallWidth */
  1787. X   printf("SmallString stringwidth pop /SmallWidth exch def\n");
  1788. X
  1789. X   /* Save graphics state */
  1790. X   printf("gsave\n");
  1791. X
  1792. X   /* Move origin to upper-left hand corner of appropriate box */
  1793. X   printf("%d xincr mul MinX add ysmall translate\n", col);
  1794. X
  1795. X   /* Print the month */   
  1796. X   printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
  1797. X
  1798. X   /* Print the days of the week */
  1799. X   for (i=0; i<7; i++)
  1800. X      printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, Days[i]);
  1801. X
  1802. X   /* Now do the days of the month */
  1803. X   for (i=1; i<=days; i++) {
  1804. X      printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize 2 add %d mul sub moveto (%d) show\n", first, row, i);
  1805. X      first++;
  1806. X      if (first == 7) { first = 0; row++; }
  1807. X   }
  1808. X
  1809. X   /* restore graphics state */
  1810. X   printf("grestore\n");
  1811. X}
  1812. X
  1813. END_OF_FILE
  1814.   if test 16502 -ne `wc -c <'rem2ps.c'`; then
  1815.     echo shar: \"'rem2ps.c'\" unpacked with wrong size!
  1816.   fi
  1817.   # end of 'rem2ps.c'
  1818. fi
  1819. if test -f 'remind.def' -a "${1}" != "-c" ; then 
  1820.   echo shar: Will not clobber existing file \"'remind.def'\"
  1821. else
  1822.   echo shar: Extracting \"'remind.def'\" \(27 characters\)
  1823.   sed "s/^X//" >'remind.def' <<'END_OF_FILE'
  1824. XNAME WINDOWCOMPAT NEWFILES
  1825. END_OF_FILE
  1826.   if test 27 -ne `wc -c <'remind.def'`; then
  1827.     echo shar: \"'remind.def'\" unpacked with wrong size!
  1828.   fi
  1829.   # end of 'remind.def'
  1830. fi
  1831. echo shar: End of archive 1 \(of 2\).
  1832. cp /dev/null ark1isdone
  1833. MISSING=""
  1834. for I in 1 2 ; do
  1835.     if test ! -f ark${I}isdone ; then
  1836.     MISSING="${MISSING} ${I}"
  1837.     fi
  1838. done
  1839. if test "${MISSING}" = "" ; then
  1840.     echo You have unpacked both archives.
  1841.     rm -f ark[1-9]isdone
  1842. else
  1843.     echo You still must unpack the following archives:
  1844.     echo "        " ${MISSING}
  1845. fi
  1846. exit 0
  1847. exit 0 # Just in case...
  1848.