[comp.lang.postscript] Patch to PCAL PostScript calendar program

kjk@PacBell.COM (Ken Keirnan) (07/01/89)

The following patch for PCAL (pcal.c) was sent to me by Terry Weissman
(weissman@wsl.dec.com).  The patch fixes PostScript output for calendar
file strings containing parentheses (I forgot those darn backslashes).
Thanks again to Terry for the fixes.

Ken Keirnan



*** OLDpcal.c	Sat Jul  1 08:40:45 1989
--- pcal.c	Sat Jul  1 09:06:17 1989
***************
*** 5,10
  
  #define PRT	(void)printf
  #define FPR	(void)fprintf
  
  char *words[100];	/* maximum number of words on a line */
  char lbuf[512];		/* maximum line size */

--- 5,11 -----
  
  #define PRT	(void)printf
  #define FPR	(void)fprintf
+ #define PUT	(void)putchar
  
  char *words[100];	/* maximum number of words on a line */
  char lbuf[512];		/* maximum line size */
***************
*** 353,359
  pmonth(m)
  int m;
  {
! 	register char **s;
  	register oldday = -1;
  	register day;
  

--- 354,360 -----
  pmonth(m)
  int m;
  {
! 	register char **s, *ptr;
  	register oldday = -1;
  	register day;
  
***************
*** 380,388
  			oldday = day;
  		} else
  			PRT("(.p)\n");
! 		for (s = words; *s; s++)
! 			PRT("(%s)\n", *s);
! 
  	} while (day = getday(m));
  	PRT("] daytext\n");
  	PRT("showpage\n");

--- 381,395 -----
  			oldday = day;
  		} else
  			PRT("(.p)\n");
! 		for (s = words; *s; s++) {
! 			PUT('(');
! 			for (ptr = *s; *ptr; ptr++) {
! 				if (*ptr == '(' || *ptr == ')')
! 					PUT('\\');
! 				PUT(*ptr);
! 			}
! 			PRT(")\n");
! 		}
  	} while (day = getday(m));
  	PRT("] daytext\n");
  	PRT("showpage\n");
-- 

Ken Keirnan - Pacific Bell - {att,bellcore,sun,ames,pyramid}!pacbell!pbhyf!kjk
  San Ramon, California	                    kjk@pbhyf.PacBell.COM