Xref: utzoo comp.lang.postscript:3799 alt.sources:1421 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!ingr!b11!maven!ed From: ed@maven.UUCP (Ed Hand) Newsgroups: comp.lang.postscript,alt.sources Subject: Patch for - Pcal: postscript/c calendar printer Summary: Patch for empy command line and some extra goodies. Keywords: fixed a problem when the month was not explicitly given Message-ID: <879@maven.UUCP> Date: 18 Jan 90 17:29:56 GMT References: <6914@dayton.UUCP> Organization: Intergraph Corp. Huntsville, Al Lines: 109 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 This option can be used to change the font the title is printed in. (ie. pcal -t Times-Roman) -d 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 ] [ -m month] [ -y ]\n"); --- > "Usage: pcal [ -r ] [ -e | -f ] [ -m month] [ -y ]\n\t\t[ -t ] [ -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++)