[alt.sources] Patch for - Pcal: postscript/c calendar printer

ed@maven.UUCP (Ed Hand) (01/19/90)

In the recent posting of Pcal I found a couple problems.  First if I used
"pcal | lpr ..." then I would get nothing out.  Seems the value of month
it was being given was four billion something.  Also if I specified the
month on the command line (ie. "pcal -m 1 | lpr ...") then I would get the
whole year and not just one month.

So here are the fixes to both those problems, AND, some extra features.

I have added three new command line options and they are as follows:

	-r
		This will cause the output to come out in portrait
		mode instead of landscape.

	-t <titlefont name>
		This option can be used to change the font the title
		is printed in. (ie. pcal -t Times-Roman)

	-d <dayfont name>
		This option is the same as -t except that the font used
		to print the day numbers is changed.

I don't have nroff and know nothing about it so I haven't changed the
man page to go with this.  In other words, you just read the man pages
changes :-)

So here is a patch for pcal.c.  The patch utility will eat it easily.
If you don't have patch there isn't much to change and should be no
problem to do by hand, after all, I did :-)

Enjoy!
_____________________________________________________________________________

    Don't pay the ferryman,			Ed Hand		MS: CR1103
    Don't even fix a price,			Intergraph Corp.
    Don't pay the ferryman,			Huntsville, Al	35894-0001
    Till he gets you to the other side.		!uunet!ingr!b11!maven!ed
			Chris De Burgh		b11!maven!ed@Ingr.com
_____________________________________________________________________________

-----Cut Here-------------Cut Here--------------Cut Here--------------------
*** /old/pcal.c
--- ./pcal.c
22,24d21
<   "%!",
<   "/titlefont /Times-Bold def",
<   "/dayfont /Helvetica-Bold def",
197,198c194,197
<   "\t90 rotate",
<   "\t50 -120 translate",
---
>   (char *)0,
> };
> 
> char *pheader2[] = {
264a264,265
> 	char *titlefont = "Times-Bold";
> 	char *dayfont = "Times-Bold";
268a270
> 	int rotate = 90;
270c272
< 	int month;
---
> 	int month = 0;
273c275
< 	while ((m = getopt(argc, argv, "ef:m:y:")) != EOF)
---
> 	while ((m = getopt(argc, argv, "ref:m:y:t:d:")) != EOF)
276a279,282
> 		case 'r':
> 			rotate = 0;
> 			break;
> 
288c294
< 			month = atoi(month);
---
> 			month = atoi(optarg);
296a303,310
> 		case 't':
> 			titlefont = optarg;
> 			break;
> 
> 		case 'd':
> 			dayfont = optarg;
> 			break;
> 
300a315
> 
303c318
< 			"Usage: pcal [ -e | -f <cal> ] [ -m month] [ -y <year> ]\n");
---
> 			"Usage: pcal [ -r ] [ -e | -f <cal> ] [ -m month] [ -y <year> ]\n\t\t[ -t <title font> ] [ -d <day font> ]\n");
310c325
< 		m = lt->tm_mon + 1;
---
> 		month = lt->tm_mon + 1;
339a355,356
> 	PRT("%%!\n");
> 	PRT("/titlefont /%s def\n/dayfont /%s def\n", titlefont, dayfont);
340a358,364
> 		PRT("%s\n", *ap);
> 	PRT("\t%d rotate\n", rotate);
> 	if (rotate)
> 		PRT("\t50 -120 translate\n");
> 	else
> 		PRT("\t0.75 0.75 scale\n\t50 460 translate\n");
> 	for (ap = pheader2; *ap; ap++)

news@laas.laas.fr (USENET News System) (01/23/90)

In article <879@maven.UUCP> ed@maven.UUCP (Ed Hand) writes:
>
>
>In the recent posting of Pcal I found a couple problems.  First if I used
[stuff deleted]
>
>So here are the fixes to both those problems, AND, some extra features.
>
>I have added three new command line options and they are as follows:
[stuff deleted]
>
>I don't have nroff and know nothing about it so I haven't changed the
>man page to go with this.  In other words, you just read the man pages
>changes :-)

Here are the diffs for the man page:

*** pcal.man~	Tue Jan 16 13:49:53 1990
--- pcal.man	Tue Jan 23 11:07:51 1990
***************
*** 10,16 ****
  .B \-m <month>
  [
  .B \-y <year>
! ]]
  .SH DESCRIPTION
  .I Pcal
  generates PostScript to produce landscape calendars for any month and year.
--- 10,22 ----
  .B \-m <month>
  [
  .B \-y <year>
! ]] [
! .B -r
! ] [
! .B -t <titlefont name>
! ] [
! .B -d <dayfont name>
! ]
  .SH DESCRIPTION
  .I Pcal
  generates PostScript to produce landscape calendars for any month and year.
***************
*** 39,45 ****
  entries do not contain a year.  Any date entries containing year information
  will set the remembered year to that year.
  .P
! .I Pcal has two options:
  .P
  .TP
  .B \-e
--- 45,51 ----
  entries do not contain a year.  Any date entries containing year information
  will set the remembered year to that year.
  .P
! .I Pcal has many options:
  .P
  .TP
  .B \-e
***************
*** 50,55 ****
--- 56,74 ----
  .I pcal
  to use the file name <cal> as the input file in place of the default
  calendar file in the callers home directory.
+ .TP
+ .B \-r
+ This will cause the output to come out in portrait
+ mode instead of landscape
+ .TP
+ .BR \-t <titlefont name>
+ This option can be used to change the font the title
+ is printed in. (ie. pcal -t Times-Roman)
+ .TP
+ .BR  -d <dayfont name>
+ This option is the same as -t except that the font used
+ to print the day numbers is changed.
+ .P
  .SH SEE ALSO
  cal(1)
  .SH CAVEATS
--
\  /  | Matthieu Herrb             CNRS - LAAS 
|\/|--| matthieu@idefix.laas.fr    7, avenue du Colonel Roche
|  |  |                            31077 Toulouse Cedex - France
"If You're not Part of the Solution, You're Part of the Problem..."