home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume39 / remind / patch09c / patch.09.D < prev   
Encoding:
Text File  |  1993-10-04  |  41.1 KB  |  1,205 lines

  1.          strcmp(SmallFont, DayFont)  &&
  2.          strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
  3.      putchar('\n');
  4.      printf("%%%%Creator: Rem2PS\n");
  5. --- 326,340 ----
  6.   /* Write the document structuring stuff */
  7.      printf("%%!PS-Adobe-\n");
  8.      printf("%%%%DocumentFonts: %s", HeadFont);
  9. !    if (strcmp(TitleFont, HeadFont)) printf(" %s", TitleFont);
  10. !    if (strcmp(TitleFont, DayFont) &&
  11. !        strcmp(HeadFont, DayFont)) printf(" %s", DayFont);
  12.      if (strcmp(EntryFont, HeadFont) &&
  13. +        strcmp(TitleFont, EntryFont) &&
  14.          strcmp(EntryFont, DayFont)) printf(" %s", EntryFont);
  15.      if (!NoSmallCal && strcmp(SmallFont, HeadFont) &&
  16.          strcmp(SmallFont, DayFont)  &&
  17. +        strcmp(TitleFont, SmallFont) &&
  18.          strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
  19.      putchar('\n');
  20.      printf("%%%%Creator: Rem2PS\n");
  21. ***************
  22. *** 335,343 ****
  23.      printf("%%%%EndComments\n");
  24.   
  25.      for (i=0; PSProlog1[i]; i++) puts(PSProlog1[i]);
  26. !    printf("[(%s) (%s) (%s) (%s) (%s) (%s) (%s)]\n",
  27. !       L_SUNDAY, L_MONDAY, L_TUESDAY, L_WEDNESDAY,
  28. !       L_THURSDAY, L_FRIDAY, L_SATURDAY);
  29.      for (i=0; PSProlog2[i]; i++) puts(PSProlog2[i]);
  30.   
  31.      printf("/HeadFont /%s %s\n", HeadFont, isostuff);
  32. --- 343,356 ----
  33.      printf("%%%%EndComments\n");
  34.   
  35.      for (i=0; PSProlog1[i]; i++) puts(PSProlog1[i]);
  36. !    if (!MondayFirst)
  37. !       printf("[(%s) (%s) (%s) (%s) (%s) (%s) (%s)]\n",
  38. !          L_SUNDAY, L_MONDAY, L_TUESDAY, L_WEDNESDAY,
  39. !          L_THURSDAY, L_FRIDAY, L_SATURDAY);
  40. !    else
  41. !       printf("[(%s) (%s) (%s) (%s) (%s) (%s) (%s)]\n",
  42. !          L_MONDAY, L_TUESDAY, L_WEDNESDAY,
  43. !          L_THURSDAY, L_FRIDAY, L_SATURDAY, L_SUNDAY);
  44.      for (i=0; PSProlog2[i]; i++) puts(PSProlog2[i]);
  45.   
  46.      printf("/HeadFont /%s %s\n", HeadFont, isostuff);
  47. ***************
  48. *** 344,352 ****
  49. --- 357,367 ----
  50.      if (!NoSmallCal) printf("/SmallFont /%s %s\n", SmallFont, isostuff);
  51.      printf("/DayFont /%s %s\n", DayFont, isostuff);
  52.      printf("/EntryFont /%s %s\n", EntryFont, isostuff);
  53. +    printf("/TitleFont /%s %s\n", TitleFont, isostuff);
  54.      printf("/HeadSize %s def\n", HeadSize);
  55.      printf("/DaySize %s def\n", DaySize);
  56.      printf("/EntrySize %s def\n", EntrySize);
  57. +    printf("/TitleSize %s def\n", TitleSize);
  58.      printf("/XSIZE %d def\n", CurPage->xsize);
  59.      printf("/MinX %d def\n", LeftMarg);
  60.      printf("/MinY %d def\n", BotMarg);
  61. ***************
  62. *** 402,408 ****
  63.   
  64.   /* Move to appropriate location */
  65.      printf("/CAL%d {\n", CurDay);
  66. !    printf("Border ytop %d xincr mul MinX add xincr\n", WkDayNum);
  67.   
  68.   /* Set up the text array */
  69.      printf("[\n");
  70. --- 417,426 ----
  71.   
  72.   /* Move to appropriate location */
  73.      printf("/CAL%d {\n", CurDay);
  74. !    if (!MondayFirst)
  75. !       printf("Border ytop %d xincr mul MinX add xincr\n", WkDayNum);
  76. !    else
  77. !       printf("Border ytop %d xincr mul MinX add xincr\n", (WkDayNum ? WkDayNum-1 : 6));
  78.   
  79.   /* Set up the text array */
  80.      printf("[\n");
  81. ***************
  82. *** 427,437 ****
  83.      printf("/y exch def y ymin lt {/ymin y def} if\n");
  84.      printf("} def\n");
  85.   
  86. ! /* If WkDayNum is a Sunday, move to next row.  Also handle the queued
  87. !    PS and PSFILE reminders */
  88. !    if (WkDayNum == 6 || CurDay == MaxDay) {
  89.         HadQPS = 0;
  90. !       begin = CurDay - WkDayNum;
  91.         if (begin < 1) begin = 1;
  92.         end = CurDay;
  93.         for (i=begin; i<=end; i++) {
  94. --- 445,457 ----
  95.      printf("/y exch def y ymin lt {/ymin y def} if\n");
  96.      printf("} def\n");
  97.   
  98. ! /* If WkDayNum is a Sunday or Monday, depending on MondayFirst,
  99. !    move to next row.  Also handle the queued PS and PSFILE reminders */
  100. !    if ((!MondayFirst && WkDayNum == 6) ||
  101. !         (MondayFirst && WkDayNum == 0) || CurDay == MaxDay) {
  102.         HadQPS = 0;
  103. !       if (MondayFirst) begin =  CurDay - (WkDayNum ? WkDayNum-1 : 6);
  104. !       else             begin = CurDay - WkDayNum;
  105.         if (begin < 1) begin = 1;
  106.         end = CurDay;
  107.         for (i=begin; i<=end; i++) {
  108. ***************
  109. *** 533,538 ****
  110. --- 553,560 ----
  111.      BotMarg = 36;
  112.      UseISO = 0;
  113.      FillPage = 0;
  114. +    MondayFirst = 0;
  115. +    SmallLocation = "bt";
  116.   
  117.      for(j=0; j<32; j++) PsEntries[i] = NULL;
  118.   
  119. ***************
  120. *** 545,550 ****
  121. --- 567,577 ----
  122.         if (*s++ != '-') Usage("Options must begin with '-'");
  123.   
  124.         switch(*s++) {
  125. +          case 'n':
  126. +         MondayFirst = 1;
  127. +         break;
  128.            case 'p':
  129.           if (i == argc) Usage("Prologue filename must be supplied");
  130.           UserProlog = argv[i++];
  131. ***************
  132. *** 558,564 ****
  133.                 case 'h': HeadSize = t; break;
  134.             case 'e': EntrySize = t; break;
  135.             case 'd': DaySize = t; break;
  136. !                   default: Usage("Size must specify h, e, or d");        
  137.              }
  138.               }
  139.           break;
  140. --- 585,592 ----
  141.                 case 'h': HeadSize = t; break;
  142.             case 'e': EntrySize = t; break;
  143.             case 'd': DaySize = t; break;
  144. !           case 't': TitleSize = t; break;
  145. !                   default: Usage("Size must specify h, t, e, or d");        
  146.              }
  147.               }
  148.           break;
  149. ***************
  150. *** 572,578 ****
  151.             case 'e': EntryFont = t; break;
  152.             case 'd': DayFont = t; break;
  153.             case 's': SmallFont = t; break;
  154. !                   default: Usage("Font must specify s, h, e, or d");        
  155.              }
  156.               }
  157.           break;
  158. --- 600,607 ----
  159.             case 'e': EntryFont = t; break;
  160.             case 'd': DayFont = t; break;
  161.             case 's': SmallFont = t; break;
  162. !           case 't': TitleFont = t; break;
  163. !                   default: Usage("Font must specify s, h, t, e, or d");        
  164.              }
  165.               }
  166.           break;
  167. ***************
  168. *** 627,633 ****
  169.   
  170.        case 'i': UseISO = 1; break;
  171.   
  172. !      case 'c': NoSmallCal = 1; break;
  173.   
  174.        case 'e': FillPage = 1; break;
  175.   
  176. --- 656,673 ----
  177.   
  178.        case 'i': UseISO = 1; break;
  179.   
  180. !      case 'c': j=(*s);
  181. !                if (!j) {
  182. !               SmallLocation = SmallCalLoc[0];
  183. !                    } else {
  184. !               j -= '0';
  185. !               if (j>=0 && j<NUMSMALL) {
  186. !                  SmallLocation = SmallCalLoc[j];
  187. !               } else {
  188. !                  SmallLocation = SmallCalLoc[0];
  189. !                       }
  190. !                    }
  191. !            break;
  192.   
  193.        case 'e': FillPage = 1; break;
  194.   
  195. ***************
  196. *** 655,671 ****
  197.      fprintf(stderr, "Options:\n\n");
  198.      fprintf(stderr, "-p file       Include user-supplied PostScript code in prologue\n");
  199.      fprintf(stderr, "-l            Do calendar in landscape mode\n");
  200. !    fprintf(stderr, "-c            Do NOT generate small calendars for previous\n");
  201.      fprintf(stderr, "              and next month\n");
  202.      fprintf(stderr, "-i            Use ISO 8859-1 encoding in PostScript output\n");
  203.      fprintf(stderr, "-m media      Set page size (eg, Letter, Legal, A4.)  Case sensitive!\n");
  204.      fprintf(stderr, "              (Default page size is %s)\n", DefaultPage[0].name);
  205. !    fprintf(stderr, "-f[shed] font Set font for small cal, hdr, cal entries and/or day numbers\n");
  206. !    fprintf(stderr, "-s[hed] size  Set size for header, calendar entries and/or day numbers\n");
  207.      fprintf(stderr, "-b size       Set border size for calendar entries\n");
  208.      fprintf(stderr, "-t size       Set line thickness\n");
  209.      fprintf(stderr, "-e            Make calendar fill entire page\n");
  210.      fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n");
  211.      exit(1);
  212.   }
  213.   
  214. --- 695,712 ----
  215.      fprintf(stderr, "Options:\n\n");
  216.      fprintf(stderr, "-p file       Include user-supplied PostScript code in prologue\n");
  217.      fprintf(stderr, "-l            Do calendar in landscape mode\n");
  218. !    fprintf(stderr, "-c[n]         Control small calendars: 0=none; 1=bt; 2=tb; 3=sbt\n");
  219.      fprintf(stderr, "              and next month\n");
  220.      fprintf(stderr, "-i            Use ISO 8859-1 encoding in PostScript output\n");
  221.      fprintf(stderr, "-m media      Set page size (eg, Letter, Legal, A4.)  Case sensitive!\n");
  222.      fprintf(stderr, "              (Default page size is %s)\n", DefaultPage[0].name);
  223. !    fprintf(stderr, "-f[shted] font Set font for small cal, hdr, title, cal entries, day numbers\n");
  224. !    fprintf(stderr, "-s[hted] size Set size for header, title, calendar entries and/or day numbers\n");
  225.      fprintf(stderr, "-b size       Set border size for calendar entries\n");
  226.      fprintf(stderr, "-t size       Set line thickness\n");
  227.      fprintf(stderr, "-e            Make calendar fill entire page\n");
  228.      fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n");
  229. +    fprintf(stderr, "-n            Start calendar with Monday rather than Sunday\n");
  230.      exit(1);
  231.   }
  232.   
  233. ***************
  234. *** 676,692 ****
  235.   /*                                                             */
  236.   /***************************************************************/
  237.   #ifdef HAVE_PROTOS
  238. ! void DoSmallCal(char *m, int days, int first, int col)
  239.   #else
  240. ! void DoSmallCal(m, days, first, col)
  241.   char *m;
  242.   int days, first, col;
  243.   #endif
  244.   {
  245.      /* Do the small calendar */
  246. !    int i;
  247.      int row = 2;
  248.   
  249.      /* Figure out the font size */
  250.   
  251.      printf("/SmallFontSize MinBoxSize Border sub Border sub 8 div 2 sub def\n");
  252. --- 717,737 ----
  253.   /*                                                             */
  254.   /***************************************************************/
  255.   #ifdef HAVE_PROTOS
  256. ! void DoSmallCal(char *m, int days, int first, int col, int which)
  257.   #else
  258. ! void DoSmallCal(m, days, first, col, which)
  259.   char *m;
  260.   int days, first, col;
  261.   #endif
  262.   {
  263.      /* Do the small calendar */
  264. !    int i, j;
  265.      int row = 2;
  266.   
  267. +    if (MondayFirst) {
  268. +       first--;
  269. +       if (first < 0) first = 6;
  270. +    }
  271.      /* Figure out the font size */
  272.   
  273.      printf("/SmallFontSize MinBoxSize Border sub Border sub 8 div 2 sub def\n");
  274. ***************
  275. *** 703,716 ****
  276.      printf("gsave\n");
  277.   
  278.      /* Move origin to upper-left hand corner of appropriate box */
  279. !    printf("%d xincr mul MinX add ysmall translate\n", col);
  280.   
  281.      /* Print the month */   
  282.      printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
  283.   
  284.      /* Print the days of the week */
  285. !    for (i=0; i<7; i++)
  286. !       printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, Days[i]);
  287.   
  288.      /* Now do the days of the month */
  289.      for (i=1; i<=days; i++) {
  290. --- 748,764 ----
  291.      printf("gsave\n");
  292.   
  293.      /* Move origin to upper-left hand corner of appropriate box */
  294. !    printf("%d xincr mul MinX add ysmall%d translate\n", col, which);
  295.   
  296.      /* Print the month */   
  297.      printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
  298.   
  299.      /* Print the days of the week */
  300. !    for (i=0; i<7; i++) {
  301. !       if (MondayFirst) j=(i+1)%7;
  302. !       else             j=i;
  303. !       printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, Days[j]);
  304. !    }
  305.   
  306.      /* Now do the days of the month */
  307.      for (i=1; i<=days; i++) {
  308. ***************
  309. *** 744,750 ****
  310.      int fnoff;
  311.      char buffer[LINELEN];
  312.   
  313. !    begin = CurDay - WkDayNum;
  314.      wd = 0;
  315.      while (begin < 1) begin++, wd++;
  316.      end = CurDay;
  317. --- 792,799 ----
  318.      int fnoff;
  319.      char buffer[LINELEN];
  320.   
  321. !    if (!MondayFirst) begin = CurDay - WkDayNum;
  322. !    else             begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
  323.      wd = 0;
  324.      while (begin < 1) begin++, wd++;
  325.      end = CurDay;
  326. ***************
  327. *** 795,797 ****
  328. --- 844,916 ----
  329.      }
  330.      return HadPS;
  331.   }
  332. + /***************************************************************/
  333. + /*                                                             */
  334. + /* GetSmallLocations                                           */
  335. + /*                                                             */
  336. + /* Set up the locations for the small calendars.               */
  337. + /*                                                             */
  338. + /***************************************************************/
  339. + #ifdef HAVE_PROTOS
  340. + PUBLIC void GetSmallLocations(void)
  341. + #else
  342. + void GetSmallLocations()
  343. + #endif
  344. + {
  345. +    char c;
  346. +    char *s = SmallLocation;
  347. +    int colfirst, collast;
  348. + /* Figure out the first and last columns */
  349. +    colfirst = FirstWkDay;
  350. +    collast = (FirstWkDay+MaxDay-1) % 7;
  351. +    if (MondayFirst) {
  352. +       colfirst = colfirst ? colfirst - 1 : 6;
  353. +       collast = collast ? collast - 1 : 6;
  354. +    }
  355. +    NoSmallCal = 0;
  356. +    while((c = *s++) != 0) {
  357. +       switch(c) {
  358. +          case 'b':
  359. +         /* Adjust Feb. if we want it on the bottom */
  360. +         if (MaxDay == 28 && colfirst == 0) { 
  361. +            printf("/ysmallbot ymin def /ymin ysmallbot MinBoxSize sub def\n");
  362. +            printf("MinX ymin MaxX ymin L\n");
  363. +            printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
  364. +            SmallCol1 = 5;
  365. +            SmallCol2 = 6;
  366. +            return;
  367. +             }
  368. +         if (collast <= 4) {
  369. +            printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
  370. +            SmallCol1 = 5;
  371. +            SmallCol2 = 6;
  372. +            return;
  373. +         }
  374. +         break;
  375. +      case 't':
  376. +         if (colfirst >= 2) {
  377. +            printf("/ysmall1 ysmalltop def /ysmall2 ysmalltop def\n");
  378. +            SmallCol1 = 0;
  379. +            SmallCol2 = 1;
  380. +            return;
  381. +         }
  382. +         break;
  383. +      case 's':
  384. +         if (colfirst >= 1 && collast<=5) {
  385. +            printf("/ysmall1 ysmalltop def /ysmall2 ysmallbot def\n");
  386. +            SmallCol1 = 0;
  387. +            SmallCol2 = 6;
  388. +            return;
  389. +         }
  390. +         break;
  391. +       }
  392. +    }
  393. +    NoSmallCal = 1;
  394. +    return;
  395. + }
  396. +            
  397. *** ../prev/rem2ps.h    Mon Jun 28 12:30:22 1993
  398. --- ./rem2ps.h    Tue Sep 28 16:53:52 1993
  399. ***************
  400. *** 64,80 ****
  401.      "/doheading",
  402.      "{",
  403.      "   /monthyr exch def",
  404. !    "   ",
  405. !    "   /HeadFont findfont",
  406. !    "   HeadSize scalefont setfont   ",
  407.      "   monthyr stringwidth",
  408. !    "   pop",
  409.      "   2 div MaxX MinX add 2 div exch sub /x exch def",
  410. !    "   MaxY HeadSize 1.5 mul sub /y exch def",
  411.      "   newpath x y moveto monthyr show",
  412. !    "   y HeadSize 0.5 mul sub /y exch def",
  413.      "   MinX y MaxX y L",
  414.      "   /topy y def",
  415.      "% Do the days of the week",
  416.      "   MaxX MinX sub 7 div /xincr exch def",
  417.      "   /x MinX def",
  418. --- 64,82 ----
  419.      "/doheading",
  420.      "{",
  421.      "   /monthyr exch def",
  422. !    "",
  423. !    "   /TitleFont findfont",
  424. !    "   TitleSize scalefont setfont",
  425.      "   monthyr stringwidth",
  426. !    "   /hgt exch def",
  427.      "   2 div MaxX MinX add 2 div exch sub /x exch def",
  428. !    "   MaxY Border sub TitleSize sub /y exch def",
  429.      "   newpath x y moveto monthyr show",
  430. !    "   newpath x y moveto monthyr false charpath flattenpath pathbbox",
  431. !    "   pop pop Border sub /y exch def pop",
  432.      "   MinX y MaxX y L",
  433.      "   /topy y def",
  434. +    "   /HeadFont findfont HeadSize scalefont setfont",
  435.      "% Do the days of the week",
  436.      "   MaxX MinX sub 7 div /xincr exch def",
  437.      "   /x MinX def",
  438. ***************
  439. *** 143,149 ****
  440.      "   /curline () def",
  441.      "   /len word length def",
  442.      "   /Fcount len 1 sub def",
  443. !    "   ",
  444.      "   {",
  445.      "     word 0 Fcount getinterval stringwidth pop width le",
  446.      "     {exit} if",
  447. --- 145,151 ----
  448.      "   /curline () def",
  449.      "   /len word length def",
  450.      "   /Fcount len 1 sub def",
  451. !    "",
  452.      "   {",
  453.      "     word 0 Fcount getinterval stringwidth pop width le",
  454.      "     {exit} if",
  455. *** ../prev/remind.1    Thu Aug 26 10:58:39 1993
  456. --- ./remind.1    Thu Sep 30 15:25:03 1993
  457. ***************
  458. *** 1,4 ****
  459. ! .TH REMIND 1 "14 April 1993"
  460.   .UC 4
  461.   .SH NAME
  462.   remind \- a sophisticated reminder service
  463. --- 1,4 ----
  464. ! .TH REMIND 1 "30 September 1993"
  465.   .UC 4
  466.   .SH NAME
  467.   remind \- a sophisticated reminder service
  468. ***************
  469. *** 59,64 ****
  470. --- 59,70 ----
  471.   \fBrem2ps\fR program, which creates a PostScript calendar.  For this
  472.   option, \fIn\fR cannot start with "+"; it must specify a number of months.
  473.   .TP
  474. + .B \-m
  475. + The \fB\-m\fR option causes the \fB\-c\fR option to produce a calendar whose
  476. + first column is Monday rather than Sunday.  (This conforms to the international
  477. + standard.)  It does \fInot\fR, however, affect the \fB\-p\fR or \fB\-s\fR
  478. + options.
  479. + .TP
  480.   .B \-v
  481.   The \fB\-v\fR option makes the output of \fBRemind\fR slightly more verbose.
  482.   .TP
  483. ***************
  484. *** 202,207 ****
  485. --- 208,220 ----
  486.   it, rather than the actual system date, as its notion of "today."
  487.   This lets you create calendars for future months, or test to see
  488.   how your reminders will be triggered in the future.
  489. + .PP
  490. + In addition, as part of the \fIdate\fR component, you can supply a
  491. + \fIrepeat\fR parameter, which has the form *\fInum\fR.  This causes
  492. + \fBRemind\fR to be run \fInum\fR times, with the date incrementing
  493. + on each iteration.  You may have to enclose the parameter in quotes
  494. + to avoid shell expansion.  See the subsection "Repeated Execution"
  495. + in the section "Calendar Mode" for more information.
  496.   .SH REMINDER FILES
  497.   .PP
  498.   \fBRemind\fR uses scripts to control its operation.  The commands
  499. ***************
  500. *** 281,287 ****
  501.   reminders - they are \fB$FirstIndent\fR, \fB$SubsIndent\fR and
  502.   \fB$FormWidth\fR.  They are discussed in the section "System Variables."
  503.   The \fBMSF\fR keyword causes the spacing of your reminder to be altered -
  504. ! extra spaces are discarded, and two spaces are placed after periods.
  505.   .PP
  506.   A \fBRUN\fR-type
  507.   reminder also passes the \fIbody\fR through the substitution filter, but
  508. --- 294,306 ----
  509.   reminders - they are \fB$FirstIndent\fR, \fB$SubsIndent\fR and
  510.   \fB$FormWidth\fR.  They are discussed in the section "System Variables."
  511.   The \fBMSF\fR keyword causes the spacing of your reminder to be altered -
  512. ! extra spaces are discarded, and two spaces are placed after periods and
  513. ! other characters, as specified by the system variables \fB$EndSent\fR and
  514. ! \fB$EndSentIg\fR.  Note that if the body of the reminder includes
  515. ! newline characters (placed there with the %_ sequence), then the newlines
  516. ! are treated as the beginnings of new paragraphs, and the \fB$FirstIndent\fR
  517. ! indentation is used for the next line.  You can use two consecutive
  518. ! newlines to have spaced paragraphs emitted from a single reminder body.
  519.   .PP
  520.   A \fBRUN\fR-type
  521.   reminder also passes the \fIbody\fR through the substitution filter, but
  522. ***************
  523. *** 291,297 ****
  524.   .PP
  525.   A \fBPS\fR or \fBPSFILE\fR-type reminder is used to pass PostScript code
  526.   directly to the printer when producing PostScript calendars.  This can
  527. ! be used to shade certain calendar entries, include graphics in the calendar,
  528.   or almost any other purpose you can think of.  You
  529.   should not use these types of reminders unless you are an expert PostScript
  530.   programmer.  The \fBPS\fR and \fBPSFILE\fR reminders are ignored unless
  531. --- 310,317 ----
  532.   .PP
  533.   A \fBPS\fR or \fBPSFILE\fR-type reminder is used to pass PostScript code
  534.   directly to the printer when producing PostScript calendars.  This can
  535. ! be used to shade certain calendar entries (see the psshade() function),
  536. ! include graphics in the calendar,
  537.   or almost any other purpose you can think of.  You
  538.   should not use these types of reminders unless you are an expert PostScript
  539.   programmer.  The \fBPS\fR and \fBPSFILE\fR reminders are ignored unless
  540. ***************
  541. *** 1468,1483 ****
  542.   version 03.00.07 of \fBRemind\fR.
  543.   .PP
  544.   All system variables begin with a dollar sign '$'.  They can be used
  545. ! in \fBSET\fR commands and expressions just as regular variables can.  However,
  546. ! system variables always hold values of type \fBINT\fR.  In addition,
  547. ! some system variables cannot be modified, and you cannot create new
  548. ! system variables.  System variables can be initialized on the command
  549. ! line with the \fB\-i\fR option, but you may need to quote them to avoid
  550. ! having the shell interpret the dollar sign.  System variable names are
  551. ! not case-sensitive.
  552.   .PP
  553.   The following system variables are defined.  Those marked
  554.   "read-only" cannot be changed with the \fBSET\fR command.
  555.   .TP
  556.   .B $CalcUTC 
  557.   If 1 (the default), then \fBRemind\fR uses C library functions
  558. --- 1488,1505 ----
  559.   version 03.00.07 of \fBRemind\fR.
  560.   .PP
  561.   All system variables begin with a dollar sign '$'.  They can be used
  562. ! in \fBSET\fR commands and expressions just as regular variables can.
  563. ! All system variables always hold values of a specified type.  In
  564. ! addition, some system variables cannot be modified, and you cannot
  565. ! create new system variables.  System variables can be initialized on
  566. ! the command line with the \fB\-i\fR option, but you may need to quote
  567. ! them to avoid having the shell interpret the dollar sign.  System
  568. ! variable names are not case-sensitive.
  569.   .PP
  570.   The following system variables are defined.  Those marked
  571.   "read-only" cannot be changed with the \fBSET\fR command.
  572. + All system variables hold values of type \fBINT\fR, unless otherwise
  573. + specified.
  574.   .TP
  575.   .B $CalcUTC 
  576.   If 1 (the default), then \fBRemind\fR uses C library functions
  577. ***************
  578. *** 1506,1511 ****
  579. --- 1528,1556 ----
  580.   If non-zero, then the \fB\-q\fR option was supplied on the command line.
  581.   For the MS-DOS version, always contains 1.
  582.   .TP
  583. + .B $EndSent (STRING type)
  584. + Contains a list of characters which end a sentence.  The \fBMSF\fR
  585. + keyword inserts two spaces after these characters.  Initially,
  586. + \fB$EndSent\fR is set to ".!?" (period, exclamation mark, and
  587. + question mark.)
  588. + .TP
  589. + .B $EndSentIg (STRING type)
  590. + Contains a list of characters which should be ignored when \fBMSF\fR
  591. + decides whether or not to place two spaces after a sentence.  Initially,
  592. + is set to "'>)]}"+CHAR(34) (single-quote, greater-than, right
  593. + parenthesis, right bracket, right brace, and double-quote.)
  594. + .PP
  595. + .RS
  596. + For example, the default values work as follows:
  597. + .PP
  598. + .nf
  599. +     MSF He said, "Huh! (Two spaces will follow this.)"  Yup.
  600. + .fi
  601. + .PP
  602. + because the final parenthesis and quote are ignored (for the purposes
  603. + of spacing) when they follow a period.
  604. + .RE
  605. + .TP
  606.   .B $FirstIndent
  607.   The number of spaces by which to indent the first line of a \fBMSF\fR-type
  608.   reminder.  The default is 0.
  609. ***************
  610. *** 1545,1550 ****
  611. --- 1590,1601 ----
  612.   are positive; southern ones are negative.  For southern latitudes, all
  613.   three components should be negative.
  614.   .TP
  615. + .B $Location (STRING type)
  616. + This is a string specifying the name of your location.  It is usually
  617. + the name of your town or city.  It can be set to whatever you like,
  618. + but good style indicates that it should be kept consistent with
  619. + the latitude and longitude system variables.
  620. + .TP
  621.   .B $LongDeg, $LongMin, $LongSec
  622.   These specify the longitude of your location.  \fB$LongDeg\fR can
  623.   range from -180 to 180.  Western longitudes are positive; eastern
  624. ***************
  625. *** 1907,1912 ****
  626. --- 1958,2005 ----
  627.   Returns an \fBINT\fR from 1 to 12, representing the month component of
  628.   \fIdate\fR.
  629.   .TP
  630. + .B "moondate(i_phase [,d_date [,t_time]])"
  631. + This function returns the date of the first occurrence of the phase
  632. + \fIphase\fR of the moon on or after \fIdate\fR and \fItime\fR.
  633. + \fIPhase\fR can range from 0 to 3, with 0 signifying new moon, 1 first
  634. + quarter, 2 full moon, and 3 third quarter.  If \fIdate\fR is omitted,
  635. + it defaults to \fBtoday()\fR.  If \fItime\fR is omitted, it defaults
  636. + to midnight.
  637. + .RS
  638. + .PP
  639. + For example, the following returns the date of the next full moon:
  640. + .PP
  641. + .nf
  642. +         SET fullmoon moondate(2)
  643. + .fi
  644. + .PP
  645. + .RE
  646. + .TP
  647. + .B "moontime(i_phase [,d_date [,t_time]])"
  648. + This function returns the time of the first occurrence of the phase
  649. + \fIphase\fR of the moon on or after \fIdate\fR and \fItime\fR.
  650. + \fIPhase\fR can range from 0 to 3, with 0 signifying new moon, 1 first
  651. + quarter, 2 full moon, and 3 third quarter.  If \fIdate\fR is omitted,
  652. + it defaults to \fBtoday()\fR.  If \fItime\fR is omitted, it defaults
  653. + to midnight.  \fBMoontime()\fR is intended to be used in conjunction
  654. + with \fBmoondate()\fR.  Don't take the time too seriously - it's only
  655. + accurate to within 15-20 minutes.
  656. + .RS
  657. + .PP
  658. + For example, the following returns the date and time of the next full moon:
  659. + .PP
  660. + .nf
  661. +         MSG Next full moon at [moontime(2)] on [moondate(2)]
  662. + .fi
  663. + .PP
  664. + .RE
  665. + .TP
  666. + .B moonphase([d_date [,t_time]])
  667. + This function returns the phase of the moon on \fIdate\fR and \fItime\fR,
  668. + which default to \fBtoday()\fR and midnight, respectively.  The returned
  669. + value is an integer from 0 to 359, representing the phase of the moon
  670. + in degrees.  0 is a new moon, 180 is a full moon, 90 is first-quarter, etc.
  671. + .TP
  672.   .B now()
  673.   Returns the current system time, as a \fBTIME\fR type.
  674.   .TP
  675. ***************
  676. *** 1931,1936 ****
  677. --- 2024,2064 ----
  678.   \fIstr2\fR otherwise.
  679.   .RE
  680.   .TP
  681. + .B psmoon(i_phase [,i_size])
  682. + Returns a \fBSTRING\fR consisting of PostScript code to draw a moon
  683. + in the upper-left hand corner of the calendar box.  \fIPhase\fR specifies
  684. + the phase of the moon, and is 0 (new moon), 1 (first quarter), 2 (full moon)
  685. + or 3 (third quarter).  If \fIsize\fR is specified, it controls the radius of
  686. + the moon in PostScript units (1/72 inch.)  If it is not specified, the size
  687. + of the day-number font is used.
  688. + .PP
  689. + .RS
  690. + For example, the following four lines place moon symbols on the PostScript
  691. + calendar:
  692. + .PP
  693. + .nf
  694. +         REM [trigger(moondate(0))] PS [psmoon(0)]
  695. +         REM [trigger(moondate(1))] PS [psmoon(1)]
  696. +         REM [trigger(moondate(2))] PS [psmoon(2)]
  697. +         REM [trigger(moondate(3))] PS [psmoon(3)]
  698. + .fi
  699. + .PP
  700. + .RE
  701. + .TP
  702. + .B psshade(i_num)
  703. + Returns a \fBSTRING\fR which consists of PostScript commands to
  704. + shade a calendar box.  \fINum\fR can range from 0 (completely black)
  705. + to 100 (completely white.)  Here's an example of how to use this:
  706. + .RS
  707. + .PP
  708. + .nf
  709. +         REM Sat Sun PS [psshade(95)]
  710. + .fi
  711. + .PP
  712. + The above command emits PostScript code to lightly shade the boxes
  713. + for Saturday and Sunday in a PostScript calendar.
  714. + .RE
  715. + .TP
  716.   .B realtoday()
  717.   Returns the date as provided by the operating system.  This is in contrast to
  718.   \fBRemind\fR's concept of "today", which may be changed if it is running
  719. ***************
  720. *** 2460,2465 ****
  721. --- 2588,2605 ----
  722.   timed reminders are discarded.  If you are in calendar mode
  723.   (described next), then the calendar processing is aborted.
  724.   .PP
  725. + If you supply an \fBINT\fR-type expression after the \fBEXIT\fR command,
  726. + it is returned to the calling program as the exit status.  Otherwise,
  727. + an exit status of 99 is returned.
  728. + .PP
  729. + .B THE FLUSH COMMAND
  730. + .PP
  731. + This command simply consists of the word \fBFLUSH\fR on a line by
  732. + itself.  The command flushes the standard output and standard error
  733. + streams used by \fBRemind\fR.  This is not terribly useful to most
  734. + people, but may be useful if you run \fBRemind\fR as a subprocess of
  735. + another program, and want to use pipes for communication.
  736. + .PP
  737.   .SH CALENDAR MODE
  738.   .PP
  739.   If you supply the \fB\-c\fR, \fB\-s\fR or \fB\-p\fR
  740. ***************
  741. *** 2561,2566 ****
  742. --- 2701,2728 ----
  743.   places the time of timed reminders in the calendar according to the
  744.   \fB\-b\fR command-line option.
  745.   .PP
  746. + .B REPEATED EXECUTION
  747. + .PP
  748. + If you supply a \fIrepeat\fR parameter on the command line,
  749. + and do not use the \fB\-c\fR, \fB\-p\fR, or \fB\-s\fR options, \fBRemind\fR
  750. + operates in a similar manner to calendar mode.  It repeatedly executes
  751. + the reminder script, incrementing \fBtoday()\fR with each iteration.
  752. + The same rules about preserving variables and function definitions
  753. + apply.  Note that using \fIrepeat\fR on the command line also enables
  754. + the \fB\-q\fR option and disables any \fB\-z\fR option.
  755. + As an example, if you want to see how \fBRemind\fR
  756. + will behave for the next week, you can type:
  757. + .PP
  758. + .nf
  759. +     remind .reminders '*7'
  760. + .fi
  761. + .PP
  762. + If you want to print the dates of the next 1000 days, use:
  763. + .PP
  764. + .nf
  765. +     (echo 'banner %'; echo 'msg [today()]%') | remind - '*1000'
  766. + .fi
  767. + .PP
  768.   .SH INITIALIZING VARIABLES ON THE COMMAND LINE
  769.   .PP
  770.   The \fB\-i\fR option is used to initialize variables on the \fBRemind\fR
  771. ***************
  772. *** 2640,2650 ****
  773.   of the regular calendar entry area.  The space from here to the top
  774.   of the box is used only to draw the day number.
  775.   .TP
  776. ! /DayFont, /EntryFont, /SmallFont and /HeadFont
  777.   The fonts used to draw the day numbers, the calendar entries, the small
  778. ! calendars, and the month and day headings, respectively.
  779.   .TP
  780. ! DaySize, EntrySize and HeadSize
  781.   The sizes of the above fonts.  (The size of the small calendar font
  782.   is \fInot\fR defined here.)  For example, if you wanted to print
  783.   the Hebrew date next to the regular day number in the calendar, use:
  784. --- 2802,2813 ----
  785.   of the regular calendar entry area.  The space from here to the top
  786.   of the box is used only to draw the day number.
  787.   .TP
  788. ! /DayFont, /EntryFont, /SmallFont, /TitleFont and /HeadFont
  789.   The fonts used to draw the day numbers, the calendar entries, the small
  790. ! calendars, the calendar title (month, year)
  791. ! and the day-of-the-week headings, respectively.
  792.   .TP
  793. ! DaySize, EntrySize, TitleSize and HeadSize
  794.   The sizes of the above fonts.  (The size of the small calendar font
  795.   is \fInot\fR defined here.)  For example, if you wanted to print
  796.   the Hebrew date next to the regular day number in the calendar, use:
  797. ***************
  798. *** 3144,3150 ****
  799.   versions of \fBRemind\fR prior to 03.00.01.
  800.   .SH AUTHOR
  801.   .PP
  802. ! David F. Skoll
  803.   .SH BUGS
  804.   .PP
  805.   There's no good reason why read-only system variables are not
  806. --- 3307,3316 ----
  807.   versions of \fBRemind\fR prior to 03.00.01.
  808.   .SH AUTHOR
  809.   .PP
  810. ! David F. Skoll wrote \fBRemind\fR.  The moon code was copied largely verbatim
  811. ! from "moontool" by John Walker.  The Hebrew calendar support was taken
  812. ! from "hdate" by Amos Shapir.  The authors of the language files are
  813. ! listed in the header file "lang.h" which comes with \fBRemind\fR.
  814.   .SH BUGS
  815.   .PP
  816.   There's no good reason why read-only system variables are not
  817. *** ../prev/sort.c    Thu Aug 19 16:12:01 1993
  818. --- ./sort.c    Tue Aug 31 16:28:20 1993
  819. ***************
  820. *** 182,187 ****
  821. --- 182,188 ----
  822.         free(cur);
  823.         cur = next;
  824.      }
  825. +    SortedQueue = NULL;
  826.   }
  827.   /***************************************************************/
  828.   /*                                                             */
  829. *** ../prev/test.cmp    Thu Aug 19 17:06:48 1993
  830. --- ./test.cmp    Tue Aug 31 13:22:46 1993
  831. ***************
  832. *** 631,637 ****
  833.   "a05" + "6" => "a056"
  834.   value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  835.   set a058 version()
  836. ! version() => "03.00.08"
  837.   set a059 wkday(today())
  838.   today() => 1991/02/16
  839.   wkday(1991/02/16) => "Saturday"
  840. --- 631,637 ----
  841.   "a05" + "6" => "a056"
  842.   value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  843.   set a058 version()
  844. ! version() => "03.00.09"
  845.   set a059 wkday(today())
  846.   today() => 1991/02/16
  847.   wkday(1991/02/16) => "Saturday"
  848. ***************
  849. *** 772,778 ****
  850.           a048  "foo"
  851.           a067  "INT"
  852.           a039  "February"
  853. !         a058  "03.00.08"
  854.           a077  "1992 92
  855.   "
  856.           a049  21
  857. --- 772,778 ----
  858.           a048  "foo"
  859.           a067  "INT"
  860.           a039  "February"
  861. !         a058  "03.00.09"
  862.           a077  "1992 92
  863.   "
  864.           a049  21
  865. *** ../prev/token.c    Tue Aug  3 12:29:05 1993
  866. --- ./token.c    Fri Sep  3 11:50:53 1993
  867. ***************
  868. *** 57,62 ****
  869. --- 57,63 ----
  870.      { "errmsg",          6,      T_ErrMsg,       0 },
  871.      { "exit",        4,    T_Exit,        0 },
  872.      { "february",     3,     T_Month,    1 },
  873. +    { "flush",        5,    T_Flush,    0 },
  874.      { "friday",         3,    T_WkDay,    4 },
  875.      { "fset",        4,    T_Fset,        0 },
  876.      { "if",        2,    T_If,        0 },
  877. *** ../prev/types.h    Tue Aug  3 12:28:45 1993
  878. --- ./types.h    Fri Sep  3 11:50:48 1993
  879. ***************
  880. *** 126,132 ****
  881.     T_Clr,
  882.     T_Debug,
  883.     T_Dumpvars,
  884. !   T_Scanfrom
  885.   };
  886.   
  887.   /* The structure of a token */
  888. --- 126,133 ----
  889.     T_Clr,
  890.     T_Debug,
  891.     T_Dumpvars,
  892. !   T_Scanfrom,
  893. !   T_Flush
  894.   };
  895.   
  896.   /* The structure of a token */
  897. *** ../prev/var.c    Thu Aug 19 16:40:40 1993
  898. --- ./var.c    Tue Sep 28 16:16:07 1993
  899. ***************
  900. *** 12,17 ****
  901. --- 12,18 ----
  902.   
  903.   #include "config.h"
  904.   #include <stdio.h>
  905. + #include <string.h>
  906.   #ifdef HAVE_STDLIB_H
  907.   #include <stdlib.h>
  908.   #endif
  909. ***************
  910. *** 218,228 ****
  911.      r = EvaluateExpr(p, &v);
  912.      if (r) return r;
  913.   
  914. !    if (*TokBuffer == '$') {
  915. !       if (v.type != INT_TYPE) return E_BAD_TYPE;
  916. !       return SetSysVar(TokBuffer+1, v.v.val);
  917. !    }
  918. !    return SetVar(TokBuffer, &v);
  919.   }
  920.   
  921.   /***************************************************************/
  922. --- 219,226 ----
  923.      r = EvaluateExpr(p, &v);
  924.      if (r) return r;
  925.   
  926. !    if (*TokBuffer == '$') return SetSysVar(TokBuffer+1, &v);
  927. !    else return SetVar(TokBuffer, &v);
  928.   }
  929.   
  930.   /***************************************************************/
  931. ***************
  932. *** 331,343 ****
  933.   /*  DestroyVars                                                */
  934.   /*                                                             */
  935.   /*  Free all the memory used by variables, but don't delete    */
  936. ! /*  preserved variables.                                       */
  937.   /*                                                             */
  938.   /***************************************************************/
  939.   #ifdef HAVE_PROTOS
  940. ! PUBLIC void DestroyVars(void)
  941.   #else
  942. ! void DestroyVars()
  943.   #endif
  944.   {
  945.      int i;
  946. --- 329,342 ----
  947.   /*  DestroyVars                                                */
  948.   /*                                                             */
  949.   /*  Free all the memory used by variables, but don't delete    */
  950. ! /*  preserved variables unless ALL is non-zero.                */
  951.   /*                                                             */
  952.   /***************************************************************/
  953.   #ifdef HAVE_PROTOS
  954. ! PUBLIC void DestroyVars(int all)
  955.   #else
  956. ! void DestroyVars(all)
  957. ! int all;
  958.   #endif
  959.   {
  960.      int i;
  961. ***************
  962. *** 348,354 ****
  963.         VHashTbl[i] = NULL;
  964.         prev = NULL;
  965.         while(v) {
  966. !          if (!v->preserve) {
  967.               DestroyValue(&(v->v));
  968.              next = v->next;
  969.           free(v);
  970. --- 347,353 ----
  971.         VHashTbl[i] = NULL;
  972.         prev = NULL;
  973.         while(v) {
  974. !          if (all || !v->preserve) {
  975.               DestroyValue(&(v->v));
  976.              next = v->next;
  977.           free(v);
  978. ***************
  979. *** 431,472 ****
  980.   typedef struct {
  981.      char *name;
  982.      char modifiable;
  983. !    int *value;   
  984.      int min;
  985.      int max;
  986.   } SysVar;
  987.   
  988. ! #define NO_CONSTRAINT 4532
  989.   /* All of the system variables sorted alphabetically */
  990.   static SysVar SysVarArr[] = {
  991. !        /* name          modifiable    value        min    max */
  992. !    {   "CalcUTC",      1,        &CalculateUTC,    0,    1   },
  993. !    {   "CalMode",      0,        &DoCalendar,    0,    0   },
  994. !    {   "Daemon",      0,        &Daemon,    0,    0   },
  995. !    {   "DontFork",      0,        &DontFork,    0,    0   },
  996. !    {   "DontQueue",      0,        &DontQueue,    0,    0   },
  997. !    {   "DontTrigAts",      0,        &DontIssueAts,    0,    0   },
  998. !    {   "FirstIndent",      1,        &FirstIndent,    0,    132 },
  999. !    {   "FoldYear",      1,        &FoldYear,    0,    1   },
  1000. !    {   "FormWidth",      1,        &FormWidth,    20,    132 },
  1001. !    {   "HushMode",      0,        &Hush,        0,    0   },
  1002. !    {   "IgnoreOnce",      0,        &IgnoreOnce,    0,    0   },
  1003. !    {   "InfDelta",      0,        &InfiniteDelta,    0,    0   },
  1004. !    {   "LatDeg",      1,        &LatDeg,    -90,    90  },
  1005. !    {   "LatMin",      1,        &LatMin,    -59,    59  },
  1006. !    {   "LatSec",      1,        &LatSec,    -59,    59  },
  1007. !    {   "LongDeg",      1,        &LongDeg,    -180,    180  },
  1008. !    {   "LongMin",      1,        &LongMin,    -59,    59  },
  1009. !    {   "LongSec",      1,        &LongSec,    -59,    59  },
  1010. !    {   "MaxSatIter",      1,        &MaxSatIter,    10,    NO_CONSTRAINT },
  1011. !    {   "MinsFromUTC",      1,        &MinsFromUTC,    -13*60,    13*60 },
  1012. !    {   "NextMode",      0,        &NextMode,    0,    0   },
  1013. !    {   "NumQueued",      0,        &NumQueued,    0,    0   },
  1014. !    {   "NumTrig",      0,        &NumTriggered,    0,    0   },
  1015. !    {   "PSCal",          0,        &PsCal,        0,    0   },
  1016. !    {   "RunOff",      0,        &RunDisabled,    0,    0   },
  1017. !    {   "SimpleCal",      0,        &DoSimpleCalendar,    0,  0 },
  1018. !    {   "SubsIndent",      1,        &SubsIndent,    0,    132}
  1019.   };
  1020.   
  1021.   #define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
  1022. --- 430,480 ----
  1023.   typedef struct {
  1024.      char *name;
  1025.      char modifiable;
  1026. !    int type;
  1027. !    void *value;
  1028.      int min;
  1029.      int max;
  1030.   } SysVar;
  1031.   
  1032. ! /* If the type of a sys variable is STR_TYPE, then min is redefined
  1033. !    to be a flag indicating whether or not the value has been malloc'd. */
  1034. ! #define been_malloced min
  1035. ! /* Flag for no min/max constraint */
  1036. ! #define ANY 4532
  1037.   /* All of the system variables sorted alphabetically */
  1038.   static SysVar SysVarArr[] = {
  1039. !        /* name          mod    type        value        min/mal    max */
  1040. !    {   "CalcUTC",      1,    INT_TYPE,    &CalculateUTC,    0,    1   },
  1041. !    {   "CalMode",      0,    INT_TYPE,    &DoCalendar,    0,    0   },
  1042. !    {   "Daemon",      0,    INT_TYPE,    &Daemon,    0,    0   },
  1043. !    {   "DontFork",      0,    INT_TYPE,    &DontFork,    0,    0   },
  1044. !    {   "DontQueue",      0,    INT_TYPE,    &DontQueue,    0,    0   },
  1045. !    {   "DontTrigAts",      0,    INT_TYPE,    &DontIssueAts,    0,    0   },
  1046. !    {   "EndSent",      1,    STR_TYPE,    &EndSent,    0,    0   },
  1047. !    {   "EndSentIg",      1,    STR_TYPE,    &EndSentIg,    0,    0   },
  1048. !    {   "FirstIndent",      1,    INT_TYPE,    &FirstIndent,    0,    132 },
  1049. !    {   "FoldYear",      1,    INT_TYPE,    &FoldYear,    0,    1   },
  1050. !    {   "FormWidth",      1,    INT_TYPE,    &FormWidth,    20,    132 },
  1051. !    {   "HushMode",      0,    INT_TYPE,    &Hush,        0,    0   },
  1052. !    {   "IgnoreOnce",      0,    INT_TYPE,    &IgnoreOnce,    0,    0   },
  1053. !    {   "InfDelta",      0,    INT_TYPE,    &InfiniteDelta,    0,    0   },
  1054. !    {   "LatDeg",      1,    INT_TYPE,    &LatDeg,    -90,    90  },
  1055. !    {   "LatMin",      1,    INT_TYPE,    &LatMin,    -59,    59  },
  1056. !    {   "LatSec",      1,    INT_TYPE,    &LatSec,    -59,    59  },
  1057. !    {   "Location",      1,    STR_TYPE,    &Location,    0,    0   },
  1058. !    {   "LongDeg",      1,    INT_TYPE,    &LongDeg,    -180,    180  },
  1059. !    {   "LongMin",      1,    INT_TYPE,    &LongMin,    -59,    59  },
  1060. !    {   "LongSec",      1,    INT_TYPE,    &LongSec,    -59,    59  },
  1061. !    {   "MaxSatIter",      1,    INT_TYPE,    &MaxSatIter,    10,    ANY },
  1062. !    {   "MinsFromUTC",      1,    INT_TYPE,    &MinsFromUTC,    -13*60,    13*60 },
  1063. !    {   "NextMode",      0,    INT_TYPE,    &NextMode,    0,    0   },
  1064. !    {   "NumQueued",      0,    INT_TYPE,    &NumQueued,    0,    0   },
  1065. !    {   "NumTrig",      0,    INT_TYPE,    &NumTriggered,    0,    0   },
  1066. !    {   "PSCal",          0,    INT_TYPE,    &PsCal,        0,    0   },
  1067. !    {   "RunOff",      0,    INT_TYPE,    &RunDisabled,    0,    0   },
  1068. !    {   "SimpleCal",      0,    INT_TYPE,    &DoSimpleCalendar,    0,  0 },
  1069. !    {   "SubsIndent",      1,    INT_TYPE,    &SubsIndent,    0,    132}
  1070.   };
  1071.   
  1072.   #define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
  1073. ***************
  1074. *** 480,501 ****
  1075.   /*                                                             */
  1076.   /***************************************************************/
  1077.   #ifdef HAVE_PROTOS
  1078. ! PUBLIC int SetSysVar(const char *name, int value)
  1079.   #else
  1080.   int SetSysVar(name, value)
  1081.   char *name;
  1082. ! int value;
  1083.   #endif
  1084.   {
  1085.      SysVar *v = FindSysVar(name);
  1086.      if (!v) return E_NOSUCH_VAR;
  1087.      if (!v->modifiable) {
  1088.         Eprint("%s: '$%s'", ErrMsg[E_CANT_MODIFY], name);
  1089.         return E_CANT_MODIFY;
  1090.      }
  1091. !    if (v->max != NO_CONSTRAINT && value > v->max) return E_2HIGH;
  1092. !    if (v->min != NO_CONSTRAINT && value < v->min) return E_2LOW;
  1093. !    *(v->value) = value;
  1094.      return OK;
  1095.   }
  1096.   
  1097. --- 488,519 ----
  1098.   /*                                                             */
  1099.   /***************************************************************/
  1100.   #ifdef HAVE_PROTOS
  1101. ! PUBLIC int SetSysVar(const char *name, Value *value)
  1102.   #else
  1103.   int SetSysVar(name, value)
  1104.   char *name;
  1105. ! Value *value;
  1106.   #endif
  1107.   {
  1108.      SysVar *v = FindSysVar(name);
  1109.      if (!v) return E_NOSUCH_VAR;
  1110. +    if (v->type != value->type) return E_BAD_TYPE;
  1111.      if (!v->modifiable) {
  1112.         Eprint("%s: '$%s'", ErrMsg[E_CANT_MODIFY], name);
  1113.         return E_CANT_MODIFY;
  1114.      }
  1115. ! /* If it's a string variable, special measures must be taken */
  1116. !    if (v->type == STR_TYPE) {
  1117. !       if (v->been_malloced) free(*((char **)(v->value)));
  1118. !       v->been_malloced = 1;
  1119. !       *((char **) v->value) = value->v.str;
  1120. !       value->type = ERR_TYPE;  /* So that it's not accidentally freed */
  1121. !    } else {
  1122. !       if (v->max != ANY && value->v.val > v->max) return E_2HIGH;
  1123. !       if (v->min != ANY && value->v.val < v->min) return E_2LOW;
  1124. !       *((int *)v->value) = value->v.val;
  1125. !    }
  1126.      return OK;
  1127.   }
  1128.   
  1129. ***************
  1130. *** 516,525 ****
  1131.   {
  1132.      SysVar *v = FindSysVar(name);
  1133.   
  1134. !    val->type = INT_TYPE;
  1135. !    val->v.val = 0;
  1136.      if (!v) return E_NOSUCH_VAR;
  1137. !    val->v.val = *(v->value);
  1138.      return OK;
  1139.   }
  1140.   
  1141. --- 534,548 ----
  1142.   {
  1143.      SysVar *v = FindSysVar(name);
  1144.   
  1145. !    val->type = ERR_TYPE;
  1146.      if (!v) return E_NOSUCH_VAR;
  1147. !    if (v->type == STR_TYPE) {
  1148. !       val->v.str = StrDup(*((char **) v->value));
  1149. !       if (!val->v.str) return E_NO_MEM;
  1150. !    } else {
  1151. !       val->v.val = *((int *) v->value);
  1152. !    }
  1153. !    val->type = v->type;
  1154.      return OK;
  1155.   }
  1156.   
  1157. ***************
  1158. *** 603,615 ****
  1159.      if (name) strcat(buffer, name); else strcat(buffer, v->name);
  1160.      fprintf(ErrFp, "%*s  ", VAR_NAME_LEN, buffer);
  1161.      if (v) {
  1162. !       if (!v->modifiable) fprintf(ErrFp, "%d\n", *v->value);
  1163. !       else {
  1164. !          fprintf(ErrFp, "%-10d  ", *v->value);
  1165. !      if (v->min == NO_CONSTRAINT) fprintf(ErrFp, "(-Inf, ");
  1166. !      else                         fprintf(ErrFp, "[%d, ", v->min);
  1167. !      if (v->max == NO_CONSTRAINT) fprintf(ErrFp, "Inf)\n");
  1168. !      else                         fprintf(ErrFp, "%d]\n", v->max);
  1169.         }
  1170.      } else   fprintf(ErrFp, "%s\n", UNDEF);
  1171.   
  1172. --- 626,648 ----
  1173.      if (name) strcat(buffer, name); else strcat(buffer, v->name);
  1174.      fprintf(ErrFp, "%*s  ", VAR_NAME_LEN, buffer);
  1175.      if (v) {
  1176. !       if (v->type == STR_TYPE) {
  1177. !          char *s = *((char **)v->value);
  1178. !      int y;
  1179. !      putc('"', ErrFp);
  1180. !      for (y=0; y<MAX_PRT_LEN && *s; y++) putc(*s++, ErrFp);
  1181. !      putc('"', ErrFp);
  1182. !      if (*s) fprintf(ErrFp, "...");
  1183. !      putc('\n', ErrFp);
  1184. !       } else {
  1185. !          if (!v->modifiable) fprintf(ErrFp, "%d\n", *((int *)v->value));
  1186. !          else {
  1187. !             fprintf(ErrFp, "%-10d  ", *((int *)v->value));
  1188. !            if (v->min == ANY) fprintf(ErrFp, "(-Inf, ");
  1189. !         else                         fprintf(ErrFp, "[%d, ", v->min);
  1190. !         if (v->max == ANY) fprintf(ErrFp, "Inf)\n");
  1191. !         else                         fprintf(ErrFp, "%d]\n", v->max);
  1192. !          }
  1193.         }
  1194.      } else   fprintf(ErrFp, "%s\n", UNDEF);
  1195.   
  1196.