[alt.sources] Patch for PCAL

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (01/31/90)

  I started trying the postscript calender and found that the input from
alternate file didn't work. I also added a test so I can define the
header file location on the command line instead of editing the source
for each machine. Other than that it seems to work, although I may take
a look at dynamic sizing of the text.

*** pcal.old
--- pcal.c
**************
*** 27,33
  #include <time.h>
  #include <string.h>
  
! 											/* Define this file accordingly. */
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
  
  
--- 27,33 -----
  #include <time.h>
  #include <string.h>
  
! #ifndef	PROLOG_FILE			/* Define this file accordingly. */
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
  #endif
  
**************
*** 29,34
  
  											/* Define this file accordingly. */
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
  
  
  char	*words[100],		/* maximum number of words on a line */
--- 29,35 -----
  
  #ifndef	PROLOG_FILE			/* Define this file accordingly. */
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
+ #endif
  
  char	*words[100],		/* maximum number of words on a line */
  		lbuf[512];			/* maximum line size */
**************
*** 30,36
  											/* Define this file accordingly. */
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
  
- 
  char	*words[100],		/* maximum number of words on a line */
  		lbuf[512];			/* maximum line size */
  
--- 31,36 -----
  #define	PROLOG_FILE	"/usr1/joe/util/src/pcal.ps"
  #endif
  
  char	*words[100],		/* maximum number of words on a line */
  		lbuf[512];			/* maximum line size */
  
**************
*** 87,93
  /*
   * Handle the arglist.
   */
!  	while ((m = getopt(argc, argv, "efpr:m:y:t:d:")) != EOF)
  		switch (m)
  		{
  			case 'p':	doprolog = 0; break;
--- 87,93 -----
  /*
   * Handle the arglist.
   */
!  	while ((m = getopt(argc, argv, "ef:pr:m:y:t:d:")) != EOF)
  		switch (m)
  		{
  			case 'p':	doprolog = 0; break;
-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
            "Stupidity, like virtue, is its own reward" -me

rogers@sud509.ed.ray.com (Andrew Rogers) (07/21/90)

It has come to my attention that the newest Pcal doesn't work on all Un*x
systems - apparently because not all file systems automatically translate "~".
If this is the case with yours (symptoms: calendar data file must be explicitly
included with the -f option in order to be found), patch it as follows:

Andrew
------------------------------- cut here --------------------------------
#
ed pcal.c << 'EOF'
277a
#else
	else if (nocal == FALSE) {
		char buf[80], *p;
		extern char *getenv();

		*buf = '\0';
		if ((p = getenv("HOME")) != NULL) {
			strcpy(buf, p);
			strcat(buf, "/");
		}
		strcat(buf, INFILE);
		cfp = fopen(buf, "r");
	}
#endif
.
275a
#ifdef VMS
.
69c
#define INFILE  "calendar"
.
w
q
'EOF'