home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news or mail, ASCII text
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 72 6f | 67 65 72 73 40 73 75 64 |From: ro|gers@sud|
|00000010| 35 30 39 2e 65 64 2e 72 | 61 79 2e 63 6f 6d 20 28 |509.ed.r|ay.com (|
|00000020| 41 6e 64 72 65 77 20 52 | 6f 67 65 72 73 29 0a 4e |Andrew R|ogers).N|
|00000030| 65 77 73 67 72 6f 75 70 | 73 3a 20 61 6c 74 2e 73 |ewsgroup|s: alt.s|
|00000040| 6f 75 72 63 65 73 0a 53 | 75 62 6a 65 63 74 3a 20 |ources.S|ubject: |
|00000050| 50 63 61 6c 20 28 76 32 | 2e 30 30 29 0a 4d 65 73 |Pcal (v2|.00).Mes|
|00000060| 73 61 67 65 2d 49 44 3a | 20 3c 32 30 37 32 40 73 |sage-ID:| <2072@s|
|00000070| 75 64 35 30 39 2e 65 64 | 2e 72 61 79 2e 63 6f 6d |ud509.ed|.ray.com|
|00000080| 3e 0a 44 61 74 65 3a 20 | 31 33 20 41 75 67 20 39 |>.Date: |13 Aug 9|
|00000090| 30 20 31 35 3a 30 39 3a | 34 33 20 47 4d 54 0a 0a |0 15:09:|43 GMT..|
|000000a0| 0a 54 68 69 73 20 69 73 | 20 73 74 69 6c 6c 20 61 |.This is| still a|
|000000b0| 6e 6f 74 68 65 72 20 6e | 65 77 20 61 6e 64 20 69 |nother n|ew and i|
|000000c0| 6d 70 72 6f 76 65 64 20 | 72 65 6c 65 61 73 65 20 |mproved |release |
|000000d0| 6f 66 20 50 63 61 6c 2e | 20 20 54 68 65 20 63 68 |of Pcal.| The ch|
|000000e0| 61 6e 67 65 73 20 74 68 | 69 73 0a 74 69 6d 65 20 |anges th|is.time |
|000000f0| 61 72 65 3a 0a 0a 09 31 | 29 20 2d 72 20 66 6c 61 |are:...1|) -r fla|
|00000100| 67 20 72 65 70 6c 61 63 | 65 64 20 62 79 20 2d 6c |g replac|ed by -l|
|00000110| 20 61 6e 64 20 2d 70 20 | 74 6f 20 64 72 61 77 20 | and -p |to draw |
|00000120| 6c 61 6e 64 73 63 61 70 | 65 20 61 6e 64 20 70 6f |landscap|e and po|
|00000130| 72 74 72 61 69 74 20 6d | 6f 64 65 0a 09 20 20 20 |rtrait m|ode.. |
|00000140| 63 61 6c 65 6e 64 61 72 | 73 20 72 65 73 70 65 63 |calendar|s respec|
|00000150| 74 69 76 65 6c 79 2e 0a | 0a 09 32 29 20 2d 73 20 |tively..|..2) -s |
|00000160| 61 6e 64 20 2d 53 20 66 | 6c 61 67 73 20 72 65 70 |and -S f|lags rep|
|00000170| 6c 61 63 65 64 20 62 79 | 20 63 6c 65 61 72 65 72 |laced by| clearer|
|00000180| 20 61 6e 64 20 6d 6f 72 | 65 20 66 6c 65 78 69 62 | and mor|e flexib|
|00000190| 6c 65 20 6d 65 63 68 61 | 6e 69 73 6d 3a 0a 09 20 |le mecha|nism:.. |
|000001a0| 20 20 73 70 65 63 69 66 | 79 20 22 2d 62 20 44 41 | specif|y "-b DA|
|000001b0| 59 22 20 74 6f 20 70 72 | 69 6e 74 20 61 6c 6c 20 |Y" to pr|int all |
|000001c0| 64 61 74 65 73 20 66 61 | 6c 6c 69 6e 67 20 6f 6e |dates fa|lling on|
|000001d0| 20 77 65 65 6b 64 61 79 | 20 44 41 59 20 69 6e 20 | weekday| DAY in |
|000001e0| 62 6c 61 63 6b 2c 0a 09 | 20 20 20 22 2d 67 20 44 |black,..| "-g D|
|000001f0| 41 59 22 20 74 6f 20 70 | 72 69 6e 74 20 74 68 65 |AY" to p|rint the|
|00000200| 6d 20 69 6e 20 67 72 61 | 79 2e 20 20 22 2d 5b 62 |m in gra|y. "-[b|
|00000210| 7c 67 5d 20 61 6c 6c 22 | 20 70 72 69 6e 74 73 20 ||g] all"| prints |
|00000220| 61 6c 6c 20 64 61 74 65 | 73 20 69 6e 0a 09 20 20 |all date|s in.. |
|00000230| 20 74 68 65 20 73 65 6c | 65 63 74 65 64 20 63 6f | the sel|ected co|
|00000240| 6c 6f 72 2e 20 20 54 68 | 65 73 65 20 6f 70 74 69 |lor. Th|ese opti|
|00000250| 6f 6e 73 20 61 72 65 20 | 63 75 6d 75 6c 61 74 69 |ons are |cumulati|
|00000260| 76 65 3a 20 22 2d 62 20 | 61 6c 6c 20 2d 67 20 74 |ve: "-b |all -g t|
|00000270| 75 65 22 0a 09 20 20 20 | 70 72 69 6e 74 73 20 54 |ue".. |prints T|
|00000280| 75 65 73 64 61 79 73 20 | 69 6e 20 67 72 61 79 20 |uesdays |in gray |
|00000290| 61 6e 64 20 61 6c 6c 20 | 6f 74 68 65 72 20 64 61 |and all |other da|
|000002a0| 79 73 20 69 6e 20 62 6c | 61 63 6b 2e 20 20 48 6f |ys in bl|ack. Ho|
|000002b0| 6c 69 64 61 79 73 20 61 | 72 65 0a 09 20 20 20 70 |lidays a|re.. p|
|000002c0| 72 69 6e 74 65 64 20 69 | 6e 20 77 68 69 63 68 65 |rinted i|n whiche|
|000002d0| 76 65 72 20 63 6f 6c 6f | 72 20 63 6f 6e 74 72 61 |ver colo|r contra|
|000002e0| 73 74 73 20 77 69 74 68 | 20 74 68 65 20 6d 61 6a |sts with| the maj|
|000002f0| 6f 72 69 74 79 20 6f 66 | 20 64 61 79 73 2e 0a 0a |ority of| days...|
|00000300| 09 33 29 20 43 6f 6d 6d | 61 6e 64 2d 6c 69 6e 65 |.3) Comm|and-line|
|00000310| 20 66 6c 61 67 73 20 28 | 65 78 63 65 70 74 20 2d | flags (|except -|
|00000320| 65 20 61 6e 64 20 2d 66 | 29 20 6d 61 79 20 62 65 |e and -f|) may be|
|00000330| 20 73 70 65 63 69 66 69 | 65 64 20 69 6e 20 74 68 | specifi|ed in th|
|00000340| 65 0a 09 20 20 20 64 61 | 74 65 20 66 69 6c 65 20 |e.. da|te file |
|00000350| 62 79 20 69 6e 63 6c 75 | 64 69 6e 67 20 6f 6e 65 |by inclu|ding one|
|00000360| 20 6f 72 20 6d 6f 72 65 | 20 6c 69 6e 65 73 20 6f | or more| lines o|
|00000370| 66 20 74 68 65 20 66 6f | 72 6d 0a 0a 09 09 6f 70 |f the fo|rm....op|
|00000380| 74 20 3c 6f 70 74 69 6f | 6e 73 3e 0a 0a 09 20 20 |t <optio|ns>... |
|00000390| 20 77 68 65 72 65 20 3c | 6f 70 74 69 6f 6e 73 3e | where <|options>|
|000003a0| 20 69 73 20 6f 6e 65 20 | 6f 72 20 6d 6f 72 65 20 | is one |or more |
|000003b0| 76 61 6c 69 64 20 63 6f | 6d 6d 61 6e 64 2d 6c 69 |valid co|mmand-li|
|000003c0| 6e 65 20 66 6c 61 67 73 | 2e 20 20 41 6e 79 0a 09 |ne flags|. Any..|
|000003d0| 20 20 20 66 6c 61 67 73 | 20 73 70 65 63 69 66 69 | flags| specifi|
|000003e0| 65 64 20 69 6e 20 74 68 | 69 73 20 6d 61 6e 6e 65 |ed in th|is manne|
|000003f0| 72 20 6f 76 65 72 72 69 | 64 65 20 74 68 65 20 64 |r overri|de the d|
|00000400| 65 66 61 75 6c 74 73 2c | 20 62 75 74 20 69 6e 0a |efaults,| but in.|
|00000410| 09 20 20 20 74 75 72 6e | 20 61 72 65 20 6f 76 65 |. turn| are ove|
|00000420| 72 72 69 64 64 65 6e 20 | 74 68 65 6d 73 65 6c 76 |rridden |themselv|
|00000430| 65 73 20 62 79 20 66 6c | 61 67 73 20 73 70 65 63 |es by fl|ags spec|
|00000440| 69 66 69 65 64 20 65 78 | 70 6c 69 63 69 74 6c 79 |ified ex|plicitly|
|00000450| 20 6f 6e 0a 09 20 20 20 | 74 68 65 20 63 6f 6d 6d | on.. |the comm|
|00000460| 61 6e 64 20 6c 69 6e 65 | 20 28 77 68 69 63 68 20 |and line| (which |
|00000470| 69 73 20 77 68 79 20 62 | 6f 74 68 20 2d 6c 20 61 |is why b|oth -l a|
|00000480| 6e 64 20 2d 70 20 61 72 | 65 20 73 75 70 70 6f 72 |nd -p ar|e suppor|
|00000490| 74 65 64 29 2e 0a 09 20 | 20 20 53 70 65 63 69 66 |ted)... | Specif|
|000004a0| 79 69 6e 67 20 61 20 66 | 6c 61 67 20 77 69 74 68 |ying a f|lag with|
|000004b0| 6f 75 74 20 61 6e 20 61 | 72 67 75 6d 65 6e 74 20 |out an a|rgument |
|000004c0| 6f 6e 20 74 68 65 20 63 | 6f 6d 6d 61 6e 64 20 6c |on the c|ommand l|
|000004d0| 69 6e 65 20 72 65 73 65 | 74 73 0a 09 20 20 20 69 |ine rese|ts.. i|
|000004e0| 74 73 20 76 61 6c 75 65 | 20 74 6f 20 74 68 65 20 |ts value| to the |
|000004f0| 70 72 6f 67 72 61 6d 20 | 64 65 66 61 75 6c 74 2e |program |default.|
|00000500| 0a 0a 09 34 29 20 54 68 | 65 20 73 6f 75 72 63 65 |...4) Th|e source|
|00000510| 20 63 6f 64 65 20 68 61 | 73 20 62 65 65 6e 20 72 | code ha|s been r|
|00000520| 65 76 69 73 65 64 20 61 | 6e 64 20 72 65 64 6f 63 |evised a|nd redoc|
|00000530| 75 6d 65 6e 74 65 64 20 | 28 61 67 61 69 6e 29 20 |umented |(again) |
|00000540| 66 6f 72 0a 09 20 20 20 | 63 6c 61 72 69 74 79 2e |for.. |clarity.|
|00000550| 0a 0a 54 68 65 20 61 63 | 63 6f 6d 70 61 6e 79 69 |..The ac|companyi|
|00000560| 6e 67 20 66 69 6c 65 20 | 63 61 6c 6c 65 64 20 22 |ng file |called "|
|00000570| 52 65 61 64 4d 65 2e 6f | 72 69 67 22 20 63 61 6d |ReadMe.o|rig" cam|
|00000580| 65 20 77 69 74 68 20 74 | 68 65 20 6f 72 69 67 69 |e with t|he origi|
|00000590| 6e 61 6c 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e |nal dist|ribution|
|000005a0| 0a 61 73 20 52 45 41 44 | 4d 45 20 61 6e 64 20 73 |.as READ|ME and s|
|000005b0| 74 61 74 65 73 20 74 68 | 69 73 20 70 72 6f 67 72 |tates th|is progr|
|000005c0| 61 6d 20 69 73 20 63 6f | 70 79 72 69 67 68 74 65 |am is co|pyrighte|
|000005d0| 64 20 62 75 74 20 77 69 | 74 68 20 70 65 72 6d 69 |d but wi|th permi|
|000005e0| 73 73 69 6f 6e 20 74 6f | 20 6d 6f 64 69 66 79 0a |ssion to| modify.|
|000005f0| 61 6e 64 20 72 65 64 69 | 73 74 72 69 62 75 74 65 |and redi|stribute|
|00000600| 2e 20 20 50 6c 65 61 73 | 65 20 69 6e 63 6c 75 64 |. Pleas|e includ|
|00000610| 65 20 74 68 69 73 20 66 | 69 6c 65 20 69 6e 20 61 |e this f|ile in a|
|00000620| 6e 79 20 66 75 72 74 68 | 65 72 20 64 69 73 74 72 |ny furth|er distr|
|00000630| 69 62 75 74 69 6f 6e 2e | 0a 0a 41 6e 64 72 65 77 |ibution.|..Andrew|
|00000640| 20 57 2e 20 52 6f 67 65 | 72 73 0a 0a 2d 2d 2d 2d | W. Roge|rs..----|
|00000650| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000660| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 20 63 75 74 |--------|---- cut|
|00000670| 20 68 65 72 65 20 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | here --|--------|
|00000680| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000690| 2d 2d 2d 2d 2d 2d 0a 23 | 21 20 2f 62 69 6e 2f 73 |------.#|! /bin/s|
|000006a0| 68 0a 23 20 54 68 69 73 | 20 69 73 20 61 20 73 68 |h.# This| is a sh|
|000006b0| 65 6c 6c 20 61 72 63 68 | 69 76 65 2c 20 6d 65 61 |ell arch|ive, mea|
|000006c0| 6e 69 6e 67 3a 0a 23 20 | 31 2e 20 52 65 6d 6f 76 |ning:.# |1. Remov|
|000006d0| 65 20 65 76 65 72 79 74 | 68 69 6e 67 20 61 62 6f |e everyt|hing abo|
|000006e0| 76 65 20 74 68 65 20 23 | 21 20 2f 62 69 6e 2f 73 |ve the #|! /bin/s|
|000006f0| 68 20 6c 69 6e 65 2e 0a | 23 20 32 2e 20 53 61 76 |h line..|# 2. Sav|
|00000700| 65 20 74 68 65 20 72 65 | 73 75 6c 74 69 6e 67 20 |e the re|sulting |
|00000710| 74 65 78 74 20 69 6e 20 | 61 20 66 69 6c 65 2e 0a |text in |a file..|
|00000720| 23 20 33 2e 20 45 78 65 | 63 75 74 65 20 74 68 65 |# 3. Exe|cute the|
|00000730| 20 66 69 6c 65 20 77 69 | 74 68 20 2f 62 69 6e 2f | file wi|th /bin/|
|00000740| 73 68 20 28 6e 6f 74 20 | 63 73 68 29 20 74 6f 20 |sh (not |csh) to |
|00000750| 63 72 65 61 74 65 3a 0a | 23 09 20 4d 61 6b 65 66 |create:.|#. Makef|
|00000760| 69 6c 65 0a 23 09 20 52 | 65 61 64 4d 65 0a 23 09 |ile.#. R|eadMe.#.|
|00000770| 20 52 65 61 64 4d 65 2e | 6f 72 69 67 0a 23 09 20 | ReadMe.|orig.#. |
|00000780| 63 61 6c 65 6e 64 61 72 | 0a 23 09 20 70 63 61 6c |calendar|.#. pcal|
|00000790| 2e 63 0a 23 09 20 70 63 | 61 6c 2e 68 6c 70 0a 23 |.c.#. pc|al.hlp.#|
|000007a0| 09 20 70 63 61 6c 2e 6d | 61 6e 0a 23 09 20 70 63 |. pcal.m|an.#. pc|
|000007b0| 61 6c 69 6e 69 74 2e 68 | 0a 23 20 54 68 69 73 20 |alinit.h|.# This |
|000007c0| 61 72 63 68 69 76 65 20 | 63 72 65 61 74 65 64 3a |archive |created:|
|000007d0| 20 4d 6f 6e 20 41 75 67 | 20 31 33 20 31 30 3a 35 | Mon Aug| 13 10:5|
|000007e0| 36 3a 34 31 20 45 44 54 | 20 31 39 39 30 0a 65 78 |6:41 EDT| 1990.ex|
|000007f0| 70 6f 72 74 20 50 41 54 | 48 3b 20 50 41 54 48 3d |port PAT|H; PATH=|
|00000800| 2f 62 69 6e 3a 2f 75 73 | 72 2f 62 69 6e 3a 24 50 |/bin:/us|r/bin:$P|
|00000810| 41 54 48 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |ATH.if t|est -f '|
|00000820| 4d 61 6b 65 66 69 6c 65 | 27 0a 74 68 65 6e 0a 09 |Makefile|'.then..|
|00000830| 65 63 68 6f 20 73 68 61 | 72 3a 20 77 69 6c 6c 20 |echo sha|r: will |
|00000840| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00000850| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 27 4d 61 |xisting |file 'Ma|
|00000860| 6b 65 66 69 6c 65 27 0a | 65 6c 73 65 0a 63 61 74 |kefile'.|else.cat|
|00000870| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00000880| 27 4d 61 6b 65 66 69 6c | 65 27 0a 23 0a 4d 41 4e |'Makefil|e'.#.MAN|
|00000890| 44 49 52 3d 2f 75 73 72 | 31 2f 6a 61 64 2f 6d 61 |DIR=/usr|1/jad/ma|
|000008a0| 6e 09 09 09 23 20 6d 75 | 73 74 20 63 68 61 6e 67 |n...# mu|st chang|
|000008b0| 65 20 74 68 69 73 0a 0a | 70 63 61 6c 3a 09 70 63 |e this..|pcal:.pc|
|000008c0| 61 6c 2e 63 20 70 63 61 | 6c 69 6e 69 74 2e 68 0a |al.c pca|linit.h.|
|000008d0| 09 24 28 43 43 29 20 24 | 28 43 46 4c 41 47 53 29 |.$(CC) $|(CFLAGS)|
|000008e0| 20 24 28 4c 44 46 4c 41 | 47 53 29 20 24 28 43 4f | $(LDFLA|GS) $(CO|
|000008f0| 50 54 53 29 20 2d 6f 20 | 70 63 61 6c 20 70 63 61 |PTS) -o |pcal pca|
|00000900| 6c 2e 63 0a 0a 6d 61 6e | 3a 09 70 63 61 6c 2e 6d |l.c..man|:.pcal.m|
|00000910| 61 6e 0a 09 6e 72 6f 66 | 66 20 2d 6d 61 6e 20 70 |an..nrof|f -man p|
|00000920| 63 61 6c 2e 6d 61 6e 20 | 3e 20 70 63 61 6c 2e 31 |cal.man |> pcal.1|
|00000930| 0a 09 70 61 63 6b 20 70 | 63 61 6c 2e 31 0a 23 09 |..pack p|cal.1.#.|
|00000940| 6d 76 20 70 63 61 6c 2e | 31 2e 7a 20 24 28 4d 41 |mv pcal.|1.z $(MA|
|00000950| 4e 44 49 52 29 0a 53 48 | 41 52 5f 45 4f 46 0a 66 |NDIR).SH|AR_EOF.f|
|00000960| 69 0a 69 66 20 74 65 73 | 74 20 2d 66 20 27 52 65 |i.if tes|t -f 'Re|
|00000970| 61 64 4d 65 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |adMe'.th|en..echo|
|00000980| 20 73 68 61 72 3a 20 77 | 69 6c 6c 20 6e 6f 74 20 | shar: w|ill not |
|00000990| 6f 76 65 72 2d 77 72 69 | 74 65 20 65 78 69 73 74 |over-wri|te exist|
|000009a0| 69 6e 67 20 66 69 6c 65 | 20 27 52 65 61 64 4d 65 |ing file| 'ReadMe|
|000009b0| 27 0a 65 6c 73 65 0a 63 | 61 74 20 3c 3c 20 5c 53 |'.else.c|at << \S|
|000009c0| 48 41 52 5f 45 4f 46 20 | 3e 20 27 52 65 61 64 4d |HAR_EOF |> 'ReadM|
|000009d0| 65 27 0a 54 68 69 73 20 | 69 73 20 73 74 69 6c 6c |e'.This |is still|
|000009e0| 20 61 6e 6f 74 68 65 72 | 20 6e 65 77 20 61 6e 64 | another| new and|
|000009f0| 20 69 6d 70 72 6f 76 65 | 64 20 72 65 6c 65 61 73 | improve|d releas|
|00000a00| 65 20 6f 66 20 70 63 61 | 6c 2e 20 20 54 68 65 20 |e of pca|l. The |
|00000a10| 63 68 61 6e 67 65 73 20 | 74 68 69 73 0a 74 69 6d |changes |this.tim|
|00000a20| 65 20 61 72 65 3a 0a 0a | 09 31 29 20 2d 72 20 66 |e are:..|.1) -r f|
|00000a30| 6c 61 67 20 72 65 70 6c | 61 63 65 64 20 62 79 20 |lag repl|aced by |
|00000a40| 2d 6c 20 61 6e 64 20 2d | 70 20 74 6f 20 64 72 61 |-l and -|p to dra|
|00000a50| 77 20 6c 61 6e 64 73 63 | 61 70 65 20 61 6e 64 20 |w landsc|ape and |
|00000a60| 70 6f 72 74 72 61 69 74 | 20 6d 6f 64 65 0a 09 20 |portrait| mode.. |
|00000a70| 20 20 63 61 6c 65 6e 64 | 61 72 73 20 72 65 73 70 | calend|ars resp|
|00000a80| 65 63 74 69 76 65 6c 79 | 2e 0a 0a 09 32 29 20 2d |ectively|....2) -|
|00000a90| 73 20 61 6e 64 20 2d 53 | 20 66 6c 61 67 73 20 72 |s and -S| flags r|
|00000aa0| 65 70 6c 61 63 65 64 20 | 62 79 20 63 6c 65 61 72 |eplaced |by clear|
|00000ab0| 65 72 20 61 6e 64 20 6d | 6f 72 65 20 66 6c 65 78 |er and m|ore flex|
|00000ac0| 69 62 6c 65 20 6d 65 63 | 68 61 6e 69 73 6d 3a 0a |ible mec|hanism:.|
|00000ad0| 09 20 20 20 73 70 65 63 | 69 66 79 20 22 2d 62 20 |. spec|ify "-b |
|00000ae0| 44 41 59 22 20 74 6f 20 | 70 72 69 6e 74 20 61 6c |DAY" to |print al|
|00000af0| 6c 20 64 61 74 65 73 20 | 66 61 6c 6c 69 6e 67 20 |l dates |falling |
|00000b00| 6f 6e 20 77 65 65 6b 64 | 61 79 20 44 41 59 20 69 |on weekd|ay DAY i|
|00000b10| 6e 20 62 6c 61 63 6b 2c | 0a 09 20 20 20 22 2d 67 |n black,|.. "-g|
|00000b20| 20 44 41 59 22 20 74 6f | 20 70 72 69 6e 74 20 74 | DAY" to| print t|
|00000b30| 68 65 6d 20 69 6e 20 67 | 72 61 79 2e 20 20 22 2d |hem in g|ray. "-|
|00000b40| 5b 62 7c 67 5d 20 61 6c | 6c 22 20 70 72 69 6e 74 |[b|g] al|l" print|
|00000b50| 73 20 61 6c 6c 20 64 61 | 74 65 73 20 69 6e 0a 09 |s all da|tes in..|
|00000b60| 20 20 20 74 68 65 20 73 | 65 6c 65 63 74 65 64 20 | the s|elected |
|00000b70| 63 6f 6c 6f 72 2e 20 20 | 54 68 65 73 65 20 6f 70 |color. |These op|
|00000b80| 74 69 6f 6e 73 20 61 72 | 65 20 63 75 6d 75 6c 61 |tions ar|e cumula|
|00000b90| 74 69 76 65 3a 20 22 2d | 62 20 61 6c 6c 20 2d 67 |tive: "-|b all -g|
|00000ba0| 20 74 75 65 22 0a 09 20 | 20 20 70 72 69 6e 74 73 | tue".. | prints|
|00000bb0| 20 54 75 65 73 64 61 79 | 73 20 69 6e 20 67 72 61 | Tuesday|s in gra|
|00000bc0| 79 20 61 6e 64 20 61 6c | 6c 20 6f 74 68 65 72 20 |y and al|l other |
|00000bd0| 64 61 79 73 20 69 6e 20 | 62 6c 61 63 6b 2e 20 20 |days in |black. |
|00000be0| 48 6f 6c 69 64 61 79 73 | 20 61 72 65 0a 09 20 20 |Holidays| are.. |
|00000bf0| 20 70 72 69 6e 74 65 64 | 20 69 6e 20 77 68 69 63 | printed| in whic|
|00000c00| 68 65 76 65 72 20 63 6f | 6c 6f 72 20 63 6f 6e 74 |hever co|lor cont|
|00000c10| 72 61 73 74 73 20 77 69 | 74 68 20 74 68 65 20 6d |rasts wi|th the m|
|00000c20| 61 6a 6f 72 69 74 79 20 | 6f 66 20 64 61 79 73 2e |ajority |of days.|
|00000c30| 0a 0a 09 33 29 20 43 6f | 6d 6d 61 6e 64 2d 6c 69 |...3) Co|mmand-li|
|00000c40| 6e 65 20 66 6c 61 67 73 | 20 28 65 78 63 65 70 74 |ne flags| (except|
|00000c50| 20 2d 65 20 61 6e 64 20 | 2d 66 29 20 6d 61 79 20 | -e and |-f) may |
|00000c60| 62 65 20 73 70 65 63 69 | 66 69 65 64 20 69 6e 20 |be speci|fied in |
|00000c70| 74 68 65 0a 09 20 20 20 | 64 61 74 65 20 66 69 6c |the.. |date fil|
|00000c80| 65 20 62 79 20 69 6e 63 | 6c 75 64 69 6e 67 20 6f |e by inc|luding o|
|00000c90| 6e 65 20 6f 72 20 6d 6f | 72 65 20 6c 69 6e 65 73 |ne or mo|re lines|
|00000ca0| 20 6f 66 20 74 68 65 20 | 66 6f 72 6d 0a 0a 09 09 | of the |form....|
|00000cb0| 6f 70 74 20 3c 6f 70 74 | 69 6f 6e 73 3e 0a 0a 09 |opt <opt|ions>...|
|00000cc0| 20 20 20 77 68 65 72 65 | 20 3c 6f 70 74 69 6f 6e | where| <option|
|00000cd0| 73 3e 20 69 73 20 6f 6e | 65 20 6f 72 20 6d 6f 72 |s> is on|e or mor|
|00000ce0| 65 20 76 61 6c 69 64 20 | 63 6f 6d 6d 61 6e 64 2d |e valid |command-|
|00000cf0| 6c 69 6e 65 20 66 6c 61 | 67 73 2e 20 20 41 6e 79 |line fla|gs. Any|
|00000d00| 0a 09 20 20 20 66 6c 61 | 67 73 20 73 70 65 63 69 |.. fla|gs speci|
|00000d10| 66 69 65 64 20 69 6e 20 | 74 68 69 73 20 6d 61 6e |fied in |this man|
|00000d20| 6e 65 72 20 6f 76 65 72 | 72 69 64 65 20 74 68 65 |ner over|ride the|
|00000d30| 20 64 65 66 61 75 6c 74 | 73 2c 20 62 75 74 20 69 | default|s, but i|
|00000d40| 6e 0a 09 20 20 20 74 75 | 72 6e 20 61 72 65 20 6f |n.. tu|rn are o|
|00000d50| 76 65 72 72 69 64 64 65 | 6e 20 74 68 65 6d 73 65 |verridde|n themse|
|00000d60| 6c 76 65 73 20 62 79 20 | 66 6c 61 67 73 20 73 70 |lves by |flags sp|
|00000d70| 65 63 69 66 69 65 64 20 | 65 78 70 6c 69 63 69 74 |ecified |explicit|
|00000d80| 6c 79 20 6f 6e 0a 09 20 | 20 20 74 68 65 20 63 6f |ly on.. | the co|
|00000d90| 6d 6d 61 6e 64 20 6c 69 | 6e 65 20 28 77 68 69 63 |mmand li|ne (whic|
|00000da0| 68 20 69 73 20 77 68 79 | 20 62 6f 74 68 20 2d 6c |h is why| both -l|
|00000db0| 20 61 6e 64 20 2d 70 20 | 61 72 65 20 73 75 70 70 | and -p |are supp|
|00000dc0| 6f 72 74 65 64 29 2e 0a | 09 20 20 20 53 70 65 63 |orted)..|. Spec|
|00000dd0| 69 66 79 69 6e 67 20 61 | 20 66 6c 61 67 20 77 69 |ifying a| flag wi|
|00000de0| 74 68 6f 75 74 20 61 6e | 20 61 72 67 75 6d 65 6e |thout an| argumen|
|00000df0| 74 20 6f 6e 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 |t on the| command|
|00000e00| 20 6c 69 6e 65 20 72 65 | 73 65 74 73 0a 09 20 20 | line re|sets.. |
|00000e10| 20 69 74 73 20 76 61 6c | 75 65 20 74 6f 20 74 68 | its val|ue to th|
|00000e20| 65 20 70 72 6f 67 72 61 | 6d 20 64 65 66 61 75 6c |e progra|m defaul|
|00000e30| 74 2e 0a 0a 09 34 29 20 | 54 68 65 20 6d 6f 6e 74 |t....4) |The mont|
|00000e40| 68 20 61 6e 64 20 64 61 | 79 20 6e 61 6d 65 73 20 |h and da|y names |
|00000e50| 61 72 65 20 69 6e 20 70 | 63 61 6c 2e 63 2c 20 6e |are in p|cal.c, n|
|00000e60| 6f 74 20 69 6e 20 70 63 | 61 6c 69 6e 69 74 2e 68 |ot in pc|alinit.h|
|00000e70| 20 2d 20 73 6f 0a 09 20 | 20 20 61 6e 79 6f 6e 65 | - so.. | anyone|
|00000e80| 20 61 74 74 65 6d 70 74 | 69 6e 67 20 74 6f 20 63 | attempt|ing to c|
|00000e90| 68 61 6e 67 65 20 70 63 | 61 6c 20 74 6f 20 75 73 |hange pc|al to us|
|00000ea0| 65 20 61 20 6c 61 6e 67 | 75 61 67 65 20 6f 74 68 |e a lang|uage oth|
|00000eb0| 65 72 20 74 68 61 6e 0a | 09 20 20 20 45 6e 67 6c |er than.|. Engl|
|00000ec0| 69 73 68 20 6e 65 65 64 | 20 6f 6e 6c 79 20 63 68 |ish need| only ch|
|00000ed0| 61 6e 67 65 20 74 68 65 | 6d 20 69 6e 20 6f 6e 65 |ange the|m in one|
|00000ee0| 20 70 6c 61 63 65 20 28 | 66 6f 72 20 62 6f 74 68 | place (|for both|
|00000ef0| 20 70 72 69 6e 74 69 6e | 67 0a 09 20 20 20 61 6e | printin|g.. an|
|00000f00| 64 20 64 61 74 65 2f 66 | 6c 61 67 20 70 61 72 73 |d date/f|lag pars|
|00000f10| 69 6e 67 29 2e 0a 0a 09 | 35 29 20 54 68 65 20 75 |ing)....|5) The u|
|00000f20| 73 61 67 65 28 29 20 6d | 65 73 73 61 67 65 20 66 |sage() m|essage f|
|00000f30| 69 74 73 20 69 6e 20 61 | 20 32 34 78 38 30 20 73 |its in a| 24x80 s|
|00000f40| 63 72 65 65 6e 20 28 74 | 68 61 6e 6b 73 20 74 6f |creen (t|hanks to|
|00000f50| 20 4a 69 6d 0a 09 20 20 | 20 50 72 65 73 63 6f 74 | Jim.. | Prescot|
|00000f60| 74 20 66 6f 72 20 73 75 | 67 67 65 73 74 69 6e 67 |t for su|ggesting|
|00000f70| 20 74 68 69 73 2e 29 0a | 0a 54 68 65 20 61 63 63 | this.).|.The acc|
|00000f80| 6f 6d 70 61 6e 79 69 6e | 67 20 66 69 6c 65 20 63 |ompanyin|g file c|
|00000f90| 61 6c 6c 65 64 20 22 52 | 65 61 64 4d 65 2e 6f 72 |alled "R|eadMe.or|
|00000fa0| 69 67 22 20 63 61 6d 65 | 20 77 69 74 68 20 74 68 |ig" came| with th|
|00000fb0| 65 20 6f 72 69 67 69 6e | 61 6c 20 64 69 73 74 72 |e origin|al distr|
|00000fc0| 69 62 75 74 69 6f 6e 0a | 61 73 20 52 45 41 44 4d |ibution.|as READM|
|00000fd0| 45 20 61 6e 64 20 73 74 | 61 74 65 73 20 74 68 69 |E and st|ates thi|
|00000fe0| 73 20 70 72 6f 67 72 61 | 6d 20 69 73 20 63 6f 70 |s progra|m is cop|
|00000ff0| 79 72 69 67 68 74 65 64 | 20 62 75 74 20 77 69 74 |yrighted| but wit|
|00001000| 68 20 70 65 72 6d 69 73 | 73 69 6f 6e 20 74 6f 20 |h permis|sion to |
|00001010| 6d 6f 64 69 66 79 0a 61 | 6e 64 20 72 65 64 69 73 |modify.a|nd redis|
|00001020| 74 72 69 62 75 74 65 2e | 0a 0a 41 6e 64 72 65 77 |tribute.|..Andrew|
|00001030| 20 57 2e 20 52 6f 67 65 | 72 73 0a 0a 41 64 64 69 | W. Roge|rs..Addi|
|00001040| 74 69 6f 6e 61 6c 20 6e | 6f 74 65 3a 20 54 68 69 |tional n|ote: Thi|
|00001050| 73 20 64 69 73 74 72 69 | 62 75 74 69 6f 6e 20 69 |s distri|bution i|
|00001060| 6e 63 6c 75 64 65 73 20 | 61 20 56 4d 53 20 48 45 |ncludes |a VMS HE|
|00001070| 4c 50 20 66 69 6c 65 20 | 77 72 69 74 74 65 6e 20 |LP file |written |
|00001080| 62 79 0a 52 69 63 68 61 | 72 64 20 44 79 73 6f 6e |by.Richa|rd Dyson|
|00001090| 2e 20 20 43 6f 75 6e 74 | 6c 65 73 73 20 6f 74 68 |. Count|less oth|
|000010a0| 65 72 20 70 65 6f 70 6c | 65 20 77 6f 72 6b 65 64 |er peopl|e worked|
|000010b0| 20 6f 6e 20 70 63 61 6c | 20 6c 6f 6e 67 20 62 65 | on pcal| long be|
|000010c0| 66 6f 72 65 20 6d 65 3b | 20 73 65 65 0a 74 68 65 |fore me;| see.the|
|000010d0| 20 52 65 61 64 4d 65 2e | 6f 72 69 67 20 66 69 6c | ReadMe.|orig fil|
|000010e0| 65 20 61 6e 64 20 74 6f | 70 6c 69 6e 65 20 63 6f |e and to|pline co|
|000010f0| 6d 6d 65 6e 74 73 20 69 | 6e 20 70 63 61 6c 2e 63 |mments i|n pcal.c|
|00001100| 2e 0a 0a 53 48 41 52 5f | 45 4f 46 0a 66 69 0a 69 |...SHAR_|EOF.fi.i|
|00001110| 66 20 74 65 73 74 20 2d | 66 20 27 52 65 61 64 4d |f test -|f 'ReadM|
|00001120| 65 2e 6f 72 69 67 27 0a | 74 68 65 6e 0a 09 65 63 |e.orig'.|then..ec|
|00001130| 68 6f 20 73 68 61 72 3a | 20 77 69 6c 6c 20 6e 6f |ho shar:| will no|
|00001140| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|00001150| 73 74 69 6e 67 20 66 69 | 6c 65 20 27 52 65 61 64 |sting fi|le 'Read|
|00001160| 4d 65 2e 6f 72 69 67 27 | 0a 65 6c 73 65 0a 63 61 |Me.orig'|.else.ca|
|00001170| 74 20 3c 3c 20 5c 53 48 | 41 52 5f 45 4f 46 20 3e |t << \SH|AR_EOF >|
|00001180| 20 27 52 65 61 64 4d 65 | 2e 6f 72 69 67 27 0a 22 | 'ReadMe|.orig'."|
|00001190| 50 63 61 6c 22 20 69 73 | 20 61 20 70 72 6f 67 72 |Pcal" is| a progr|
|000011a0| 61 6d 20 74 6f 20 70 72 | 69 6e 74 20 50 6f 73 74 |am to pr|int Post|
|000011b0| 53 63 72 69 70 74 20 63 | 61 6c 65 6e 64 61 72 73 |Script c|alendars|
|000011c0| 20 66 6f 72 20 61 6e 79 | 20 6d 6f 6e 74 68 20 61 | for any| month a|
|000011d0| 6e 64 20 79 65 61 72 2e | 0a 42 79 20 64 65 66 61 |nd year.|.By defa|
|000011e0| 75 6c 74 2c 20 69 74 20 | 6c 6f 6f 6b 73 20 66 6f |ult, it |looks fo|
|000011f0| 72 20 61 20 66 69 6c 65 | 20 69 6e 20 74 68 65 20 |r a file| in the |
|00001200| 68 6f 6d 65 20 64 69 72 | 65 63 74 6f 72 79 20 6e |home dir|ectory n|
|00001210| 61 6d 65 64 20 22 63 61 | 6c 65 6e 64 61 72 22 0a |amed "ca|lendar".|
|00001220| 66 6f 72 20 65 6e 74 72 | 69 65 73 20 77 69 74 68 |for entr|ies with|
|00001230| 20 6c 65 61 64 69 6e 67 | 20 64 61 74 65 73 20 6d | leading| dates m|
|00001240| 61 74 63 68 69 6e 67 20 | 64 61 74 65 73 20 6f 6e |atching |dates on|
|00001250| 20 74 68 65 20 63 61 6c | 65 6e 64 61 72 2c 20 61 | the cal|endar, a|
|00001260| 6e 64 20 70 72 69 6e 74 | 73 0a 61 6e 79 20 66 6f |nd print|s.any fo|
|00001270| 6c 6c 6f 77 69 6e 67 20 | 74 65 78 74 20 75 6e 64 |llowing |text und|
|00001280| 65 72 20 74 68 65 20 61 | 70 70 72 6f 70 72 69 61 |er the a|ppropria|
|00001290| 74 65 20 64 61 79 2e 0a | 0a 54 68 65 20 70 72 6f |te day..|.The pro|
|000012a0| 67 72 61 6d 20 6d 61 79 | 20 62 65 20 61 20 6c 69 |gram may| be a li|
|000012b0| 74 74 6c 65 20 53 79 73 | 74 65 6d 20 56 20 66 6c |ttle Sys|tem V fl|
|000012c0| 61 76 6f 72 65 64 20 28 | 67 65 74 6f 70 74 2c 20 |avored (|getopt, |
|000012d0| 74 69 6d 65 20 72 6f 75 | 74 69 6e 65 73 29 0a 62 |time rou|tines).b|
|000012e0| 75 74 20 73 68 6f 75 6c | 64 20 62 65 20 65 61 73 |ut shoul|d be eas|
|000012f0| 69 6c 79 20 70 6f 72 74 | 61 62 6c 65 20 74 6f 20 |ily port|able to |
|00001300| 6f 74 68 65 72 20 76 69 | 6e 74 61 67 65 73 20 6f |other vi|ntages o|
|00001310| 66 20 55 4e 49 58 2e 0a | 0a 50 63 61 6c 20 69 73 |f UNIX..|.Pcal is|
|00001320| 20 74 68 65 20 63 6f 6d | 62 69 6e 65 64 20 65 66 | the com|bined ef|
|00001330| 66 6f 72 74 20 6f 66 20 | 73 65 76 65 72 61 6c 20 |fort of |several |
|00001340| 70 65 6f 70 6c 65 2c 20 | 6d 6f 73 74 20 6e 6f 74 |people, |most not|
|00001350| 61 62 6c 79 20 50 61 74 | 72 69 63 6b 20 57 6f 6f |ably Pat|rick Woo|
|00001360| 64 0a 6f 66 20 50 69 70 | 65 6c 69 6e 65 20 41 73 |d.of Pip|eline As|
|00001370| 73 6f 63 69 61 74 65 73 | 2c 20 49 6e 63 2e 20 66 |sociates|, Inc. f|
|00001380| 6f 72 20 74 68 65 20 6f | 72 69 67 69 6e 61 6c 20 |or the o|riginal |
|00001390| 50 6f 73 74 53 63 72 69 | 70 74 20 63 6f 64 65 20 |PostScri|pt code |
|000013a0| 61 6e 64 20 42 69 6c 6c | 0a 56 6f 67 65 6c 20 6f |and Bill|.Vogel o|
|000013b0| 66 20 41 54 26 54 20 66 | 6f 72 20 74 68 65 20 63 |f AT&T f|or the c|
|000013c0| 61 6c 65 6e 64 61 72 20 | 66 69 6c 65 20 6d 65 63 |alendar |file mec|
|000013d0| 68 61 6e 69 73 6d 2e 20 | 20 4d 79 20 70 61 72 74 |hanism. | My part|
|000013e0| 20 77 61 73 20 73 69 6d | 70 6c 65 0a 74 72 61 6e | was sim|ple.tran|
|000013f0| 73 6c 61 74 69 6f 6e 20 | 74 6f 20 61 20 22 43 22 |slation |to a "C"|
|00001400| 20 70 72 6f 67 72 61 6d | 2c 20 74 68 65 20 61 64 | program|, the ad|
|00001410| 64 69 74 69 6f 6e 20 6f | 66 20 61 20 63 6f 75 70 |dition o|f a coup|
|00001420| 6c 65 20 6f 70 74 69 6f | 6e 73 20 61 6e 64 20 61 |le optio|ns and a|
|00001430| 20 6d 6f 72 65 0a 67 65 | 6e 65 72 61 6c 69 7a 65 | more.ge|neralize|
|00001440| 64 20 64 61 74 65 20 73 | 65 61 72 63 68 69 6e 67 |d date s|earching|
|00001450| 20 72 6f 75 74 69 6e 65 | 20 28 6f 68 20 79 65 73 | routine| (oh yes|
|00001460| 2c 20 61 6e 64 20 61 20 | 6d 61 6e 75 61 6c 20 70 |, and a |manual p|
|00001470| 61 67 65 20 3a 2d 29 2e | 0a 0a 54 68 65 20 6f 72 |age :-).|..The or|
|00001480| 69 67 69 6e 61 6c 20 63 | 61 6c 65 6e 64 61 72 20 |iginal c|alendar |
|00001490| 50 6f 73 74 53 63 72 69 | 70 74 20 77 61 73 20 43 |PostScri|pt was C|
|000014a0| 6f 70 79 72 69 67 68 74 | 20 28 63 29 20 31 39 38 |opyright| (c) 198|
|000014b0| 37 20 62 79 20 50 61 74 | 72 69 63 6b 20 57 6f 6f |7 by Pat|rick Woo|
|000014c0| 64 0a 61 6e 64 20 50 69 | 70 65 6c 69 6e 65 20 41 |d.and Pi|peline A|
|000014d0| 73 73 6f 63 69 61 74 65 | 73 2c 20 49 6e 63 2e 20 |ssociate|s, Inc. |
|000014e0| 77 69 74 68 20 70 65 72 | 6d 69 73 73 69 6f 6e 20 |with per|mission |
|000014f0| 74 6f 20 6d 6f 64 69 66 | 79 20 61 6e 64 20 72 65 |to modif|y and re|
|00001500| 64 69 73 74 72 69 62 75 | 74 65 2e 0a 50 6c 65 61 |distribu|te..Plea|
|00001510| 73 65 20 72 65 74 61 69 | 6e 20 74 68 69 73 20 52 |se retai|n this R|
|00001520| 45 41 44 4d 45 20 66 69 | 6c 65 20 77 69 74 68 20 |EADME fi|le with |
|00001530| 74 68 65 20 70 61 63 6b | 61 67 65 2e 0a 0a 0a 4b |the pack|age....K|
|00001540| 65 6e 20 4b 65 69 72 6e | 61 6e 0a 50 61 63 69 66 |en Keirn|an.Pacif|
|00001550| 69 63 20 42 65 6c 6c 0a | 53 61 6e 20 52 61 6d 6f |ic Bell.|San Ramo|
|00001560| 6e 2c 20 43 41 2e 0a 53 | 48 41 52 5f 45 4f 46 0a |n, CA..S|HAR_EOF.|
|00001570| 66 69 0a 69 66 20 74 65 | 73 74 20 2d 66 20 27 63 |fi.if te|st -f 'c|
|00001580| 61 6c 65 6e 64 61 72 27 | 0a 74 68 65 6e 0a 09 65 |alendar'|.then..e|
|00001590| 63 68 6f 20 73 68 61 72 | 3a 20 77 69 6c 6c 20 6e |cho shar|: will n|
|000015a0| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|000015b0| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 27 63 61 6c |isting f|ile 'cal|
|000015c0| 65 6e 64 61 72 27 0a 65 | 6c 73 65 0a 63 61 74 20 |endar'.e|lse.cat |
|000015d0| 3c 3c 20 5c 53 48 41 52 | 5f 45 4f 46 20 3e 20 27 |<< \SHAR|_EOF > '|
|000015e0| 63 61 6c 65 6e 64 61 72 | 27 0a 23 20 53 61 6d 70 |calendar|'.# Samp|
|000015f0| 6c 65 20 63 61 6c 65 6e | 64 61 72 20 66 69 6c 65 |le calen|dar file|
|00001600| 20 66 6f 72 20 70 63 61 | 6c 0a 23 0a 23 20 54 68 | for pca|l.#.# Th|
|00001610| 69 73 20 73 68 6f 75 6c | 64 20 62 65 20 7e 2f 63 |is shoul|d be ~/c|
|00001620| 61 6c 65 6e 64 61 72 20 | 6f 6e 20 55 6e 69 78 2c |alendar |on Unix,|
|00001630| 20 53 59 53 24 4c 4f 47 | 49 4e 3a 43 41 4c 45 4e | SYS$LOG|IN:CALEN|
|00001640| 44 41 52 2e 44 41 54 20 | 6f 6e 20 56 4d 53 0a 23 |DAR.DAT |on VMS.#|
|00001650| 0a 23 20 56 61 6c 69 64 | 20 65 6e 74 72 69 65 73 |.# Valid| entries|
|00001660| 20 61 72 65 20 6f 66 20 | 74 68 65 20 66 6f 6c 6c | are of |the foll|
|00001670| 6f 77 69 6e 67 20 66 6f | 72 6d 73 3a 0a 23 0a 23 |owing fo|rms:.#.#|
|00001680| 09 6f 70 74 20 3c 6f 70 | 74 69 6f 6e 73 3e 0a 23 |.opt <op|tions>.#|
|00001690| 09 79 65 61 72 20 3c 79 | 65 61 72 3e 0a 23 09 3c |.year <y|ear>.#.<|
|000016a0| 6d 6f 6e 74 68 5f 6e 61 | 6d 65 3e 20 3c 64 61 79 |month_na|me> <day|
|000016b0| 3e 7b 2a 7d 20 7b 3c 74 | 65 78 74 3e 7d 0a 23 09 |>{*} {<t|ext>}.#.|
|000016c0| 3c 6d 6f 6e 74 68 3e 3c | 73 65 70 3e 3c 64 61 79 |<month><|sep><day|
|000016d0| 3e 7b 3c 73 65 70 3e 3c | 79 65 61 72 3e 7d 7b 2a |>{<sep><|year>}{*|
|000016e0| 7d 20 7b 3c 74 65 78 74 | 3e 7d 0a 23 0a 23 20 77 |} {<text|>}.#.# w|
|000016f0| 68 65 72 65 3a 0a 23 09 | 3c 6f 70 74 69 6f 6e 73 |here:.#.|<options|
|00001700| 3e 20 3a 3d 20 6f 6e 65 | 20 6f 72 20 6d 6f 72 65 |> := one| or more|
|00001710| 20 76 61 6c 69 64 20 63 | 6f 6d 6d 61 6e 64 2d 6c | valid c|ommand-l|
|00001720| 69 6e 65 20 6f 70 74 69 | 6f 6e 73 20 28 65 78 63 |ine opti|ons (exc|
|00001730| 65 70 74 20 2d 65 20 61 | 6e 64 20 2d 66 29 0a 23 |ept -e a|nd -f).#|
|00001740| 09 3c 6d 6f 6e 74 68 5f | 6e 61 6d 65 3e 20 3a 3d |.<month_|name> :=|
|00001750| 20 66 69 72 73 74 20 33 | 2b 20 63 68 61 72 61 63 | first 3|+ charac|
|00001760| 74 65 72 73 20 6f 66 20 | 6e 61 6d 65 20 6f 66 20 |ters of |name of |
|00001770| 6d 6f 6e 74 68 20 28 69 | 6e 20 45 6e 67 6c 69 73 |month (i|n Englis|
|00001780| 68 29 0a 23 09 3c 73 65 | 70 3e 20 3a 3d 20 6f 6e |h).#.<se|p> := on|
|00001790| 65 20 6f 72 20 6d 6f 72 | 65 20 6e 6f 6e 2d 6e 75 |e or mor|e non-nu|
|000017a0| 6d 65 72 69 63 2c 20 6e | 6f 6e 2d 73 70 61 63 65 |meric, n|on-space|
|000017b0| 2c 20 6e 6f 6e 2d 27 2a | 27 20 63 68 61 72 61 63 |, non-'*|' charac|
|000017c0| 74 65 72 73 0a 23 09 3c | 74 65 78 74 3e 20 69 73 |ters.#.<|text> is|
|000017d0| 20 74 68 65 20 74 65 78 | 74 20 74 6f 20 62 65 20 | the tex|t to be |
|000017e0| 70 72 69 6e 74 65 64 20 | 69 6e 20 74 68 65 20 63 |printed |in the c|
|000017f0| 61 6c 65 6e 64 61 72 20 | 62 6f 78 0a 23 09 3c 64 |alendar |box.#.<d|
|00001800| 61 79 3e 2c 20 3c 6d 6f | 6e 74 68 3e 2c 20 61 6e |ay>, <mo|nth>, an|
|00001810| 64 20 3c 79 65 61 72 3e | 20 61 72 65 20 61 70 70 |d <year>| are app|
|00001820| 72 6f 70 72 69 61 74 65 | 20 69 6e 74 65 67 65 72 |ropriate| integer|
|00001830| 73 0a 23 0a 23 09 77 68 | 69 74 65 73 70 61 63 65 |s.#.#.wh|itespace|
|00001840| 20 69 73 20 74 6f 20 62 | 65 20 75 73 65 64 2f 61 | is to b|e used/a|
|00001850| 76 6f 69 64 65 64 20 61 | 73 20 69 6d 70 6c 69 65 |voided a|s implie|
|00001860| 64 20 62 79 20 74 68 65 | 20 61 62 6f 76 65 20 70 |d by the| above p|
|00001870| 72 6f 64 75 63 74 69 6f | 6e 73 0a 23 09 27 2a 27 |roductio|ns.#.'*'|
|00001880| 20 66 6c 61 67 73 20 74 | 68 65 20 64 61 74 65 20 | flags t|he date |
|00001890| 61 73 20 61 20 68 6f 6c | 69 64 61 79 20 28 74 6f |as a hol|iday (to|
|000018a0| 20 62 65 20 70 72 69 6e | 74 65 64 20 69 6e 20 67 | be prin|ted in g|
|000018b0| 72 61 79 29 0a 23 09 63 | 6f 6d 6d 65 6e 74 73 20 |ray).#.c|omments |
|000018c0| 72 75 6e 20 66 72 6f 6d | 20 27 23 27 20 74 68 72 |run from| '#' thr|
|000018d0| 6f 75 67 68 20 65 6e 64 | 2d 6f 66 2d 6c 69 6e 65 |ough end|-of-line|
|000018e0| 0a 0a 23 20 41 20 73 61 | 6d 70 6c 65 20 22 6f 70 |..# A sa|mple "op|
|000018f0| 74 22 20 6c 69 6e 65 20 | 74 6f 20 63 68 61 6e 67 |t" line |to chang|
|00001900| 65 20 74 68 65 20 66 6f | 6e 74 73 20 61 6e 64 20 |e the fo|nts and |
|00001910| 6f 75 74 70 75 74 20 66 | 69 6c 65 20 6e 61 6d 65 |output f|ile name|
|00001920| 73 20 61 6e 64 20 74 6f | 20 70 72 69 6e 74 0a 23 |s and to| print.#|
|00001930| 20 6f 6e 6c 79 20 53 75 | 6e 64 61 79 73 20 69 6e | only Su|ndays in|
|00001940| 20 67 72 61 79 3a 0a 23 | 0a 23 6f 70 74 20 2d 64 | gray:.#|.#opt -d|
|00001950| 20 48 65 6c 76 65 74 69 | 63 61 2d 42 6f 6c 64 20 | Helveti|ca-Bold |
|00001960| 2d 74 20 48 65 6c 76 65 | 74 69 63 61 2d 42 6f 6c |-t Helve|tica-Bol|
|00001970| 64 20 2d 6f 20 6d 79 66 | 69 6c 65 2e 70 73 20 2d |d -o myf|ile.ps -|
|00001980| 62 20 61 6c 6c 20 2d 67 | 20 73 75 6e 0a 0a 79 65 |b all -g| sun..ye|
|00001990| 61 72 20 31 39 39 30 09 | 09 09 09 23 20 73 65 74 |ar 1990.|...# set|
|000019a0| 20 79 65 61 72 20 65 78 | 70 6c 69 63 69 74 6c 79 | year ex|plicitly|
|000019b0| 0a 0a 35 2f 32 38 2a 20 | 4d 65 6d 6f 72 69 61 6c |..5/28* |Memorial|
|000019c0| 20 44 61 79 20 28 6f 62 | 73 65 72 76 65 64 29 09 | Day (ob|served).|
|000019d0| 09 23 20 27 2a 27 20 70 | 72 69 6e 74 73 20 68 6f |.# '*' p|rints ho|
|000019e0| 6c 69 64 61 79 20 69 6e | 20 67 72 61 79 0a 35 2f |liday in| gray.5/|
|000019f0| 33 31 20 4d 65 6d 6f 72 | 69 61 6c 20 44 61 79 0a |31 Memor|ial Day.|
|00001a00| 0a 37 2f 34 2f 39 30 2a | 20 49 6e 64 65 70 65 6e |.7/4/90*| Indepen|
|00001a10| 64 65 6e 63 65 20 44 61 | 79 09 09 23 20 66 75 6c |dence Da|y..# ful|
|00001a20| 6c 20 64 61 74 65 20 66 | 6f 72 6d 61 74 0a 0a 53 |l date f|ormat..S|
|00001a30| 65 70 20 33 2a 20 4c 61 | 62 6f 72 20 44 61 79 09 |ep 3* La|bor Day.|
|00001a40| 09 09 23 20 6d 6f 6e 74 | 68 20 77 72 69 74 74 65 |..# mont|h writte|
|00001a50| 6e 20 6f 75 74 0a 0a 31 | 30 2f 38 2a 20 43 6f 6c |n out..1|0/8* Col|
|00001a60| 75 6d 62 75 73 20 44 61 | 79 20 28 6f 62 73 65 72 |umbus Da|y (obser|
|00001a70| 76 65 64 29 0a 31 30 2f | 31 32 20 43 6f 6c 75 6d |ved).10/|12 Colum|
|00001a80| 62 75 73 20 44 61 79 0a | 0a 31 31 2f 32 32 2a 20 |bus Day.|.11/22* |
|00001a90| 54 68 61 6e 6b 73 67 69 | 76 69 6e 67 0a 31 31 2f |Thanksgi|ving.11/|
|00001aa0| 32 33 2a 09 09 09 09 09 | 23 20 68 6f 6c 69 64 61 |23*.....|# holida|
|00001ab0| 79 20 77 69 74 68 6f 75 | 74 20 74 65 78 74 0a 0a |y withou|t text..|
|00001ac0| 31 32 2f 32 34 2a 20 43 | 68 72 69 73 74 6d 61 73 |12/24* C|hristmas|
|00001ad0| 0a 31 32 2f 32 35 2a 0a | 0a 31 2f 31 2f 39 31 2a |.12/25*.|.1/1/91*|
|00001ae0| 20 4e 65 77 20 59 65 61 | 72 27 73 20 44 61 79 09 | New Yea|r's Day.|
|00001af0| 09 09 23 20 73 65 74 20 | 6e 65 77 20 79 65 61 72 |..# set |new year|
|00001b00| 20 69 6d 70 6c 69 63 69 | 74 6c 79 0a 53 48 41 52 | implici|tly.SHAR|
|00001b10| 5f 45 4f 46 0a 66 69 0a | 69 66 20 74 65 73 74 20 |_EOF.fi.|if test |
|00001b20| 2d 66 20 27 70 63 61 6c | 2e 63 27 0a 74 68 65 6e |-f 'pcal|.c'.then|
|00001b30| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 77 69 6c |..echo s|har: wil|
|00001b40| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|00001b50| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 27 | existin|g file '|
|00001b60| 70 63 61 6c 2e 63 27 0a | 65 6c 73 65 0a 63 61 74 |pcal.c'.|else.cat|
|00001b70| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00001b80| 27 70 63 61 6c 2e 63 27 | 0a 2f 2a 0a 20 2a 20 70 |'pcal.c'|./*. * p|
|00001b90| 63 61 6c 2e 63 20 2d 20 | 67 65 6e 65 72 61 74 65 |cal.c - |generate|
|00001ba0| 20 50 6f 73 74 53 63 72 | 69 70 74 20 66 69 6c 65 | PostScr|ipt file|
|00001bb0| 20 74 6f 20 70 72 69 6e | 74 20 63 61 6c 65 6e 64 | to prin|t calend|
|00001bc0| 61 72 20 66 6f 72 20 61 | 6e 79 20 6d 6f 6e 74 68 |ar for a|ny month|
|00001bd0| 20 61 6e 64 20 79 65 61 | 72 0a 20 2a 0a 20 2a 20 | and yea|r. *. * |
|00001be0| 54 68 65 20 6f 72 69 67 | 69 6e 61 6c 20 50 6f 73 |The orig|inal Pos|
|00001bf0| 74 53 63 72 69 70 74 20 | 63 6f 64 65 20 74 6f 20 |tScript |code to |
|00001c00| 67 65 6e 65 72 61 74 65 | 20 74 68 65 20 63 61 6c |generate| the cal|
|00001c10| 65 6e 64 61 72 73 20 77 | 61 73 20 77 72 69 74 74 |endars w|as writt|
|00001c20| 65 6e 20 62 79 0a 20 2a | 20 50 61 74 72 69 63 6b |en by. *| Patrick|
|00001c30| 20 57 6f 6f 64 20 28 43 | 6f 70 79 77 72 69 74 65 | Wood (C|opywrite|
|00001c40| 20 28 63 29 20 31 39 38 | 37 20 62 79 20 50 61 74 | (c) 198|7 by Pat|
|00001c50| 72 69 63 6b 20 57 6f 6f | 64 20 6f 66 20 50 69 70 |rick Woo|d of Pip|
|00001c60| 65 6c 69 6e 65 20 41 73 | 73 6f 63 69 61 74 65 73 |eline As|sociates|
|00001c70| 2c 0a 20 2a 20 49 6e 63 | 2e 29 2c 20 61 6e 64 20 |,. * Inc|.), and |
|00001c80| 61 75 74 68 6f 72 69 7a | 65 64 20 66 6f 72 20 6d |authoriz|ed for m|
|00001c90| 6f 64 69 66 69 63 61 74 | 69 6f 6e 20 61 6e 64 20 |odificat|ion and |
|00001ca0| 72 65 64 69 73 74 72 69 | 62 75 74 69 6f 6e 2e 20 |redistri|bution. |
|00001cb0| 20 54 68 65 20 63 61 6c | 65 6e 64 61 72 0a 20 2a | The cal|endar. *|
|00001cc0| 20 66 69 6c 65 20 69 6e | 63 6c 75 73 69 6f 6e 20 | file in|clusion |
|00001cd0| 63 6f 64 65 20 77 61 73 | 20 6f 72 69 67 69 6e 61 |code was| origina|
|00001ce0| 6c 6c 79 20 77 72 69 74 | 74 65 6e 20 69 6e 20 22 |lly writ|ten in "|
|00001cf0| 62 73 28 31 29 22 20 62 | 79 20 42 69 6c 6c 20 56 |bs(1)" b|y Bill V|
|00001d00| 6f 67 65 6c 20 6f 66 0a | 20 2a 20 41 54 26 54 2e |ogel of.| * AT&T.|
|00001d10| 20 20 50 61 74 72 69 63 | 6b 27 73 20 6f 72 69 67 | Patric|k's orig|
|00001d20| 69 6e 61 6c 20 50 6f 73 | 74 53 63 72 69 70 74 20 |inal Pos|tScript |
|00001d30| 77 61 73 20 6d 6f 64 69 | 66 69 65 64 20 61 6e 64 |was modi|fied and|
|00001d40| 20 65 6e 68 61 6e 63 65 | 64 20 73 65 76 65 72 61 | enhance|d severa|
|00001d50| 6c 0a 20 2a 20 74 69 6d | 65 73 20 62 79 20 6f 74 |l. * tim|es by ot|
|00001d60| 68 65 72 73 20 77 68 6f | 73 65 20 6e 61 6d 65 73 |hers who|se names|
|00001d70| 20 68 61 76 65 20 72 65 | 67 72 65 74 74 61 62 6c | have re|grettabl|
|00001d80| 79 20 62 65 65 6e 20 6c | 6f 73 74 2e 20 20 54 68 |y been l|ost. Th|
|00001d90| 69 73 20 43 20 76 65 72 | 73 69 6f 6e 0a 20 2a 20 |is C ver|sion. * |
|00001da0| 77 61 73 20 6f 72 69 67 | 69 6e 61 6c 6c 79 20 63 |was orig|inally c|
|00001db0| 72 65 61 74 65 64 20 62 | 79 20 4b 65 6e 20 4b 65 |reated b|y Ken Ke|
|00001dc0| 69 72 6e 61 6e 20 6f 66 | 20 50 61 63 69 66 69 63 |irnan of| Pacific|
|00001dd0| 20 42 65 6c 6c 3b 20 61 | 64 64 69 74 69 6f 6e 61 | Bell; a|dditiona|
|00001de0| 6c 0a 20 2a 20 65 6e 68 | 61 6e 63 65 6d 65 6e 74 |l. * enh|ancement|
|00001df0| 73 20 62 79 20 4a 6f 73 | 65 70 68 20 50 2e 20 4c |s by Jos|eph P. L|
|00001e00| 61 72 73 6f 6e 2c 20 45 | 64 20 48 61 6e 64 2c 20 |arson, E|d Hand, |
|00001e10| 61 6e 64 20 41 6e 64 72 | 65 77 20 52 6f 67 65 72 |and Andr|ew Roger|
|00001e20| 73 20 28 77 68 6f 20 61 | 6c 73 6f 0a 20 2a 20 64 |s (who a|lso. * d|
|00001e30| 69 64 20 74 68 65 20 56 | 4d 53 20 70 6f 72 74 29 |id the V|MS port)|
|00001e40| 2e 0a 20 2a 0a 20 2a 20 | 52 65 76 69 73 69 6f 6e |.. *. * |Revision|
|00001e50| 20 68 69 73 74 6f 72 79 | 3a 0a 20 2a 0a 20 2a 09 | history|:. *. *.|
|00001e60| 32 2e 30 30 09 41 57 52 | 09 30 38 2f 30 38 2f 39 |2.00.AWR|.08/08/9|
|00001e70| 30 09 69 6e 63 6c 75 64 | 65 64 20 72 65 76 69 73 |0.includ|ed revis|
|00001e80| 69 6f 6e 20 68 69 73 74 | 6f 72 79 3b 20 72 65 70 |ion hist|ory; rep|
|00001e90| 6c 61 63 65 64 20 2d 72 | 0a 20 2a 09 09 09 09 09 |laced -r|. *.....|
|00001ea0| 66 6c 61 67 20 77 69 74 | 68 20 2d 6c 20 61 6e 64 |flag wit|h -l and|
|00001eb0| 20 2d 70 3b 20 72 65 70 | 6c 61 63 65 64 20 2d 73 | -p; rep|laced -s|
|00001ec0| 20 61 6e 64 20 2d 53 0a | 20 2a 09 09 09 09 09 66 | and -S.| *.....f|
|00001ed0| 6c 61 67 73 20 77 69 74 | 68 20 2d 62 20 61 6e 64 |lags wit|h -b and|
|00001ee0| 20 2d 67 3b 20 72 65 63 | 6f 67 6e 69 7a 65 20 66 | -g; rec|ognize f|
|00001ef0| 6c 61 67 73 0a 20 2a 09 | 09 09 09 09 73 65 74 20 |lags. *.|....set |
|00001f00| 69 6e 20 64 61 74 65 20 | 66 69 6c 65 3b 20 74 72 |in date |file; tr|
|00001f10| 61 6e 73 6c 61 74 65 20 | 28 20 61 6e 64 20 29 20 |anslate |( and ) |
|00001f20| 69 6e 0a 20 2a 09 09 09 | 09 09 74 65 78 74 20 74 |in. *...|..text t|
|00001f30| 6f 20 6f 63 74 61 6c 20 | 65 73 63 61 70 65 20 73 |o octal |escape s|
|00001f40| 65 71 75 65 6e 63 65 3b | 20 75 73 61 67 65 28 29 |equence;| usage()|
|00001f50| 0a 20 2a 09 09 09 09 09 | 6d 65 73 73 61 67 65 20 |. *.....|message |
|00001f60| 63 6f 6e 64 65 6e 73 65 | 64 20 74 6f 20 66 69 74 |condense|d to fit|
|00001f70| 20 32 34 78 38 30 20 73 | 63 72 65 65 6e 0a 20 2a | 24x80 s|creen. *|
|00001f80| 0a 20 2a 09 50 61 72 61 | 6d 65 74 65 72 73 3a 0a |. *.Para|meters:.|
|00001f90| 20 2a 0a 20 2a 09 09 70 | 63 61 6c 20 5b 6f 70 74 | *. *..p|cal [opt|
|00001fa0| 73 5d 09 09 67 65 6e 65 | 72 61 74 65 20 63 61 6c |s]..gene|rate cal|
|00001fb0| 65 6e 64 61 72 20 66 6f | 72 20 63 75 72 72 65 6e |endar fo|r curren|
|00001fc0| 74 20 6d 6f 6e 74 68 2f | 79 65 61 72 0a 20 2a 0a |t month/|year. *.|
|00001fd0| 20 2a 09 09 70 63 61 6c | 20 5b 6f 70 74 73 5d 20 | *..pcal| [opts] |
|00001fe0| 79 79 09 09 67 65 6e 65 | 72 61 74 65 20 63 61 6c |yy..gene|rate cal|
|00001ff0| 65 6e 64 61 72 20 66 6f | 72 20 65 6e 74 69 72 65 |endar fo|r entire|
|00002000| 20 79 65 61 72 20 79 79 | 0a 20 2a 0a 20 2a 09 09 | year yy|. *. *..|
|00002010| 70 63 61 6c 20 5b 6f 70 | 74 73 5d 20 6d 6d 20 79 |pcal [op|ts] mm y|
|00002020| 79 09 67 65 6e 65 72 61 | 74 65 20 63 61 6c 65 6e |y.genera|te calen|
|00002030| 64 61 72 20 66 6f 72 20 | 6d 6f 6e 74 68 20 6d 6d |dar for |month mm|
|00002040| 0a 20 2a 09 09 09 09 09 | 28 4a 61 6e 20 3d 20 31 |. *.....|(Jan = 1|
|00002050| 29 2c 20 79 65 61 72 20 | 79 79 20 28 31 39 79 79 |), year |yy (19yy|
|00002060| 20 69 66 20 79 79 20 3c | 20 31 30 30 29 0a 20 2a | if yy <| 100). *|
|00002070| 0a 20 2a 09 09 70 63 61 | 6c 20 5b 6f 70 74 73 5d |. *..pca|l [opts]|
|00002080| 20 6d 6d 20 79 79 20 6e | 09 61 73 20 61 62 6f 76 | mm yy n|.as abov|
|00002090| 65 2c 20 66 6f 72 20 6e | 20 63 6f 6e 73 65 63 75 |e, for n| consecu|
|000020a0| 74 69 76 65 20 6d 6f 6e | 74 68 73 0a 20 2a 0a 20 |tive mon|ths. *. |
|000020b0| 2a 09 4f 75 74 70 75 74 | 3a 0a 20 2a 0a 20 2a 09 |*.Output|:. *. *.|
|000020c0| 09 50 6f 73 74 53 63 72 | 69 70 74 20 66 69 6c 65 |.PostScr|ipt file|
|000020d0| 20 74 6f 20 70 72 69 6e | 74 20 63 61 6c 65 6e 64 | to prin|t calend|
|000020e0| 61 72 73 20 66 6f 72 20 | 61 6c 6c 20 73 65 6c 65 |ars for |all sele|
|000020f0| 63 74 65 64 20 6d 6f 6e | 74 68 73 2e 0a 20 2a 0a |cted mon|ths.. *.|
|00002100| 20 2a 09 4f 70 74 69 6f | 6e 73 3a 0a 20 2a 0a 20 | *.Optio|ns:. *. |
|00002110| 2a 09 09 2d 62 20 3c 44 | 41 59 3e 09 70 72 69 6e |*..-b <D|AY>.prin|
|00002120| 74 20 73 70 65 63 69 66 | 69 65 64 20 77 65 65 6b |t specif|ied week|
|00002130| 64 61 79 20 69 6e 20 62 | 6c 61 63 6b 0a 20 2a 09 |day in b|lack. *.|
|00002140| 09 2d 67 20 3c 44 41 59 | 3e 09 70 72 69 6e 74 20 |.-g <DAY|>.print |
|00002150| 73 70 65 63 69 66 69 65 | 64 20 77 65 65 6b 64 61 |specifie|d weekda|
|00002160| 79 20 69 6e 20 67 72 61 | 79 0a 20 2a 09 09 09 09 |y in gra|y. *....|
|00002170| 28 64 65 66 61 75 6c 74 | 3a 20 70 72 69 6e 74 20 |(default|: print |
|00002180| 53 61 74 75 72 64 61 79 | 73 20 61 6e 64 20 53 75 |Saturday|s and Su|
|00002190| 6e 64 61 79 73 20 69 6e | 20 67 72 61 79 29 0a 20 |ndays in| gray). |
|000021a0| 2a 09 09 0a 20 2a 09 09 | 2d 64 20 3c 46 4f 4e 54 |*... *..|-d <FONT|
|000021b0| 3e 09 73 70 65 63 69 66 | 79 20 61 6c 74 65 72 6e |>.specif|y altern|
|000021c0| 61 74 65 20 66 6f 6e 74 | 20 66 6f 72 20 64 61 79 |ate font| for day|
|000021d0| 20 6e 61 6d 65 73 0a 20 | 2a 09 09 09 09 28 64 65 | names. |*....(de|
|000021e0| 66 61 75 6c 74 3a 20 54 | 69 6d 65 73 2d 42 6f 6c |fault: T|imes-Bol|
|000021f0| 64 29 0a 20 2a 0a 20 2a | 09 09 2d 65 09 09 67 65 |d). *. *|..-e..ge|
|00002200| 6e 65 72 61 74 65 20 65 | 6d 70 74 79 20 63 61 6c |nerate e|mpty cal|
|00002210| 65 6e 64 61 72 20 28 69 | 67 6e 6f 72 65 20 64 61 |endar (i|gnore da|
|00002220| 74 65 20 66 69 6c 65 29 | 0a 20 2a 0a 20 2a 09 09 |te file)|. *. *..|
|00002230| 2d 66 20 3c 46 49 4c 45 | 3e 09 73 70 65 63 69 66 |-f <FILE|>.specif|
|00002240| 79 20 61 6c 74 65 72 6e | 61 74 65 20 64 61 74 65 |y altern|ate date|
|00002250| 20 66 69 6c 65 20 28 64 | 65 66 61 75 6c 74 3a 0a | file (d|efault:.|
|00002260| 20 2a 09 09 09 09 7e 2f | 63 61 6c 65 6e 64 61 72 | *....~/|calendar|
|00002270| 20 6f 6e 20 55 6e 2a 78 | 2c 20 53 59 53 24 4c 4f | on Un*x|, SYS$LO|
|00002280| 47 49 4e 3a 43 41 4c 45 | 4e 44 41 52 2e 44 41 54 |GIN:CALE|NDAR.DAT|
|00002290| 0a 20 2a 09 09 09 09 6f | 6e 20 56 4d 53 29 0a 20 |. *....o|n VMS). |
|000022a0| 2a 0a 20 2a 09 09 2d 6f | 20 3c 46 49 4c 45 3e 09 |*. *..-o| <FILE>.|
|000022b0| 73 70 65 63 69 66 79 20 | 61 6c 74 65 72 6e 61 74 |specify |alternat|
|000022c0| 65 20 6f 75 74 70 75 74 | 20 66 69 6c 65 20 28 64 |e output| file (d|
|000022d0| 65 66 61 75 6c 74 3a 0a | 20 2a 09 09 09 09 73 74 |efault:.| *....st|
|000022e0| 64 6f 75 74 20 6f 6e 20 | 55 6e 2a 78 2c 20 43 41 |dout on |Un*x, CA|
|000022f0| 4c 45 4e 44 41 52 2e 50 | 53 20 6f 6e 20 56 4d 53 |LENDAR.P|S on VMS|
|00002300| 29 0a 20 2a 0a 20 2a 09 | 09 2d 6c 09 09 67 65 6e |). *. *.|.-l..gen|
|00002310| 65 72 61 74 65 20 6c 61 | 6e 64 73 63 61 70 65 2d |erate la|ndscape-|
|00002320| 6d 6f 64 65 20 63 61 6c | 65 6e 64 61 72 73 0a 20 |mode cal|endars. |
|00002330| 2a 09 09 2d 70 09 09 67 | 65 6e 65 72 61 74 65 20 |*..-p..g|enerate |
|00002340| 70 6f 72 74 72 61 69 74 | 2d 6d 6f 64 65 20 63 61 |portrait|-mode ca|
|00002350| 6c 65 6e 64 61 72 73 0a | 20 2a 09 09 09 09 28 64 |lendars.| *....(d|
|00002360| 65 66 61 75 6c 74 3a 20 | 6c 61 6e 64 73 63 61 70 |efault: |landscap|
|00002370| 65 2d 6d 6f 64 65 29 0a | 20 2a 0a 20 2a 09 09 2d |e-mode).| *. *..-|
|00002380| 74 20 3c 46 4f 4e 54 3e | 09 73 70 65 63 69 66 79 |t <FONT>|.specify|
|00002390| 20 61 6c 74 65 72 6e 61 | 74 65 20 66 6f 6e 74 20 | alterna|te font |
|000023a0| 66 6f 72 20 74 69 74 6c | 65 73 0a 20 2a 09 09 09 |for titl|es. *...|
|000023b0| 09 28 64 65 66 61 75 6c | 74 3a 20 54 69 6d 65 73 |.(defaul|t: Times|
|000023c0| 2d 42 6f 6c 64 29 0a 20 | 2a 0a 20 2a 09 09 50 61 |-Bold). |*. *..Pa|
|000023d0| 72 61 6d 65 74 65 72 73 | 20 61 6e 64 20 66 6c 61 |rameters| and fla|
|000023e0| 67 73 20 6d 61 79 20 62 | 65 20 6d 69 78 65 64 20 |gs may b|e mixed |
|000023f0| 6f 6e 20 74 68 65 20 63 | 6f 6d 6d 61 6e 64 20 6c |on the c|ommand l|
|00002400| 69 6e 65 2e 0a 20 2a 0a | 20 2a 09 41 6c 6c 20 62 |ine.. *.| *.All b|
|00002410| 75 74 20 74 68 65 20 2d | 65 20 61 6e 64 20 2d 66 |ut the -|e and -f|
|00002420| 20 6f 70 74 69 6f 6e 73 | 20 6d 61 79 20 62 65 20 | options| may be |
|00002430| 73 70 65 63 69 66 69 65 | 64 20 69 6e 20 74 68 65 |specifie|d in the|
|00002440| 20 64 61 74 65 20 66 69 | 6c 65 20 62 79 0a 20 2a | date fi|le by. *|
|00002450| 09 74 68 65 20 69 6e 63 | 6c 75 73 69 6f 6e 20 6f |.the inc|lusion o|
|00002460| 66 20 6f 6e 65 20 6f 72 | 20 6d 6f 72 65 20 6c 69 |f one or| more li|
|00002470| 6e 65 73 20 6f 66 20 74 | 68 65 20 66 6f 72 6d 20 |nes of t|he form |
|00002480| 22 6f 70 74 20 3c 6f 70 | 74 69 6f 6e 73 3e 22 2e |"opt <op|tions>".|
|00002490| 20 20 41 6e 79 0a 20 2a | 09 73 75 63 68 20 6f 70 | Any. *|.such op|
|000024a0| 74 69 6f 6e 73 20 6f 76 | 65 72 72 69 64 65 20 74 |tions ov|erride t|
|000024b0| 68 65 20 64 65 66 61 75 | 6c 74 73 2c 20 62 75 74 |he defau|lts, but|
|000024c0| 20 61 72 65 20 74 68 65 | 6d 73 65 6c 76 65 73 20 | are the|mselves |
|000024d0| 6f 76 65 72 72 69 64 64 | 65 6e 0a 20 2a 09 62 79 |overridd|en. *.by|
|000024e0| 20 6f 70 74 69 6f 6e 73 | 20 73 70 65 63 69 66 69 | options| specifi|
|000024f0| 65 64 20 65 78 70 6c 69 | 63 69 74 6c 79 20 6f 6e |ed expli|citly on|
|00002500| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 20 6c 69 6e | the com|mand lin|
|00002510| 65 2e 20 20 28 54 68 65 | 20 2d 62 2c 20 2d 64 2c |e. (The| -b, -d,|
|00002520| 0a 20 2a 09 2d 67 2c 20 | 2d 6f 2c 20 61 6e 64 20 |. *.-g, |-o, and |
|00002530| 2d 74 20 66 6c 61 67 73 | 20 6d 61 79 20 62 65 20 |-t flags| may be |
|00002540| 73 70 65 63 69 66 69 65 | 64 20 77 69 74 68 6f 75 |specifie|d withou|
|00002550| 74 20 61 72 67 75 6d 65 | 6e 74 73 20 74 6f 20 72 |t argume|nts to r|
|00002560| 65 73 65 74 0a 20 2a 09 | 74 68 65 20 63 6f 72 72 |eset. *.|the corr|
|00002570| 65 73 70 6f 6e 64 69 6e | 67 20 6f 70 74 69 6f 6e |espondin|g option|
|00002580| 73 20 74 6f 20 74 68 65 | 20 64 65 66 61 75 6c 74 |s to the| default|
|00002590| 73 2e 29 0a 20 2a 2f 0a | 0a 0c 0a 23 69 6e 63 6c |s.). */.|...#incl|
|000025a0| 75 64 65 20 3c 73 74 64 | 69 6f 2e 68 3e 0a 23 69 |ude <std|io.h>.#i|
|000025b0| 6e 63 6c 75 64 65 20 3c | 63 74 79 70 65 2e 68 3e |nclude <|ctype.h>|
|000025c0| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 74 69 6d 65 2e |.#includ|e <time.|
|000025d0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 74 72 |h>.#incl|ude <str|
|000025e0| 69 6e 67 2e 68 3e 0a 0a | 23 69 66 64 65 66 20 56 |ing.h>..|#ifdef V|
|000025f0| 4d 53 09 09 2f 2a 20 56 | 4d 53 20 6f 64 64 69 74 |MS../* V|MS oddit|
|00002600| 69 65 73 20 69 73 6f 6c | 61 74 65 64 20 68 65 72 |ies isol|ated her|
|00002610| 65 20 2a 2f 0a 0a 23 64 | 65 66 69 6e 65 20 44 41 |e */..#d|efine DA|
|00002620| 54 45 46 49 4c 45 20 20 | 22 63 61 6c 65 6e 64 61 |TEFILE |"calenda|
|00002630| 72 2e 64 61 74 22 0a 23 | 64 65 66 69 6e 65 20 4f |r.dat".#|define O|
|00002640| 55 54 46 49 4c 45 20 20 | 20 22 63 61 6c 65 6e 64 |UTFILE | "calend|
|00002650| 61 72 2e 70 73 22 0a 23 | 64 65 66 69 6e 65 20 45 |ar.ps".#|define E|
|00002660| 4e 44 5f 50 41 54 48 20 | 27 5d 27 0a 23 64 65 66 |ND_PATH |']'.#def|
|00002670| 69 6e 65 20 45 58 49 54 | 5f 53 55 43 43 45 53 53 |ine EXIT|_SUCCESS|
|00002680| 20 31 0a 23 64 65 66 69 | 6e 65 20 45 58 49 54 5f | 1.#defi|ne EXIT_|
|00002690| 46 41 49 4c 55 52 45 20 | 33 0a 0a 23 65 6c 73 65 |FAILURE |3..#else|
|000026a0| 09 09 09 2f 2a 20 6e 6f | 6e 2d 56 4d 53 20 2d 20 |.../* no|n-VMS - |
|000026b0| 61 73 73 75 6d 65 20 55 | 6e 2a 78 20 6f 66 20 73 |assume U|n*x of s|
|000026c0| 6f 6d 65 20 73 6f 72 74 | 20 2a 2f 0a 0a 23 64 65 |ome sort| */..#de|
|000026d0| 66 69 6e 65 20 44 41 54 | 45 46 49 4c 45 20 20 22 |fine DAT|EFILE "|
|000026e0| 63 61 6c 65 6e 64 61 72 | 22 0a 23 64 65 66 69 6e |calendar|".#defin|
|000026f0| 65 20 4f 55 54 46 49 4c | 45 20 20 20 22 22 0a 23 |e OUTFIL|E "".#|
|00002700| 64 65 66 69 6e 65 20 45 | 4e 44 5f 50 41 54 48 20 |define E|ND_PATH |
|00002710| 27 2f 27 0a 23 64 65 66 | 69 6e 65 20 45 58 49 54 |'/'.#def|ine EXIT|
|00002720| 5f 53 55 43 43 45 53 53 | 20 30 0a 23 64 65 66 69 |_SUCCESS| 0.#defi|
|00002730| 6e 65 20 45 58 49 54 5f | 46 41 49 4c 55 52 45 20 |ne EXIT_|FAILURE |
|00002740| 31 0a 65 78 74 65 72 6e | 20 63 68 61 72 20 2a 67 |1.extern| char *g|
|00002750| 65 74 65 6e 76 28 29 3b | 09 2f 2a 20 74 6f 20 74 |etenv();|./* to t|
|00002760| 72 61 6e 73 6c 61 74 65 | 20 22 48 4f 4d 45 22 20 |ranslate| "HOME" |
|00002770| 74 6f 20 70 61 74 68 20 | 6e 61 6d 65 20 2a 2f 0a |to path |name */.|
|00002780| 0a 23 65 6e 64 69 66 0a | 0a 23 64 65 66 69 6e 65 |.#endif.|.#define|
|00002790| 20 49 53 5f 4c 45 41 50 | 28 79 29 09 28 28 79 29 | IS_LEAP|(y).((y)|
|000027a0| 20 25 20 34 20 3d 3d 20 | 30 20 26 26 20 28 28 79 | % 4 == |0 && ((y|
|000027b0| 29 20 25 20 31 30 30 20 | 21 3d 20 30 20 7c 7c 20 |) % 100 |!= 0 || |
|000027c0| 28 79 29 20 25 20 34 30 | 30 20 3d 3d 20 30 29 29 |(y) % 40|0 == 0))|
|000027d0| 0a 23 64 65 66 69 6e 65 | 20 49 4e 49 54 5f 43 4f |.#define| INIT_CO|
|000027e0| 4c 4f 52 53 09 6d 65 6d | 63 70 79 28 63 6f 6c 6f |LORS.mem|cpy(colo|
|000027f0| 72 2c 20 64 65 66 61 75 | 6c 74 5f 63 6f 6c 6f 72 |r, defau|lt_color|
|00002800| 2c 20 73 69 7a 65 6f 66 | 28 63 6f 6c 6f 72 29 29 |, sizeof|(color))|
|00002810| 0a 0a 23 64 65 66 69 6e | 65 20 50 52 54 09 09 28 |..#defin|e PRT..(|
|00002820| 76 6f 69 64 29 70 72 69 | 6e 74 66 0a 23 64 65 66 |void)pri|ntf.#def|
|00002830| 69 6e 65 20 46 50 52 09 | 09 28 76 6f 69 64 29 66 |ine FPR.|.(void)f|
|00002840| 70 72 69 6e 74 66 0a 0a | 23 64 65 66 69 6e 65 20 |printf..|#define |
|00002850| 46 41 4c 53 45 09 30 0a | 23 64 65 66 69 6e 65 20 |FALSE.0.|#define |
|00002860| 54 52 55 45 09 31 0a 0a | 23 64 65 66 69 6e 65 20 |TRUE.1..|#define |
|00002870| 44 41 54 45 46 49 4c 45 | 5f 46 4c 41 47 53 09 22 |DATEFILE|_FLAGS."|
|00002880| 65 66 22 09 09 2f 2a 20 | 66 6c 61 67 73 20 72 65 |ef"../* |flags re|
|00002890| 6c 61 74 69 6e 67 20 74 | 6f 20 64 61 74 65 20 66 |lating t|o date f|
|000028a0| 69 6c 65 20 6e 61 6d 65 | 20 2a 2f 0a 23 64 65 66 |ile name| */.#def|
|000028b0| 69 6e 65 20 4f 54 48 45 | 52 5f 46 4c 41 47 53 09 |ine OTHE|R_FLAGS.|
|000028c0| 22 62 64 67 6c 6f 70 74 | 22 09 2f 2a 20 61 6c 6c |"bdglopt|"./* all|
|000028d0| 20 6f 74 68 65 72 20 66 | 6c 61 67 73 20 2a 2f 0a | other f|lags */.|
|000028e0| 0a 23 64 65 66 69 6e 65 | 20 44 41 59 46 4f 4e 54 |.#define| DAYFONT|
|000028f0| 20 20 20 22 54 69 6d 65 | 73 2d 42 6f 6c 64 22 09 | "Time|s-Bold".|
|00002900| 09 2f 2a 20 64 65 66 61 | 75 6c 74 20 66 6f 6e 74 |./* defa|ult font|
|00002910| 20 6e 61 6d 65 73 20 2a | 2f 0a 23 64 65 66 69 6e | names *|/.#defin|
|00002920| 65 20 54 49 54 4c 45 46 | 4f 4e 54 20 22 54 69 6d |e TITLEF|ONT "Tim|
|00002930| 65 73 2d 42 6f 6c 64 22 | 0a 0a 23 64 65 66 69 6e |es-Bold"|..#defin|
|00002940| 65 20 4c 41 4e 44 53 43 | 41 50 45 20 20 39 30 09 |e LANDSC|APE 90.|
|00002950| 09 2f 2a 20 64 65 67 72 | 65 65 73 20 74 6f 20 72 |./* degr|ees to r|
|00002960| 6f 74 61 74 65 20 66 6f | 72 20 6c 61 6e 64 73 63 |otate fo|r landsc|
|00002970| 61 70 65 2f 70 6f 72 74 | 72 61 69 74 20 2a 2f 0a |ape/port|rait */.|
|00002980| 23 64 65 66 69 6e 65 20 | 50 4f 52 54 52 41 49 54 |#define |PORTRAIT|
|00002990| 20 20 20 20 30 0a 23 64 | 65 66 69 6e 65 20 52 4f | 0.#d|efine RO|
|000029a0| 54 41 54 45 09 20 20 20 | 4c 41 4e 44 53 43 41 50 |TATE. |LANDSCAP|
|000029b0| 45 09 2f 2a 20 64 65 66 | 61 75 6c 74 20 2a 2f 0a |E./* def|ault */.|
|000029c0| 0a 23 64 65 66 69 6e 65 | 20 42 4c 41 43 4b 09 30 |.#define| BLACK.0|
|000029d0| 09 09 2f 2a 20 63 6f 6c | 6f 72 73 20 66 6f 72 20 |../* col|ors for |
|000029e0| 64 61 74 65 73 20 2a 2f | 0a 23 64 65 66 69 6e 65 |dates */|.#define|
|000029f0| 20 47 52 41 59 09 31 0a | 0a 23 64 65 66 69 6e 65 | GRAY.1.|.#define|
|00002a00| 20 4e 4f 5f 44 41 54 45 | 46 49 4c 45 20 09 30 09 | NO_DATE|FILE .0.|
|00002a10| 2f 2a 20 64 61 74 65 20 | 66 69 6c 65 20 28 69 66 |/* date |file (if|
|00002a20| 20 61 6e 79 29 20 74 6f | 20 75 73 65 20 2a 2f 0a | any) to| use */.|
|00002a30| 23 64 65 66 69 6e 65 20 | 55 53 45 52 5f 44 41 54 |#define |USER_DAT|
|00002a40| 45 46 49 4c 45 09 31 0a | 23 64 65 66 69 6e 65 20 |EFILE.1.|#define |
|00002a50| 53 59 53 5f 44 41 54 45 | 46 49 4c 45 09 32 0a 0a |SYS_DATE|FILE.2..|
|00002a60| 23 64 65 66 69 6e 65 20 | 4d 49 4e 5f 59 52 09 31 |#define |MIN_YR.1|
|00002a70| 39 30 30 09 09 2f 2a 20 | 73 69 67 6e 69 66 69 63 |900../* |signific|
|00002a80| 61 6e 74 20 79 65 61 72 | 73 20 28 63 61 6c 65 6e |ant year|s (calen|
|00002a90| 64 61 72 20 6c 69 6d 69 | 74 73 29 20 2a 2f 0a 23 |dar limi|ts) */.#|
|00002aa0| 64 65 66 69 6e 65 20 4d | 41 58 5f 59 52 09 39 39 |define M|AX_YR.99|
|00002ab0| 39 39 0a 0a 23 64 65 66 | 69 6e 65 20 4a 41 4e 09 |99..#def|ine JAN.|
|00002ac0| 20 31 09 09 2f 2a 20 73 | 69 67 6e 69 66 69 63 61 | 1../* s|ignifica|
|00002ad0| 6e 74 20 6d 6f 6e 74 68 | 73 20 2a 2f 0a 23 64 65 |nt month|s */.#de|
|00002ae0| 66 69 6e 65 20 46 45 42 | 09 20 32 0a 23 64 65 66 |fine FEB|. 2.#def|
|00002af0| 69 6e 65 20 44 45 43 09 | 31 32 0a 0a 23 64 65 66 |ine DEC.|12..#def|
|00002b00| 69 6e 65 20 53 54 52 53 | 49 5a 09 31 30 30 09 09 |ine STRS|IZ.100..|
|00002b10| 2f 2a 20 73 69 7a 65 20 | 6f 66 20 6d 69 73 63 2e |/* size |of misc.|
|00002b20| 20 73 74 72 69 6e 67 73 | 20 2a 2f 0a 0a 23 64 65 | strings| */..#de|
|00002b30| 66 69 6e 65 20 4d 41 58 | 41 52 47 53 20 33 09 09 |fine MAX|ARGS 3..|
|00002b40| 2f 2a 20 6e 75 6d 65 72 | 69 63 20 63 6f 6d 6d 61 |/* numer|ic comma|
|00002b50| 6e 64 2d 6c 69 6e 65 20 | 61 72 67 73 20 2a 2f 0a |nd-line |args */.|
|00002b60| 0a 23 64 65 66 69 6e 65 | 20 48 4f 4c 49 44 41 59 |.#define| HOLIDAY|
|00002b70| 09 28 31 20 3c 3c 20 36 | 29 09 2f 2a 20 62 69 74 |.(1 << 6|)./* bit|
|00002b80| 20 73 65 74 20 74 6f 20 | 66 6c 61 67 20 64 61 79 | set to |flag day|
|00002b90| 20 61 73 20 68 6f 6c 69 | 64 61 79 20 2a 2f 0a 0a | as holi|day */..|
|00002ba0| 23 64 65 66 69 6e 65 20 | 57 48 49 54 45 53 50 41 |#define |WHITESPA|
|00002bb0| 43 45 20 22 20 5c 74 22 | 09 2f 2a 20 74 6f 6b 65 |CE " \t"|./* toke|
|00002bc0| 6e 20 64 65 6c 69 6d 69 | 74 65 72 73 20 69 6e 20 |n delimi|ters in |
|00002bd0| 64 61 74 65 20 66 69 6c | 65 20 2a 2f 0a 0a 2f 2a |date fil|e */../*|
|00002be0| 0a 20 2a 20 47 6c 6f 62 | 61 6c 20 76 61 72 69 61 |. * Glob|al varia|
|00002bf0| 62 6c 65 73 3a 0a 20 2a | 2f 0a 0a 46 49 4c 45 20 |bles:. *|/..FILE |
|00002c00| 2a 64 66 70 20 3d 20 4e | 55 4c 4c 3b 09 09 2f 2a |*dfp = N|ULL;../*|
|00002c10| 20 64 61 74 65 20 66 69 | 6c 65 20 70 6f 69 6e 74 | date fi|le point|
|00002c20| 65 72 20 2a 2f 0a 69 6e | 74 20 69 6e 69 74 5f 6d |er */.in|t init_m|
|00002c30| 6f 6e 74 68 3b 09 09 09 | 2f 2a 20 69 6e 69 74 69 |onth;...|/* initi|
|00002c40| 61 6c 20 6d 6f 6e 74 68 | 2c 20 79 65 61 72 2c 20 |al month|, year, |
|00002c50| 6e 75 6d 62 65 72 20 6f | 66 20 6d 6f 6e 74 68 73 |number o|f months|
|00002c60| 20 2a 2f 0a 69 6e 74 20 | 69 6e 69 74 5f 79 65 61 | */.int |init_yea|
|00002c70| 72 3b 0a 69 6e 74 20 6e | 6d 6f 6e 74 68 73 3b 0a |r;.int n|months;.|
|00002c80| 69 6e 74 20 63 75 72 72 | 5f 79 65 61 72 3b 09 09 |int curr|_year;..|
|00002c90| 09 2f 2a 20 63 75 72 72 | 65 6e 74 20 64 65 66 61 |./* curr|ent defa|
|00002ca0| 75 6c 74 20 79 65 61 72 | 20 66 6f 72 20 64 61 74 |ult year| for dat|
|00002cb0| 65 20 66 69 6c 65 20 65 | 6e 74 72 69 65 73 20 2a |e file e|ntries *|
|00002cc0| 2f 0a 63 68 61 72 20 2a | 77 6f 72 64 73 5b 31 30 |/.char *|words[10|
|00002cd0| 30 5d 3b 09 09 2f 2a 20 | 6d 61 78 69 6d 75 6d 20 |0];../* |maximum |
|00002ce0| 6e 75 6d 62 65 72 20 6f | 66 20 77 6f 72 64 73 20 |number o|f words |
|00002cf0| 70 65 72 20 64 61 74 65 | 20 66 69 6c 65 20 6c 69 |per date| file li|
|00002d00| 6e 65 20 2a 2f 0a 63 68 | 61 72 20 6c 62 75 66 5b |ne */.ch|ar lbuf[|
|00002d10| 35 31 32 5d 3b 09 09 09 | 2f 2a 20 6d 61 78 69 6d |512];...|/* maxim|
|00002d20| 75 6d 20 64 61 74 65 20 | 66 69 6c 65 20 6c 69 6e |um date |file lin|
|00002d30| 65 20 73 69 7a 65 20 2a | 2f 0a 63 68 61 72 20 70 |e size *|/.char p|
|00002d40| 72 6f 67 6e 61 6d 65 5b | 53 54 52 53 49 5a 5d 3b |rogname[|STRSIZ];|
|00002d50| 09 09 2f 2a 20 70 72 6f | 67 72 61 6d 20 6e 61 6d |../* pro|gram nam|
|00002d60| 65 20 28 66 6f 72 20 65 | 72 72 6f 72 20 6d 65 73 |e (for e|rror mes|
|00002d70| 73 61 67 65 73 29 20 2a | 2f 0a 63 68 61 72 20 63 |sages) *|/.char c|
|00002d80| 6f 6c 6f 72 5b 37 5d 3b | 09 09 09 2f 2a 20 63 6f |olor[7];|.../* co|
|00002d90| 6c 6f 72 73 20 6f 66 20 | 77 65 65 6b 64 61 79 73 |lors of |weekdays|
|00002da0| 20 2d 20 63 66 2e 20 64 | 65 66 61 75 6c 74 5f 63 | - cf. d|efault_c|
|00002db0| 6f 6c 6f 72 5b 5d 20 2a | 2f 0a 0a 2f 2a 0a 20 2a |olor[] *|/../*. *|
|00002dc0| 20 44 65 66 61 75 6c 74 | 20 76 61 6c 75 65 73 20 | Default| values |
|00002dd0| 66 6f 72 20 63 6f 6d 6d | 61 6e 64 2d 6c 69 6e 65 |for comm|and-line|
|00002de0| 20 6f 70 74 69 6f 6e 73 | 3a 0a 20 2a 2f 0a 0a 63 | options|:. */..c|
|00002df0| 68 61 72 20 64 65 66 61 | 75 6c 74 5f 63 6f 6c 6f |har defa|ult_colo|
|00002e00| 72 5b 37 5d 20 3d 20 7b | 09 09 2f 2a 20 2d 62 2c |r[7] = {|../* -b,|
|00002e10| 20 2d 67 20 2a 2f 0a 09 | 47 52 41 59 2c 20 42 4c | -g */..|GRAY, BL|
|00002e20| 41 43 4b 2c 20 42 4c 41 | 43 4b 2c 20 42 4c 41 43 |ACK, BLA|CK, BLAC|
|00002e30| 4b 2c 20 42 4c 41 43 4b | 2c 20 42 4c 41 43 4b 2c |K, BLACK|, BLACK,|
|00002e40| 20 47 52 41 59 09 2f 2a | 20 63 66 2e 20 43 4f 4c | GRAY./*| cf. COL|
|00002e50| 4f 52 5f 4d 53 47 20 2a | 2f 0a 09 7d 3b 0a 0a 69 |OR_MSG *|/..};..i|
|00002e60| 6e 74 20 64 61 74 65 66 | 69 6c 65 5f 74 79 70 65 |nt datef|ile_type|
|00002e70| 20 3d 20 53 59 53 5f 44 | 41 54 45 46 49 4c 45 3b | = SYS_D|ATEFILE;|
|00002e80| 09 2f 2a 20 2d 65 2c 20 | 2d 66 20 2a 2f 0a 63 68 |./* -e, |-f */.ch|
|00002e90| 61 72 20 64 61 74 65 66 | 69 6c 65 5b 53 54 52 53 |ar datef|ile[STRS|
|00002ea0| 49 5a 5d 20 3d 20 22 22 | 3b 0a 0a 69 6e 74 20 72 |IZ] = ""|;..int r|
|00002eb0| 6f 74 61 74 65 20 3d 20 | 52 4f 54 41 54 45 3b 09 |otate = |ROTATE;.|
|00002ec0| 09 09 2f 2a 20 2d 6c 2c | 20 2d 70 20 2a 2f 0a 0a |../* -l,| -p */..|
|00002ed0| 63 68 61 72 20 64 61 79 | 66 6f 6e 74 5b 53 54 52 |char day|font[STR|
|00002ee0| 53 49 5a 5d 20 3d 20 44 | 41 59 46 4f 4e 54 3b 09 |SIZ] = D|AYFONT;.|
|00002ef0| 09 2f 2a 20 2d 64 2c 20 | 2d 74 20 2a 2f 0a 63 68 |./* -d, |-t */.ch|
|00002f00| 61 72 20 74 69 74 6c 65 | 66 6f 6e 74 5b 53 54 52 |ar title|font[STR|
|00002f10| 53 49 5a 5d 20 3d 20 54 | 49 54 4c 45 46 4f 4e 54 |SIZ] = T|ITLEFONT|
|00002f20| 3b 0a 0a 63 68 61 72 20 | 6f 75 74 66 69 6c 65 5b |;..char |outfile[|
|00002f30| 53 54 52 53 49 5a 5d 20 | 3d 20 4f 55 54 46 49 4c |STRSIZ] |= OUTFIL|
|00002f40| 45 3b 09 09 2f 2a 20 2d | 6f 20 2a 2f 0a 0a 2f 2a |E;../* -|o */../*|
|00002f50| 0a 20 2a 20 4c 61 6e 67 | 75 61 67 65 2d 64 65 70 |. * Lang|uage-dep|
|00002f60| 65 6e 64 65 6e 74 20 73 | 74 72 69 6e 67 73 20 28 |endent s|trings (|
|00002f70| 6d 6f 6e 74 68 20 61 6e | 64 20 64 61 79 20 6e 61 |month an|d day na|
|00002f80| 6d 65 73 2c 20 6f 70 74 | 69 6f 6e 20 66 69 6c 65 |mes, opt|ion file|
|00002f90| 20 6b 65 79 77 6f 72 64 | 73 29 3a 0a 20 2a 2f 0a | keyword|s):. */.|
|00002fa0| 0a 73 74 61 74 69 63 20 | 63 68 61 72 20 2a 6d 6f |.static |char *mo|
|00002fb0| 6e 74 68 73 5b 31 32 5d | 20 3d 20 7b 0a 09 22 4a |nths[12]| = {.."J|
|00002fc0| 61 6e 75 61 72 79 22 2c | 20 22 46 65 62 72 75 61 |anuary",| "Februa|
|00002fd0| 72 79 22 2c 20 22 4d 61 | 72 63 68 22 2c 20 22 41 |ry", "Ma|rch", "A|
|00002fe0| 70 72 69 6c 22 2c 20 22 | 4d 61 79 22 2c 20 22 4a |pril", "|May", "J|
|00002ff0| 75 6e 65 22 2c 0a 09 22 | 4a 75 6c 79 22 2c 20 22 |une",.."|July", "|
|00003000| 41 75 67 75 73 74 22 2c | 20 22 53 65 70 74 65 6d |August",| "Septem|
|00003010| 62 65 72 22 2c 20 22 4f | 63 74 6f 62 65 72 22 2c |ber", "O|ctober",|
|00003020| 20 22 4e 6f 76 65 6d 62 | 65 72 22 2c 20 22 44 65 | "Novemb|er", "De|
|00003030| 63 65 6d 62 65 72 22 0a | 09 7d 3b 0a 0a 73 74 61 |cember".|.};..sta|
|00003040| 74 69 63 20 63 68 61 72 | 20 2a 64 61 79 73 5b 37 |tic char| *days[7|
|00003050| 5d 20 3d 20 7b 0a 09 22 | 53 75 6e 64 61 79 22 2c |] = {.."|Sunday",|
|00003060| 20 22 4d 6f 6e 64 61 79 | 22 2c 20 22 54 75 65 73 | "Monday|", "Tues|
|00003070| 64 61 79 22 2c 20 22 57 | 65 64 6e 65 73 64 61 79 |day", "W|ednesday|
|00003080| 22 2c 20 22 54 68 75 72 | 73 64 61 79 22 2c 20 22 |", "Thur|sday", "|
|00003090| 46 72 69 64 61 79 22 2c | 0a 09 22 53 61 74 75 72 |Friday",|.."Satur|
|000030a0| 64 61 79 22 0a 09 7d 3b | 0a 0a 23 64 65 66 69 6e |day"..};|..#defin|
|000030b0| 65 20 4d 49 4e 5f 44 41 | 59 5f 4c 45 4e 20 20 20 |e MIN_DA|Y_LEN |
|000030c0| 32 09 09 2f 2a 20 6d 69 | 6e 69 6d 75 6d 20 73 69 |2../* mi|nimum si|
|000030d0| 7a 65 20 6f 66 20 64 61 | 79 2f 6d 6f 6e 74 68 20 |ze of da|y/month |
|000030e0| 61 62 62 72 65 76 69 61 | 74 69 6f 6e 73 20 20 2a |abbrevia|tions *|
|000030f0| 2f 0a 23 64 65 66 69 6e | 65 20 4d 49 4e 5f 4d 4f |/.#defin|e MIN_MO|
|00003100| 4e 54 48 5f 4c 45 4e 20 | 33 0a 0a 23 64 65 66 69 |NTH_LEN |3..#defi|
|00003110| 6e 65 20 41 4c 4c 09 22 | 41 6c 6c 22 09 09 2f 2a |ne ALL."|All"../*|
|00003120| 20 63 6f 6d 6d 61 6e 64 | 2d 6c 69 6e 65 20 6f 72 | command|-line or|
|00003130| 20 64 61 74 65 20 66 69 | 6c 65 20 6b 65 79 77 6f | date fi|le keywo|
|00003140| 72 64 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 4f |rds */.#|define O|
|00003150| 50 54 09 22 4f 70 74 22 | 0a 23 64 65 66 69 6e 65 |PT."Opt"|.#define|
|00003160| 20 59 45 41 52 09 22 59 | 65 61 72 22 0a 0a 23 64 | YEAR."Y|ear"..#d|
|00003170| 65 66 69 6e 65 20 43 4f | 4c 4f 52 5f 4d 53 47 09 |efine CO|LOR_MSG.|
|00003180| 22 53 61 74 2f 53 75 6e | 20 69 6e 20 67 72 61 79 |"Sat/Sun| in gray|
|00003190| 2c 20 6f 74 68 65 72 73 | 20 69 6e 20 62 6c 61 63 |, others| in blac|
|000031a0| 6b 22 20 20 20 20 2f 2a | 20 63 66 2e 20 75 73 61 |k" /*| cf. usa|
|000031b0| 67 65 28 29 20 2a 2f 0a | 0a 2f 2a 0a 20 2a 20 50 |ge() */.|./*. * P|
|000031c0| 6f 73 74 53 63 72 69 70 | 74 20 62 6f 69 6c 65 72 |ostScrip|t boiler|
|000031d0| 70 6c 61 74 65 0a 20 2a | 2f 0a 0a 23 69 6e 63 6c |plate. *|/..#incl|
|000031e0| 75 64 65 20 22 70 63 61 | 6c 69 6e 69 74 2e 68 22 |ude "pca|linit.h"|
|000031f0| 0a 0a 0c 0a 2f 2a 0a 20 | 2a 20 4d 61 69 6e 20 70 |..../*. |* Main p|
|00003200| 72 6f 67 72 61 6d 20 2d | 20 70 61 72 73 65 20 61 |rogram -| parse a|
|00003210| 6e 64 20 76 61 6c 69 64 | 61 74 65 20 63 6f 6d 6d |nd valid|ate comm|
|00003220| 61 6e 64 2d 6c 69 6e 65 | 20 61 72 67 75 6d 65 6e |and-line| argumen|
|00003230| 74 73 2c 20 6f 70 65 6e | 20 66 69 6c 65 73 2c 0a |ts, open| files,.|
|00003240| 20 2a 20 67 65 6e 65 72 | 61 74 65 20 50 6f 73 74 | * gener|ate Post|
|00003250| 53 63 72 69 70 74 20 62 | 6f 69 6c 65 72 70 6c 61 |Script b|oilerpla|
|00003260| 74 65 20 61 6e 64 20 63 | 6f 64 65 20 74 6f 20 67 |te and c|ode to g|
|00003270| 65 6e 65 72 61 74 65 20 | 63 61 6c 65 6e 64 61 72 |enerate |calendar|
|00003280| 73 2e 0a 20 2a 0a 20 2a | 20 50 72 6f 67 72 61 6d |s.. *. *| Program|
|00003290| 20 73 74 72 75 63 74 75 | 72 65 3a 0a 20 2a 0a 20 | structu|re:. *. |
|000032a0| 2a 20 6d 61 69 6e 28 29 | 20 63 61 6c 6c 73 20 67 |* main()| calls g|
|000032b0| 65 74 5f 61 72 67 73 28 | 29 20 6f 6e 63 65 20 6a |et_args(|) once j|
|000032c0| 75 73 74 20 74 6f 20 67 | 65 74 20 74 68 65 20 64 |ust to g|et the d|
|000032d0| 61 74 65 20 66 69 6c 65 | 20 6e 61 6d 65 20 61 6e |ate file| name an|
|000032e0| 64 20 61 6e 79 20 6e 75 | 6d 65 72 69 63 0a 20 2a |d any nu|meric. *|
|000032f0| 20 61 72 67 75 6d 65 6e | 74 73 20 28 6d 6f 6e 74 | argumen|ts (mont|
|00003300| 68 2c 20 79 65 61 72 2c | 20 6e 75 6d 62 65 72 20 |h, year,| number |
|00003310| 6f 66 20 6d 6f 6e 74 68 | 73 29 2c 20 61 6e 64 20 |of month|s), and |
|00003320| 63 61 6c 6c 73 20 66 69 | 6e 64 5f 6f 70 74 69 6f |calls fi|nd_optio|
|00003330| 6e 73 28 29 20 74 6f 20 | 6d 61 6b 65 0a 20 2a 20 |ns() to |make. * |
|00003340| 61 20 70 72 65 6c 69 6d | 69 6e 61 72 79 20 70 61 |a prelim|inary pa|
|00003350| 73 73 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 64 |ss throu|gh the d|
|00003360| 61 74 65 20 66 69 6c 65 | 20 6c 6f 6f 6b 69 6e 67 |ate file| looking|
|00003370| 20 66 6f 72 20 22 6f 70 | 74 22 20 6c 69 6e 65 73 | for "op|t" lines|
|00003380| 20 28 77 68 69 63 68 0a | 20 2a 20 6f 76 65 72 72 | (which.| * overr|
|00003390| 69 64 65 20 74 68 65 20 | 64 65 66 61 75 6c 74 73 |ide the |defaults|
|000033a0| 20 66 6f 72 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 | for the| command|
|000033b0| 2d 6c 69 6e 65 20 66 6c | 61 67 73 29 2e 20 20 49 |-line fl|ags). I|
|000033c0| 74 20 74 68 65 6e 20 63 | 61 6c 6c 73 20 67 65 74 |t then c|alls get|
|000033d0| 5f 61 72 67 73 28 29 0a | 20 2a 20 61 67 61 69 6e |_args().| * again|
|000033e0| 20 74 6f 20 70 72 6f 63 | 65 73 73 20 74 68 65 20 | to proc|ess the |
|000033f0| 6f 74 68 65 72 20 63 6f | 6d 6d 61 6e 64 2d 6c 69 |other co|mmand-li|
|00003400| 6e 65 20 66 6c 61 67 73 | 2c 20 77 68 69 63 68 20 |ne flags|, which |
|00003410| 69 6e 20 74 75 72 6e 20 | 6f 76 65 72 72 69 64 65 |in turn |override|
|00003420| 20 61 6e 79 0a 20 2a 20 | 73 70 65 63 69 66 69 65 | any. * |specifie|
|00003430| 64 20 69 6e 20 74 68 65 | 20 64 61 74 65 20 66 69 |d in the| date fi|
|00003440| 6c 65 2e 0a 20 2a 0a 20 | 2a 20 6d 61 69 6e 28 29 |le.. *. |* main()|
|00003450| 20 74 68 65 6e 20 67 65 | 6e 65 72 61 74 65 73 20 | then ge|nerates |
|00003460| 74 68 65 20 63 6f 6d 6d | 6f 6e 20 50 6f 73 74 53 |the comm|on PostS|
|00003470| 63 72 69 70 74 20 63 6f | 64 65 20 61 6e 64 20 74 |cript co|de and t|
|00003480| 68 65 6e 20 63 61 6c 6c | 73 20 70 6d 6f 6e 74 68 |hen call|s pmonth|
|00003490| 28 29 20 74 6f 0a 20 2a | 20 70 72 69 6e 74 20 74 |() to. *| print t|
|000034a0| 68 65 20 63 61 6c 65 6e | 64 61 72 73 2e 0a 20 2a |he calen|dars.. *|
|000034b0| 0a 20 2a 20 66 69 6e 64 | 5f 6f 70 74 69 6f 6e 73 |. * find|_options|
|000034c0| 28 29 20 63 61 6c 6c 73 | 20 67 65 74 6c 69 6e 65 |() calls| getline|
|000034d0| 28 29 20 74 6f 20 72 65 | 61 64 20 74 68 65 20 64 |() to re|ad the d|
|000034e0| 61 74 65 20 66 69 6c 65 | 2e 20 20 55 70 6f 6e 20 |ate file|. Upon |
|000034f0| 65 6e 63 6f 75 6e 74 65 | 72 69 6e 67 0a 20 2a 20 |encounte|ring. * |
|00003500| 61 6e 20 22 6f 70 74 22 | 20 6c 69 6e 65 2c 20 69 |an "opt"| line, i|
|00003510| 74 20 63 61 6c 6c 73 20 | 6c 6f 61 64 77 6f 72 64 |t calls |loadword|
|00003520| 73 28 29 20 74 6f 20 74 | 6f 6b 65 6e 69 7a 65 20 |s() to t|okenize |
|00003530| 74 68 65 20 6c 69 6e 65 | 20 61 6e 64 20 67 65 74 |the line| and get|
|00003540| 5f 61 72 67 73 28 29 0a | 20 2a 20 74 6f 20 70 61 |_args().| * to pa|
|00003550| 72 73 65 20 69 74 2e 0a | 20 2a 0a 20 2a 20 70 6d |rse it..| *. * pm|
|00003560| 6f 6e 74 68 28 29 20 63 | 61 6c 6c 73 20 66 69 6e |onth() c|alls fin|
|00003570| 64 5f 68 6f 6c 69 64 61 | 79 73 28 29 20 74 6f 20 |d_holida|ys() to |
|00003580| 6d 61 6b 65 20 61 20 66 | 69 72 73 74 20 70 61 73 |make a f|irst pas|
|00003590| 73 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 64 61 |s throug|h the da|
|000035a0| 74 65 20 66 69 6c 65 0a | 20 2a 20 74 6f 20 67 65 |te file.| * to ge|
|000035b0| 6e 65 72 61 74 65 20 74 | 68 65 20 6c 69 73 74 20 |nerate t|he list |
|000035c0| 6f 66 20 68 6f 6c 69 64 | 61 79 73 20 74 6f 20 62 |of holid|ays to b|
|000035d0| 65 20 70 72 69 6e 74 65 | 64 20 69 6e 20 67 72 61 |e printe|d in gra|
|000035e0| 79 3b 20 69 74 20 74 68 | 65 6e 20 63 61 6c 6c 73 |y; it th|en calls|
|000035f0| 0a 20 2a 20 66 69 6e 64 | 5f 64 61 79 74 65 78 74 |. * find|_daytext|
|00003600| 28 29 20 74 6f 20 6d 61 | 6b 65 20 61 20 73 65 63 |() to ma|ke a sec|
|00003610| 6f 6e 64 20 70 61 73 73 | 20 74 6f 20 67 65 6e 65 |ond pass| to gene|
|00003620| 72 61 74 65 20 74 68 65 | 20 74 65 78 74 20 74 6f |rate the| text to|
|00003630| 20 62 65 20 70 72 69 6e | 74 65 64 0a 20 2a 20 69 | be prin|ted. * i|
|00003640| 6e 73 69 64 65 20 74 68 | 65 20 63 61 6c 65 6e 64 |nside th|e calend|
|00003650| 61 72 20 62 6f 78 65 73 | 2e 0a 20 2a 0a 20 2a 20 |ar boxes|.. *. * |
|00003660| 66 69 6e 64 5f 68 6f 6c | 69 64 61 79 73 28 29 20 |find_hol|idays() |
|00003670| 61 6e 64 20 66 69 6e 64 | 5f 64 61 79 74 65 78 74 |and find|_daytext|
|00003680| 28 29 20 62 6f 74 68 20 | 63 61 6c 6c 20 67 65 74 |() both |call get|
|00003690| 64 61 79 28 29 20 74 6f | 20 72 65 74 72 69 65 76 |day() to| retriev|
|000036a0| 65 20 74 68 65 20 6e 65 | 78 74 0a 20 2a 20 64 61 |e the ne|xt. * da|
|000036b0| 79 20 6f 66 20 69 6e 74 | 65 72 65 73 74 20 66 72 |y of int|erest fr|
|000036c0| 6f 6d 20 74 68 65 20 64 | 61 74 65 20 66 69 6c 65 |om the d|ate file|
|000036d0| 2e 0a 20 2a 0a 20 2a 20 | 67 65 74 64 61 79 28 29 |.. *. * |getday()|
|000036e0| 20 63 61 6c 6c 73 20 67 | 65 74 6c 69 6e 65 28 29 | calls g|etline()|
|000036f0| 20 74 6f 20 72 65 61 64 | 20 73 75 63 63 65 73 73 | to read| success|
|00003700| 69 76 65 20 6c 69 6e 65 | 73 20 66 72 6f 6d 20 74 |ive line|s from t|
|00003710| 68 65 20 64 61 74 65 20 | 66 69 6c 65 20 61 6e 64 |he date |file and|
|00003720| 0a 20 2a 20 63 61 6c 6c | 73 20 70 61 72 73 65 28 |. * call|s parse(|
|00003730| 29 20 74 6f 20 69 6e 74 | 65 72 70 72 65 74 20 74 |) to int|erpret t|
|00003740| 68 65 6d 2c 20 73 74 6f | 70 70 69 6e 67 20 77 68 |hem, sto|pping wh|
|00003750| 65 6e 20 70 61 72 73 65 | 28 29 20 64 65 74 65 72 |en parse|() deter|
|00003760| 6d 69 6e 65 73 20 74 68 | 61 74 20 74 68 65 0a 20 |mines th|at the. |
|00003770| 2a 20 6c 69 6e 65 20 63 | 6f 6e 74 61 69 6e 73 20 |* line c|ontains |
|00003780| 61 20 75 73 61 62 6c 65 | 20 64 61 74 65 20 6f 72 |a usable| date or|
|00003790| 20 77 68 65 6e 20 45 4f | 46 20 69 73 20 72 65 61 | when EO|F is rea|
|000037a0| 63 68 65 64 2e 0a 20 2a | 0a 20 2a 20 67 65 74 6c |ched.. *|. * getl|
|000037b0| 69 6e 65 28 29 20 72 65 | 61 64 73 20 6f 6e 65 20 |ine() re|ads one |
|000037c0| 6f 72 20 6d 6f 72 65 20 | 6c 69 6e 65 73 20 66 72 |or more |lines fr|
|000037d0| 6f 6d 20 74 68 65 20 64 | 61 74 65 20 66 69 6c 65 |om the d|ate file|
|000037e0| 2c 20 73 74 72 69 70 70 | 69 6e 67 20 63 6f 6d 6d |, stripp|ing comm|
|000037f0| 65 6e 74 73 0a 20 2a 20 | 28 23 20 74 68 72 6f 75 |ents. * |(# throu|
|00003800| 67 68 20 65 6e 64 2d 6f | 66 2d 6c 69 6e 65 29 20 |gh end-o|f-line) |
|00003810| 61 6e 64 20 69 67 6e 6f | 72 69 6e 67 20 62 6c 61 |and igno|ring bla|
|00003820| 6e 6b 20 6c 69 6e 65 73 | 2e 0a 20 2a 0a 20 2a 20 |nk lines|.. *. * |
|00003830| 70 61 72 73 65 28 29 20 | 70 61 72 73 65 73 20 61 |parse() |parses a|
|00003840| 20 6c 69 6e 65 20 66 72 | 6f 6d 20 74 68 65 20 64 | line fr|om the d|
|00003850| 61 74 65 20 66 69 6c 65 | 2c 20 64 65 74 65 72 6d |ate file|, determ|
|00003860| 69 6e 69 6e 67 20 77 68 | 65 74 68 65 72 20 6f 72 |ining wh|ether or|
|00003870| 20 6e 6f 74 20 69 74 0a | 20 2a 20 63 6f 6e 74 61 | not it.| * conta|
|00003880| 69 6e 73 20 61 20 64 61 | 74 65 20 69 6e 20 74 68 |ins a da|te in th|
|00003890| 65 20 63 75 72 72 65 6e | 74 20 6d 6f 6e 74 68 20 |e curren|t month |
|000038a0| 61 6e 64 20 79 65 61 72 | 2e 20 20 49 74 20 63 61 |and year|. It ca|
|000038b0| 6c 6c 73 20 75 74 69 6c | 69 74 79 20 72 6f 75 74 |lls util|ity rout|
|000038c0| 69 6e 65 73 0a 20 2a 20 | 69 73 5f 76 61 6c 69 64 |ines. * |is_valid|
|000038d0| 28 29 20 74 6f 20 76 61 | 6c 69 64 61 74 65 20 74 |() to va|lidate t|
|000038e0| 68 65 20 64 61 74 65 20 | 66 6f 75 6e 64 20 61 6e |he date |found an|
|000038f0| 64 20 6c 6f 61 64 77 6f | 72 64 73 28 29 20 74 6f |d loadwo|rds() to|
|00003900| 20 73 70 6c 69 74 20 61 | 6e 79 0a 20 2a 20 61 63 | split a|ny. * ac|
|00003910| 63 6f 6d 70 61 6e 79 69 | 6e 67 20 74 65 78 74 20 |companyi|ng text |
|00003920| 69 6e 74 6f 20 69 6e 64 | 69 76 69 64 75 61 6c 20 |into ind|ividual |
|00003930| 74 6f 6b 65 6e 73 20 66 | 6f 72 20 50 6f 73 74 53 |tokens f|or PostS|
|00003940| 63 72 69 70 74 20 74 6f | 20 70 72 69 6e 74 2e 0a |cript to| print..|
|00003950| 20 2a 20 0a 20 2a 2f 0a | 6d 61 69 6e 28 61 72 67 | * . */.|main(arg|
|00003960| 63 2c 20 61 72 67 76 29 | 0a 09 69 6e 74 20 61 72 |c, argv)|..int ar|
|00003970| 67 63 3b 0a 09 63 68 61 | 72 20 2a 2a 61 72 67 76 |gc;..cha|r **argv|
|00003980| 3b 0a 7b 0a 09 63 68 61 | 72 20 2a 70 2c 20 2a 2a |;.{..cha|r *p, **|
|00003990| 61 70 3b 0a 09 69 6e 74 | 20 69 2c 20 6d 6f 6e 74 |ap;..int| i, mont|
|000039a0| 68 2c 20 79 65 61 72 2c | 20 6e 67 72 61 79 3b 0a |h, year,| ngray;.|
|000039b0| 0a 23 64 65 66 69 6e 65 | 20 44 4f 5f 48 45 41 44 |.#define| DO_HEAD|
|000039c0| 45 52 28 70 68 64 72 29 | 09 66 6f 72 20 28 61 70 |ER(phdr)|.for (ap|
|000039d0| 20 3d 20 70 68 64 72 3b | 20 2a 61 70 3b 20 61 70 | = phdr;| *ap; ap|
|000039e0| 2b 2b 29 20 50 52 54 28 | 22 25 73 5c 6e 22 2c 20 |++) PRT(|"%s\n", |
|000039f0| 2a 61 70 29 0a 0a 09 49 | 4e 49 54 5f 43 4f 4c 4f |*ap)...I|NIT_COLO|
|00003a00| 52 53 3b 09 09 2f 2a 20 | 73 65 74 20 75 70 20 64 |RS;../* |set up d|
|00003a10| 65 66 61 75 6c 74 20 63 | 6f 6c 6f 72 73 20 2a 2f |efault c|olors */|
|00003a20| 0a 0a 09 2f 2a 20 69 73 | 6f 6c 61 74 65 20 72 6f |.../* is|olate ro|
|00003a30| 6f 74 20 70 72 6f 67 72 | 61 6d 20 6e 61 6d 65 20 |ot progr|am name |
|00003a40| 28 66 6f 72 20 75 73 65 | 20 69 6e 20 65 72 72 6f |(for use| in erro|
|00003a50| 72 20 6d 65 73 73 61 67 | 65 73 29 20 2a 2f 0a 0a |r messag|es) */..|
|00003a60| 09 73 74 72 63 70 79 28 | 70 72 6f 67 6e 61 6d 65 |.strcpy(|progname|
|00003a70| 2c 20 2a 2a 61 72 67 76 | 20 3f 20 2a 61 72 67 76 |, **argv| ? *argv|
|00003a80| 20 3a 20 22 70 63 61 6c | 22 29 3b 0a 0a 09 69 66 | : "pcal|");...if|
|00003a90| 20 28 28 70 20 3d 20 73 | 74 72 72 63 68 72 28 70 | ((p = s|trrchr(p|
|00003aa0| 72 6f 67 6e 61 6d 65 2c | 20 45 4e 44 5f 50 41 54 |rogname,| END_PAT|
|00003ab0| 48 29 29 20 21 3d 20 4e | 55 4c 4c 29 0a 09 09 73 |H)) != N|ULL)...s|
|00003ac0| 74 72 63 70 79 28 70 72 | 6f 67 6e 61 6d 65 2c 20 |trcpy(pr|ogname, |
|00003ad0| 2b 2b 70 29 3b 0a 09 69 | 66 20 28 28 70 20 3d 20 |++p);..i|f ((p = |
|00003ae0| 73 74 72 63 68 72 28 70 | 72 6f 67 6e 61 6d 65 2c |strchr(p|rogname,|
|00003af0| 20 27 2e 27 29 29 20 21 | 3d 20 4e 55 4c 4c 29 0a | '.')) !|= NULL).|
|00003b00| 09 09 2a 70 20 3d 20 27 | 5c 30 27 3b 0a 0a 09 2f |..*p = '|\0';.../|
|00003b10| 2a 0a 09 20 2a 20 47 65 | 74 20 74 68 65 20 61 72 |*.. * Ge|t the ar|
|00003b20| 67 75 6d 65 6e 74 73 20 | 66 72 6f 6d 20 61 29 20 |guments |from a) |
|00003b30| 22 6f 70 74 22 20 6c 69 | 6e 65 73 20 69 6e 20 74 |"opt" li|nes in t|
|00003b40| 68 65 20 64 61 74 65 20 | 66 69 6c 65 2c 20 61 6e |he date |file, an|
|00003b50| 64 20 62 29 0a 09 20 2a | 20 74 68 65 20 63 6f 6d |d b).. *| the com|
|00003b60| 6d 61 6e 64 20 6c 69 6e | 65 2c 20 69 6e 20 74 68 |mand lin|e, in th|
|00003b70| 61 74 20 6f 72 64 65 72 | 0a 09 20 2a 2f 0a 0a 09 |at order|.. */...|
|00003b80| 2f 2a 20 70 61 72 73 65 | 20 63 6f 6d 6d 61 6e 64 |/* parse| command|
|00003b90| 2d 6c 69 6e 65 20 61 72 | 67 75 6d 65 6e 74 73 20 |-line ar|guments |
|00003ba0| 6f 6e 63 65 20 74 6f 20 | 66 69 6e 64 20 6e 61 6d |once to |find nam|
|00003bb0| 65 20 6f 66 20 64 61 74 | 65 20 66 69 6c 65 20 2a |e of dat|e file *|
|00003bc0| 2f 0a 0a 09 69 66 20 28 | 21 67 65 74 5f 61 72 67 |/...if (|!get_arg|
|00003bd0| 73 28 61 72 67 76 2c 20 | 44 41 54 45 46 49 4c 45 |s(argv, |DATEFILE|
|00003be0| 5f 46 4c 41 47 53 2c 20 | 54 52 55 45 29 29 20 7b |_FLAGS, |TRUE)) {|
|00003bf0| 0a 09 09 75 73 61 67 65 | 28 29 3b 0a 09 09 65 78 |...usage|();...ex|
|00003c00| 69 74 28 45 58 49 54 5f | 46 41 49 4c 55 52 45 29 |it(EXIT_|FAILURE)|
|00003c10| 3b 0a 09 7d 0a 0a 09 2f | 2a 20 41 74 74 65 6d 70 |;..}.../|* Attemp|
|00003c20| 74 20 74 6f 20 6f 70 65 | 6e 20 74 68 65 20 64 61 |t to ope|n the da|
|00003c30| 74 65 20 66 69 6c 65 20 | 61 73 20 73 70 65 63 69 |te file |as speci|
|00003c40| 66 69 65 64 20 62 79 20 | 74 68 65 20 5b 2d 65 20 |fied by |the [-e |
|00003c50| 7c 20 2d 66 5d 20 66 6c | 61 67 73 20 2a 2f 0a 0a || -f] fl|ags */..|
|00003c60| 09 73 77 69 74 63 68 20 | 28 64 61 74 65 66 69 6c |.switch |(datefil|
|00003c70| 65 5f 74 79 70 65 29 20 | 7b 0a 09 63 61 73 65 20 |e_type) |{..case |
|00003c80| 4e 4f 5f 44 41 54 45 46 | 49 4c 45 3a 0a 09 09 64 |NO_DATEF|ILE:...d|
|00003c90| 66 70 20 3d 20 4e 55 4c | 4c 3b 0a 09 09 62 72 65 |fp = NUL|L;...bre|
|00003ca0| 61 6b 3b 0a 0a 09 63 61 | 73 65 20 55 53 45 52 5f |ak;...ca|se USER_|
|00003cb0| 44 41 54 45 46 49 4c 45 | 3a 09 0a 09 09 2f 2a 20 |DATEFILE|:..../* |
|00003cc0| 41 74 74 65 6d 70 74 20 | 74 6f 20 6f 70 65 6e 20 |Attempt |to open |
|00003cd0| 75 73 65 72 2d 73 70 65 | 63 69 66 69 65 64 20 63 |user-spe|cified c|
|00003ce0| 61 6c 65 6e 64 61 72 20 | 66 69 6c 65 20 2a 2f 0a |alendar |file */.|
|00003cf0| 09 09 69 66 20 28 28 64 | 66 70 20 3d 20 66 6f 70 |..if ((d|fp = fop|
|00003d00| 65 6e 28 64 61 74 65 66 | 69 6c 65 2c 20 22 72 22 |en(datef|ile, "r"|
|00003d10| 29 29 20 3d 3d 20 4e 55 | 4c 4c 29 20 7b 0a 09 09 |)) == NU|LL) {...|
|00003d20| 09 46 50 52 28 73 74 64 | 65 72 72 2c 20 22 25 73 |.FPR(std|err, "%s|
|00003d30| 3a 20 63 61 6e 27 74 20 | 6f 70 65 6e 20 66 69 6c |: can't |open fil|
|00003d40| 65 20 25 73 5c 6e 22 2c | 20 70 72 6f 67 6e 61 6d |e %s\n",| prognam|
|00003d50| 65 2c 20 0a 09 09 09 09 | 64 61 74 65 66 69 6c 65 |e, .....|datefile|
|00003d60| 29 3b 0a 09 09 09 65 78 | 69 74 28 45 58 49 54 5f |);....ex|it(EXIT_|
|00003d70| 46 41 49 4c 55 52 45 29 | 3b 0a 09 09 7d 0a 09 09 |FAILURE)|;...}...|
|00003d80| 62 72 65 61 6b 3b 0a 0a | 09 63 61 73 65 20 53 59 |break;..|.case SY|
|00003d90| 53 5f 44 41 54 45 46 49 | 4c 45 3a 0a 09 09 2f 2a |S_DATEFI|LE:.../*|
|00003da0| 20 4c 6f 6f 6b 20 66 6f | 72 20 74 68 65 20 73 79 | Look fo|r the sy|
|00003db0| 73 74 65 6d 20 28 64 65 | 66 61 75 6c 74 29 20 63 |stem (de|fault) c|
|00003dc0| 61 6c 65 6e 64 61 72 20 | 66 69 6c 65 20 2a 2f 0a |alendar |file */.|
|00003dd0| 23 69 66 64 65 66 20 56 | 4d 53 0a 09 09 73 74 72 |#ifdef V|MS...str|
|00003de0| 63 70 79 28 64 61 74 65 | 66 69 6c 65 2c 20 22 53 |cpy(date|file, "S|
|00003df0| 59 53 24 4c 4f 47 49 4e | 3a 22 29 3b 09 2f 2a 20 |YS$LOGIN|:");./* |
|00003e00| 67 65 74 20 68 6f 6d 65 | 20 64 69 72 65 63 74 6f |get home| directo|
|00003e10| 72 79 20 28 56 4d 53 29 | 20 2a 2f 0a 23 65 6c 73 |ry (VMS)| */.#els|
|00003e20| 65 0a 09 09 2a 64 61 74 | 65 66 69 6c 65 20 3d 20 |e...*dat|efile = |
|00003e30| 27 5c 30 27 3b 09 09 2f | 2a 20 74 72 61 6e 73 6c |'\0';../|* transl|
|00003e40| 61 74 65 20 22 48 4f 4d | 45 22 20 74 6f 20 70 61 |ate "HOM|E" to pa|
|00003e50| 74 68 20 28 55 6e 2a 78 | 29 20 2a 2f 0a 09 09 69 |th (Un*x|) */...i|
|00003e60| 66 20 28 28 70 20 3d 20 | 67 65 74 65 6e 76 28 22 |f ((p = |getenv("|
|00003e70| 48 4f 4d 45 22 29 29 20 | 21 3d 20 4e 55 4c 4c 29 |HOME")) |!= NULL)|
|00003e80| 20 7b 0a 09 09 09 73 74 | 72 63 61 74 28 64 61 74 | {....st|rcat(dat|
|00003e90| 65 66 69 6c 65 2c 20 70 | 29 3b 0a 09 09 09 73 74 |efile, p|);....st|
|00003ea0| 72 63 61 74 28 64 61 74 | 65 66 69 6c 65 2c 20 22 |rcat(dat|efile, "|
|00003eb0| 2f 22 29 3b 0a 09 09 7d | 0a 23 65 6e 64 69 66 0a |/");...}|.#endif.|
|00003ec0| 09 09 73 74 72 63 61 74 | 28 64 61 74 65 66 69 6c |..strcat|(datefil|
|00003ed0| 65 2c 20 44 41 54 45 46 | 49 4c 45 29 3b 0a 09 09 |e, DATEF|ILE);...|
|00003ee0| 64 66 70 20 3d 20 66 6f | 70 65 6e 28 64 61 74 65 |dfp = fo|pen(date|
|00003ef0| 66 69 6c 65 2c 20 22 72 | 22 29 3b 09 2f 2a 20 6e |file, "r|");./* n|
|00003f00| 6f 20 65 72 72 6f 72 20 | 69 66 20 6e 6f 6e 65 78 |o error |if nonex|
|00003f10| 69 73 74 65 6e 74 20 2a | 2f 0a 09 09 62 72 65 61 |istent *|/...brea|
|00003f20| 6b 3b 0a 09 7d 0a 0a 09 | 66 69 6e 64 5f 6f 70 74 |k;..}...|find_opt|
|00003f30| 69 6f 6e 73 28 29 3b 09 | 09 2f 2a 20 72 65 61 64 |ions();.|./* read|
|00003f40| 20 64 61 74 65 20 66 69 | 6c 65 20 6c 6f 6f 6b 69 | date fi|le looki|
|00003f50| 6e 67 20 66 6f 72 20 6f | 70 74 69 6f 6e 20 6c 69 |ng for o|ption li|
|00003f60| 6e 65 73 20 2a 2f 0a 0a | 09 2f 2a 20 72 65 70 61 |nes */..|./* repa|
|00003f70| 72 73 65 20 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 |rse comm|and line|
|00003f80| 20 2d 20 66 6c 61 67 73 | 20 74 68 65 72 65 20 73 | - flags| there s|
|00003f90| 75 70 65 72 73 65 64 65 | 20 74 68 6f 73 65 20 69 |upersede| those i|
|00003fa0| 6e 20 64 61 74 65 20 66 | 69 6c 65 20 2a 2f 0a 0a |n date f|ile */..|
|00003fb0| 09 67 65 74 5f 61 72 67 | 73 28 61 72 67 76 2c 20 |.get_arg|s(argv, |
|00003fc0| 4f 54 48 45 52 5f 46 4c | 41 47 53 2c 20 46 41 4c |OTHER_FL|AGS, FAL|
|00003fd0| 53 45 29 3b 0a 0a 09 2f | 2a 20 64 6f 6e 65 20 77 |SE);.../|* done w|
|00003fe0| 69 74 68 20 74 68 65 20 | 61 72 67 75 6d 65 6e 74 |ith the |argument|
|00003ff0| 73 20 61 6e 64 20 66 6c | 61 67 73 20 2d 20 74 72 |s and fl|ags - tr|
|00004000| 79 20 74 6f 20 6f 70 65 | 6e 20 74 68 65 20 6f 75 |y to ope|n the ou|
|00004010| 74 70 75 74 20 66 69 6c | 65 20 2a 2f 0a 0a 09 69 |tput fil|e */...i|
|00004020| 66 20 28 2a 6f 75 74 66 | 69 6c 65 20 26 26 20 66 |f (*outf|ile && f|
|00004030| 72 65 6f 70 65 6e 28 6f | 75 74 66 69 6c 65 2c 20 |reopen(o|utfile, |
|00004040| 22 77 22 2c 20 73 74 64 | 6f 75 74 29 20 3d 3d 20 |"w", std|out) == |
|00004050| 28 46 49 4c 45 20 2a 29 | 20 4e 55 4c 4c 29 20 7b |(FILE *)| NULL) {|
|00004060| 0a 09 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |...FPR(s|tderr, "|
|00004070| 25 73 3a 20 63 61 6e 27 | 74 20 6f 70 65 6e 20 66 |%s: can'|t open f|
|00004080| 69 6c 65 20 25 73 5c 6e | 22 2c 20 70 72 6f 67 6e |ile %s\n|", progn|
|00004090| 61 6d 65 2c 20 6f 75 74 | 66 69 6c 65 29 3b 0a 09 |ame, out|file);..|
|000040a0| 09 65 78 69 74 28 45 58 | 49 54 5f 46 41 49 4c 55 |.exit(EX|IT_FAILU|
|000040b0| 52 45 29 3b 0a 09 7d 0a | 0a 09 2f 2a 0a 09 20 2a |RE);..}.|../*.. *|
|000040c0| 20 57 72 69 74 65 20 6f | 75 74 20 50 6f 73 74 53 | Write o|ut PostS|
|000040d0| 63 72 69 70 74 20 70 72 | 6f 6c 6f 67 0a 09 20 2a |cript pr|olog.. *|
|000040e0| 2f 0a 0a 09 2f 2a 20 66 | 6f 6e 74 20 6e 61 6d 65 |/.../* f|ont name|
|000040f0| 73 20 2a 2f 0a 0a 20 09 | 50 52 54 28 22 25 25 21 |s */.. .|PRT("%%!|
|00004100| 5c 6e 22 29 3b 0a 20 09 | 50 52 54 28 22 2f 74 69 |\n");. .|PRT("/ti|
|00004110| 74 6c 65 66 6f 6e 74 20 | 2f 25 73 20 64 65 66 5c |tlefont |/%s def\|
|00004120| 6e 2f 64 61 79 66 6f 6e | 74 20 2f 25 73 20 64 65 |n/dayfon|t /%s de|
|00004130| 66 5c 6e 22 2c 20 74 69 | 74 6c 65 66 6f 6e 74 2c |f\n", ti|tlefont,|
|00004140| 20 64 61 79 66 6f 6e 74 | 29 3b 0a 0a 09 2f 2a 20 | dayfont|);.../* |
|00004150| 6d 6f 6e 74 68 20 6e 61 | 6d 65 73 20 2a 2f 0a 0a |month na|mes */..|
|00004160| 09 50 52 54 28 22 2f 6d | 6f 6e 74 68 5f 6e 61 6d |.PRT("/m|onth_nam|
|00004170| 65 73 20 5b 22 29 3b 0a | 09 66 6f 72 20 28 69 20 |es [");.|.for (i |
|00004180| 3d 20 30 3b 20 69 20 3c | 20 31 32 3b 20 69 2b 2b |= 0; i <| 12; i++|
|00004190| 29 0a 09 09 50 52 54 28 | 22 25 73 28 25 73 29 20 |)...PRT(|"%s(%s) |
|000041a0| 22 2c 20 69 20 25 20 36 | 20 3d 3d 20 30 20 3f 20 |", i % 6| == 0 ? |
|000041b0| 22 5c 6e 5c 74 22 20 3a | 20 22 22 2c 20 6d 6f 6e |"\n\t" :| "", mon|
|000041c0| 74 68 73 5b 69 5d 29 3b | 0a 09 50 52 54 28 22 5d |ths[i]);|..PRT("]|
|000041d0| 20 64 65 66 5c 6e 22 29 | 3b 0a 0a 09 2f 2a 20 64 | def\n")|;.../* d|
|000041e0| 61 79 20 6e 61 6d 65 73 | 20 2a 2f 0a 0a 09 50 52 |ay names| */...PR|
|000041f0| 54 28 22 2f 64 61 79 5f | 6e 61 6d 65 73 20 5b 22 |T("/day_|names ["|
|00004200| 29 3b 0a 09 66 6f 72 20 | 28 69 20 3d 20 30 3b 20 |);..for |(i = 0; |
|00004210| 69 20 3c 20 37 3b 20 69 | 2b 2b 29 0a 09 09 50 52 |i < 7; i|++)...PR|
|00004220| 54 28 22 25 73 28 25 73 | 29 20 22 2c 20 69 20 25 |T("%s(%s|) ", i %|
|00004230| 20 36 20 3d 3d 20 30 20 | 3f 20 22 5c 6e 5c 74 22 | 6 == 0 |? "\n\t"|
|00004240| 20 3a 20 22 22 2c 20 64 | 61 79 73 5b 69 5d 29 3b | : "", d|ays[i]);|
|00004250| 0a 09 50 52 54 28 22 5d | 20 64 65 66 5c 6e 22 29 |..PRT("]| def\n")|
|00004260| 3b 0a 0a 09 2f 2a 20 63 | 6f 6c 6f 72 73 20 28 62 |;.../* c|olors (b|
|00004270| 6c 61 63 6b 2f 67 72 61 | 79 29 20 74 6f 20 70 72 |lack/gra|y) to pr|
|00004280| 69 6e 74 20 77 65 65 6b | 64 61 79 73 20 61 6e 64 |int week|days and|
|00004290| 20 68 6f 6c 69 64 61 79 | 73 20 2a 2f 0a 0a 09 50 | holiday|s */...P|
|000042a0| 52 54 28 22 2f 64 61 79 | 5f 67 72 61 79 20 5b 22 |RT("/day|_gray ["|
|000042b0| 29 3b 0a 09 66 6f 72 20 | 28 6e 67 72 61 79 20 3d |);..for |(ngray =|
|000042c0| 20 69 20 3d 20 30 3b 20 | 69 20 3c 20 37 3b 20 6e | i = 0; |i < 7; n|
|000042d0| 67 72 61 79 20 2b 3d 20 | 63 6f 6c 6f 72 5b 69 2b |gray += |color[i+|
|000042e0| 2b 5d 20 3d 3d 20 47 52 | 41 59 29 0a 09 09 50 52 |+] == GR|AY)...PR|
|000042f0| 54 28 22 20 25 73 22 2c | 20 63 6f 6c 6f 72 5b 69 |T(" %s",| color[i|
|00004300| 5d 20 3d 3d 20 47 52 41 | 59 20 3f 20 22 74 72 75 |] == GRA|Y ? "tru|
|00004310| 65 22 20 3a 20 22 66 61 | 6c 73 65 22 29 3b 0a 09 |e" : "fa|lse");..|
|00004320| 50 52 54 28 22 20 5d 20 | 64 65 66 5c 6e 22 29 3b |PRT(" ] |def\n");|
|00004330| 0a 09 50 52 54 28 22 2f | 68 6f 6c 69 64 61 79 5f |..PRT("/|holiday_|
|00004340| 67 72 61 79 20 25 73 20 | 64 65 66 5c 6e 22 2c 20 |gray %s |def\n", |
|00004350| 6e 67 72 61 79 20 3c 3d | 20 33 20 3f 20 22 74 72 |ngray <=| 3 ? "tr|
|00004360| 75 65 22 20 3a 20 22 66 | 61 6c 73 65 22 29 3b 0a |ue" : "f|alse");.|
|00004370| 0a 09 2f 2a 20 50 6f 73 | 74 53 63 72 69 70 74 20 |../* Pos|tScript |
|00004380| 62 6f 69 6c 65 72 70 6c | 61 74 65 20 28 70 61 72 |boilerpl|ate (par|
|00004390| 74 20 31 29 20 2a 2f 0a | 0a 09 44 4f 5f 48 45 41 |t 1) */.|..DO_HEA|
|000043a0| 44 45 52 28 68 65 61 64 | 65 72 5f 31 29 3b 0a 0a |DER(head|er_1);..|
|000043b0| 09 2f 2a 20 6c 61 6e 64 | 73 63 61 70 65 20 6f 72 |./* land|scape or|
|000043c0| 20 70 6f 72 74 72 61 69 | 74 20 6d 6f 64 65 20 2a | portrai|t mode *|
|000043d0| 2f 0a 0a 20 09 50 52 54 | 28 22 5c 74 25 64 20 72 |/.. .PRT|("\t%d r|
|000043e0| 6f 74 61 74 65 5c 6e 22 | 2c 20 72 6f 74 61 74 65 |otate\n"|, rotate|
|000043f0| 29 3b 0a 20 09 69 66 20 | 28 72 6f 74 61 74 65 20 |);. .if |(rotate |
|00004400| 3d 3d 20 4c 41 4e 44 53 | 43 41 50 45 29 0a 20 09 |== LANDS|CAPE). .|
|00004410| 09 50 52 54 28 22 5c 74 | 35 30 20 2d 31 32 30 20 |.PRT("\t|50 -120 |
|00004420| 74 72 61 6e 73 6c 61 74 | 65 5c 6e 22 29 3b 0a 20 |translat|e\n");. |
|00004430| 09 65 6c 73 65 0a 20 09 | 09 50 52 54 28 22 5c 74 |.else. .|.PRT("\t|
|00004440| 30 2e 37 35 20 30 2e 37 | 35 20 73 63 61 6c 65 5c |0.75 0.7|5 scale\|
|00004450| 6e 5c 74 35 30 20 34 36 | 30 20 74 72 61 6e 73 6c |n\t50 46|0 transl|
|00004460| 61 74 65 5c 6e 22 29 3b | 0a 0a 09 2f 2a 20 50 6f |ate\n");|.../* Po|
|00004470| 73 74 53 63 72 69 70 74 | 20 62 6f 69 6c 65 72 70 |stScript| boilerp|
|00004480| 6c 61 74 65 20 28 70 61 | 72 74 20 32 29 20 2a 2f |late (pa|rt 2) */|
|00004490| 0a 0a 09 44 4f 5f 48 45 | 41 44 45 52 28 68 65 61 |...DO_HE|ADER(hea|
|000044a0| 64 65 72 5f 32 29 3b 0a | 0a 09 2f 2a 0a 09 20 2a |der_2);.|../*.. *|
|000044b0| 20 57 72 69 74 65 20 6f | 75 74 20 50 6f 73 74 53 | Write o|ut PostS|
|000044c0| 63 72 69 70 74 20 63 6f | 64 65 20 74 6f 20 70 72 |cript co|de to pr|
|000044d0| 69 6e 74 20 63 61 6c 65 | 6e 64 61 72 73 0a 09 20 |int cale|ndars.. |
|000044e0| 2a 2f 0a 0a 09 6d 6f 6e | 74 68 20 3d 20 69 6e 69 |*/...mon|th = ini|
|000044f0| 74 5f 6d 6f 6e 74 68 3b | 0a 09 79 65 61 72 20 3d |t_month;|..year =|
|00004500| 20 69 6e 69 74 5f 79 65 | 61 72 3b 0a 0a 09 77 68 | init_ye|ar;...wh|
|00004510| 69 6c 65 20 28 6e 6d 6f | 6e 74 68 73 2d 2d 29 20 |ile (nmo|nths--) |
|00004520| 7b 0a 09 09 70 6d 6f 6e | 74 68 28 6d 6f 6e 74 68 |{...pmon|th(month|
|00004530| 2c 20 79 65 61 72 29 3b | 0a 09 09 69 66 20 28 2b |, year);|...if (+|
|00004540| 2b 6d 6f 6e 74 68 20 3e | 20 44 45 43 29 20 7b 0a |+month >| DEC) {.|
|00004550| 09 09 09 6d 6f 6e 74 68 | 20 3d 20 4a 41 4e 3b 0a |...month| = JAN;.|
|00004560| 09 09 09 79 65 61 72 2b | 2b 3b 0a 09 09 7d 0a 09 |...year+|+;...}..|
|00004570| 7d 0a 0a 09 69 66 20 28 | 64 66 70 29 09 09 2f 2a |}...if (|dfp)../*|
|00004580| 20 63 6c 6f 73 65 20 64 | 61 74 65 20 66 69 6c 65 | close d|ate file|
|00004590| 20 2a 2f 0a 09 09 66 63 | 6c 6f 73 65 28 64 66 70 | */...fc|lose(dfp|
|000045a0| 29 3b 0a 0a 23 69 66 64 | 65 66 20 56 4d 53 0a 09 |);..#ifd|ef VMS..|
|000045b0| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 4f 75 74 |FPR(stde|rr, "Out|
|000045c0| 70 75 74 20 69 73 20 69 | 6e 20 66 69 6c 65 20 25 |put is i|n file %|
|000045d0| 73 5c 6e 22 2c 20 6f 75 | 74 66 69 6c 65 29 3b 0a |s\n", ou|tfile);.|
|000045e0| 23 65 6e 64 69 66 0a 09 | 65 78 69 74 28 45 58 49 |#endif..|exit(EXI|
|000045f0| 54 5f 53 55 43 43 45 53 | 53 29 3b 0a 7d 0a 0c 0a |T_SUCCES|S);.}...|
|00004600| 2f 2a 0a 20 2a 20 67 65 | 74 5f 61 72 67 73 20 2d |/*. * ge|t_args -|
|00004610| 20 77 61 6c 6b 20 74 68 | 65 20 61 72 67 75 6d 65 | walk th|e argume|
|00004620| 6e 74 20 6c 69 73 74 2c | 20 70 61 72 73 69 6e 67 |nt list,| parsing|
|00004630| 20 61 6c 6c 20 61 72 67 | 75 6d 65 6e 74 73 20 62 | all arg|uments b|
|00004640| 75 74 20 70 72 6f 63 65 | 73 73 69 6e 67 20 6f 6e |ut proce|ssing on|
|00004650| 6c 79 0a 20 2a 20 74 68 | 6f 73 65 20 73 70 65 63 |ly. * th|ose spec|
|00004660| 69 66 69 65 64 20 69 6e | 20 22 66 6c 61 67 73 22 |ified in| "flags"|
|00004670| 2e 20 20 49 66 20 22 64 | 6f 5f 6e 75 6d 61 72 67 |. If "d|o_numarg|
|00004680| 73 22 20 69 73 20 54 52 | 55 45 2c 20 70 72 6f 63 |s" is TR|UE, proc|
|00004690| 65 73 73 65 73 20 6e 75 | 6d 65 72 69 63 0a 20 2a |esses nu|meric. *|
|000046a0| 20 61 72 67 75 6d 65 6e | 74 73 20 28 6d 6f 6e 74 | argumen|ts (mont|
|000046b0| 68 2c 20 79 65 61 72 2c | 20 6e 75 6d 62 65 72 20 |h, year,| number |
|000046c0| 6f 66 20 6d 6f 6e 74 68 | 73 29 20 61 73 20 77 65 |of month|s) as we|
|000046d0| 6c 6c 2e 0a 20 2a 2f 0a | 69 6e 74 20 67 65 74 5f |ll.. */.|int get_|
|000046e0| 61 72 67 73 28 61 72 67 | 76 2c 20 66 6c 61 67 73 |args(arg|v, flags|
|000046f0| 2c 20 64 6f 5f 6e 75 6d | 61 72 67 73 29 0a 09 63 |, do_num|args)..c|
|00004700| 68 61 72 20 2a 2a 61 72 | 67 76 3b 09 09 2f 2a 20 |har **ar|gv;../* |
|00004710| 61 72 67 75 6d 65 6e 74 | 20 6c 69 73 74 20 2a 2f |argument| list */|
|00004720| 0a 09 63 68 61 72 20 2a | 66 6c 61 67 73 3b 09 09 |..char *|flags;..|
|00004730| 2f 2a 20 77 68 69 63 68 | 20 66 6c 61 67 73 20 74 |/* which| flags t|
|00004740| 6f 20 70 72 6f 63 65 73 | 73 20 2a 2f 0a 09 69 6e |o proces|s */..in|
|00004750| 74 20 64 6f 5f 6e 75 6d | 61 72 67 73 3b 09 09 2f |t do_num|args;../|
|00004760| 2a 20 70 72 6f 63 65 73 | 73 20 6e 75 6d 65 72 69 |* proces|s numeri|
|00004770| 63 20 61 72 67 75 6d 65 | 6e 74 73 3f 20 2a 2f 0a |c argume|nts? */.|
|00004780| 7b 0a 09 63 68 61 72 20 | 2a 70 2c 20 2a 6f 70 74 |{..char |*p, *opt|
|00004790| 3b 0a 09 69 6e 74 20 69 | 2c 20 64 6f 5f 66 6c 61 |;..int i|, do_fla|
|000047a0| 67 3b 0a 09 6c 6f 6e 67 | 20 74 6d 70 3b 09 09 09 |g;..long| tmp;...|
|000047b0| 2f 2a 20 66 6f 72 20 67 | 65 74 74 69 6e 67 20 63 |/* for g|etting c|
|000047c0| 75 72 72 65 6e 74 20 6d | 6f 6e 74 68 2f 79 65 61 |urrent m|onth/yea|
|000047d0| 72 20 2a 2f 0a 09 73 74 | 72 75 63 74 20 74 6d 20 |r */..st|ruct tm |
|000047e0| 2a 70 5f 74 6d 3b 0a 09 | 69 6e 74 20 62 61 64 6f |*p_tm;..|int bado|
|000047f0| 70 74 20 3d 20 46 41 4c | 53 45 3b 09 09 2f 2a 20 |pt = FAL|SE;../* |
|00004800| 66 6c 61 67 20 73 65 74 | 20 69 66 20 62 61 64 20 |flag set| if bad |
|00004810| 70 61 72 61 6d 20 20 20 | 2a 2f 0a 09 69 6e 74 20 |param |*/..int |
|00004820| 6e 61 72 67 73 20 3d 20 | 30 3b 09 09 09 2f 2a 20 |nargs = |0;.../* |
|00004830| 63 6f 75 6e 74 20 6f 66 | 20 6e 6f 6e 2d 66 6c 61 |count of| non-fla|
|00004840| 67 20 61 72 67 73 20 20 | 2a 2f 0a 09 69 6e 74 20 |g args |*/..int |
|00004850| 6e 75 6d 61 72 67 73 5b | 4d 41 58 41 52 47 53 5d |numargs[|MAXARGS]|
|00004860| 3b 09 09 2f 2a 20 6e 6f | 6e 2d 66 6c 61 67 20 28 |;../* no|n-flag (|
|00004870| 6e 75 6d 65 72 69 63 29 | 20 61 72 67 73 20 2a 2f |numeric)| args */|
|00004880| 0a 0a 2f 2a 20 4c 6f 6f | 6b 20 66 6f 72 20 74 68 |../* Loo|k for th|
|00004890| 65 20 61 72 67 75 6d 65 | 6e 74 20 66 6f 6c 6c 6f |e argume|nt follo|
|000048a0| 77 69 6e 67 20 66 6c 61 | 67 20 2d 20 6d 61 79 20 |wing fla|g - may |
|000048b0| 62 65 20 73 65 70 61 72 | 61 74 65 64 20 62 79 20 |be separ|ated by |
|000048c0| 73 70 61 63 65 73 20 6f | 72 0a 20 2a 20 6e 6f 74 |spaces o|r. * not|
|000048d0| 20 28 62 75 6d 70 73 20 | 61 72 67 76 20 69 6e 20 | (bumps |argv in |
|000048e0| 66 6f 72 6d 65 72 20 63 | 61 73 65 29 2e 20 20 49 |former c|ase). I|
|000048f0| 66 20 6e 6f 20 6e 6f 6e | 2d 66 6c 61 67 20 61 72 |f no non|-flag ar|
|00004900| 67 75 6d 65 6e 74 20 61 | 70 70 65 61 72 73 2c 20 |gument a|ppears, |
|00004910| 73 65 74 0a 20 2a 20 22 | 61 72 67 22 20 74 6f 20 |set. * "|arg" to |
|00004920| 4e 55 4c 4c 20 28 2d 62 | 2c 20 2d 64 2c 20 2d 67 |NULL (-b|, -d, -g|
|00004930| 2c 20 2d 6f 2c 20 61 6e | 64 20 2d 74 20 77 69 74 |, -o, an|d -t wit|
|00004940| 68 6f 75 74 20 61 6e 20 | 61 72 67 75 6d 65 6e 74 |hout an |argument|
|00004950| 20 72 65 73 65 74 20 74 | 68 65 0a 20 2a 20 63 6f | reset t|he. * co|
|00004960| 72 72 65 73 70 6f 6e 64 | 69 6e 67 20 6f 70 74 69 |rrespond|ing opti|
|00004970| 6f 6e 20 74 6f 20 69 74 | 73 20 64 65 66 61 75 6c |on to it|s defaul|
|00004980| 74 20 76 61 6c 75 65 29 | 2e 0a 20 2a 2f 0a 23 64 |t value)|.. */.#d|
|00004990| 65 66 69 6e 65 20 47 45 | 54 41 52 47 28 61 72 67 |efine GE|TARG(arg|
|000049a0| 29 20 61 72 67 20 3d 20 | 2a 28 2a 61 72 67 76 20 |) arg = |*(*argv |
|000049b0| 2b 20 32 29 20 3f 20 2a | 61 72 67 76 20 2b 20 32 |+ 2) ? *|argv + 2|
|000049c0| 20 3a 20 5c 0a 09 09 09 | 28 2a 28 61 72 67 76 2b | : \....|(*(argv+|
|000049d0| 31 29 20 26 26 20 2a 2a | 28 61 72 67 76 2b 31 29 |1) && **|(argv+1)|
|000049e0| 20 21 3d 20 27 2d 27 20 | 3f 20 2a 2b 2b 61 72 67 | != '-' |? *++arg|
|000049f0| 76 20 3a 20 4e 55 4c 4c | 29 0a 0a 09 2f 2a 20 57 |v : NULL|).../* W|
|00004a00| 61 6c 6b 20 61 72 67 75 | 6d 65 6e 74 20 6c 69 73 |alk argu|ment lis|
|00004a10| 74 2c 20 69 67 6e 6f 72 | 69 6e 67 20 66 69 72 73 |t, ignor|ing firs|
|00004a20| 74 20 65 6c 65 6d 65 6e | 74 20 28 70 72 6f 67 72 |t elemen|t (progr|
|00004a30| 61 6d 20 6e 61 6d 65 29 | 20 2a 2f 0a 0a 20 09 77 |am name)| */.. .w|
|00004a40| 68 69 6c 65 20 28 2a 2b | 2b 61 72 67 76 29 20 7b |hile (*+|+argv) {|
|00004a50| 0a 0a 09 09 2f 2a 20 41 | 73 73 75 6d 65 20 74 68 |..../* A|ssume th|
|00004a60| 61 74 20 61 6e 79 20 6e | 6f 6e 2d 66 6c 61 67 20 |at any n|on-flag |
|00004a70| 61 72 67 75 6d 65 6e 74 | 20 69 73 20 61 20 6e 75 |argument| is a nu|
|00004a80| 6d 65 72 69 63 20 61 72 | 67 75 6d 65 6e 74 20 2a |meric ar|gument *|
|00004a90| 2f 0a 09 09 69 66 20 28 | 2a 2a 61 72 67 76 20 21 |/...if (|**argv !|
|00004aa0| 3d 20 27 2d 27 29 20 7b | 0a 09 09 20 20 20 20 09 |= '-') {|... .|
|00004ab0| 69 66 20 28 64 6f 5f 6e | 75 6d 61 72 67 73 20 26 |if (do_n|umargs &|
|00004ac0| 26 20 6e 61 72 67 73 20 | 3c 20 4d 41 58 41 52 47 |& nargs |< MAXARG|
|00004ad0| 53 29 0a 09 09 09 09 6e | 75 6d 61 72 67 73 5b 6e |S).....n|umargs[n|
|00004ae0| 61 72 67 73 2b 2b 5d 20 | 3d 20 61 74 6f 69 28 2a |args++] |= atoi(*|
|00004af0| 61 72 67 76 29 3b 0a 09 | 09 09 63 6f 6e 74 69 6e |argv);..|..contin|
|00004b00| 75 65 3b 0a 09 09 7d 0a | 0a 09 09 2f 2a 20 49 73 |ue;...}.|.../* Is|
|00004b10| 20 74 68 69 73 20 66 6c | 61 67 20 61 6d 6f 6e 67 | this fl|ag among|
|00004b20| 20 74 68 6f 73 65 20 74 | 6f 20 62 65 20 70 72 6f | those t|o be pro|
|00004b30| 63 65 73 73 65 64 20 62 | 65 79 6f 6e 64 20 70 61 |cessed b|eyond pa|
|00004b40| 72 73 69 6e 67 3f 20 2a | 2f 0a 0a 09 09 64 6f 5f |rsing? *|/....do_|
|00004b50| 66 6c 61 67 20 3d 20 73 | 74 72 63 68 72 28 66 6c |flag = s|trchr(fl|
|00004b60| 61 67 73 2c 20 2a 28 6f | 70 74 20 3d 20 2a 61 72 |ags, *(o|pt = *ar|
|00004b70| 67 76 20 2b 20 31 29 29 | 20 21 3d 20 4e 55 4c 4c |gv + 1))| != NULL|
|00004b80| 3b 0a 0a 09 09 73 77 69 | 74 63 68 20 28 2a 6f 70 |;....swi|tch (*op|
|00004b90| 74 29 20 7b 0a 0a 09 09 | 63 61 73 65 20 27 62 27 |t) {....|case 'b'|
|00004ba0| 3a 09 09 2f 2a 20 70 72 | 69 6e 74 20 64 61 79 20 |:../* pr|int day |
|00004bb0| 69 6e 20 62 6c 61 63 6b | 20 6f 72 20 67 72 61 79 |in black| or gray|
|00004bc0| 20 2a 2f 0a 09 09 63 61 | 73 65 20 27 67 27 3a 0a | */...ca|se 'g':.|
|00004bd0| 09 09 09 47 45 54 41 52 | 47 28 70 29 3b 0a 09 09 |...GETAR|G(p);...|
|00004be0| 09 69 66 20 28 64 6f 5f | 66 6c 61 67 29 0a 09 09 |.if (do_|flag)...|
|00004bf0| 09 09 69 66 20 28 70 29 | 0a 09 09 09 09 09 73 65 |..if (p)|......se|
|00004c00| 74 5f 63 6f 6c 6f 72 28 | 70 2c 20 2a 6f 70 74 20 |t_color(|p, *opt |
|00004c10| 3d 3d 20 27 62 27 20 3f | 20 42 4c 41 43 4b 20 3a |== 'b' ?| BLACK :|
|00004c20| 20 47 52 41 59 29 3b 0a | 09 09 09 09 65 6c 73 65 | GRAY);.|....else|
|00004c30| 0a 09 09 09 09 09 49 4e | 49 54 5f 43 4f 4c 4f 52 |......IN|IT_COLOR|
|00004c40| 53 3b 09 2f 2a 20 72 65 | 73 65 74 20 74 6f 20 64 |S;./* re|set to d|
|00004c50| 65 66 61 75 6c 74 73 20 | 2a 2f 0a 09 09 09 62 72 |efaults |*/....br|
|00004c60| 65 61 6b 3b 0a 0a 20 09 | 09 63 61 73 65 20 27 64 |eak;.. .|.case 'd|
|00004c70| 27 3a 09 09 2f 2a 20 73 | 70 65 63 69 66 79 20 61 |':../* s|pecify a|
|00004c80| 6c 74 65 72 6e 61 74 65 | 20 64 61 79 20 66 6f 6e |lternate| day fon|
|00004c90| 74 20 2a 2f 0a 20 09 09 | 09 47 45 54 41 52 47 28 |t */. ..|.GETARG(|
|00004ca0| 70 29 3b 0a 09 09 09 69 | 66 20 28 64 6f 5f 66 6c |p);....i|f (do_fl|
|00004cb0| 61 67 29 0a 09 09 09 09 | 73 74 72 63 70 79 28 64 |ag).....|strcpy(d|
|00004cc0| 61 79 66 6f 6e 74 2c 20 | 70 20 3f 20 70 20 3a 20 |ayfont, |p ? p : |
|00004cd0| 44 41 59 46 4f 4e 54 29 | 3b 0a 20 09 09 09 62 72 |DAYFONT)|;. ...br|
|00004ce0| 65 61 6b 3b 0a 0a 09 09 | 63 61 73 65 20 27 65 27 |eak;....|case 'e'|
|00004cf0| 3a 09 09 2f 2a 20 67 65 | 6e 65 72 61 74 65 20 65 |:../* ge|nerate e|
|00004d00| 6d 70 74 79 20 63 61 6c | 65 6e 64 61 72 20 2a 2f |mpty cal|endar */|
|00004d10| 0a 09 09 09 69 66 20 28 | 64 6f 5f 66 6c 61 67 29 |....if (|do_flag)|
|00004d20| 20 7b 0a 09 09 09 09 64 | 61 74 65 66 69 6c 65 5f | {.....d|atefile_|
|00004d30| 74 79 70 65 20 3d 20 4e | 4f 5f 44 41 54 45 46 49 |type = N|O_DATEFI|
|00004d40| 4c 45 3b 0a 09 09 09 09 | 64 61 74 65 66 69 6c 65 |LE;.....|datefile|
|00004d50| 5b 30 5d 20 3d 20 27 5c | 30 27 3b 0a 09 09 09 7d |[0] = '\|0';....}|
|00004d60| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 0a 09 09 63 61 |....brea|k;....ca|
|00004d70| 73 65 20 27 66 27 3a 09 | 09 2f 2a 20 73 70 65 63 |se 'f':.|./* spec|
|00004d80| 69 66 79 20 61 6c 74 65 | 72 6e 61 74 65 20 64 61 |ify alte|rnate da|
|00004d90| 74 65 20 66 69 6c 65 20 | 2a 2f 0a 09 09 09 47 45 |te file |*/....GE|
|00004da0| 54 41 52 47 28 70 29 3b | 0a 09 09 09 69 66 20 28 |TARG(p);|....if (|
|00004db0| 70 20 26 26 20 64 6f 5f | 66 6c 61 67 29 20 7b 0a |p && do_|flag) {.|
|00004dc0| 09 09 09 09 64 61 74 65 | 66 69 6c 65 5f 74 79 70 |....date|file_typ|
|00004dd0| 65 20 3d 20 55 53 45 52 | 5f 44 41 54 45 46 49 4c |e = USER|_DATEFIL|
|00004de0| 45 3b 0a 09 09 09 09 73 | 74 72 63 70 79 28 64 61 |E;.....s|trcpy(da|
|00004df0| 74 65 66 69 6c 65 2c 20 | 70 29 3b 0a 09 09 09 7d |tefile, |p);....}|
|00004e00| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 0a 20 09 09 63 |....brea|k;.. ..c|
|00004e10| 61 73 65 20 27 6c 27 3a | 09 09 2f 2a 20 67 65 6e |ase 'l':|../* gen|
|00004e20| 65 72 61 74 65 20 6c 61 | 6e 64 73 63 61 70 65 20 |erate la|ndscape |
|00004e30| 63 61 6c 65 6e 64 61 72 | 20 2a 2f 0a 09 09 09 69 |calendar| */....i|
|00004e40| 66 20 28 64 6f 5f 66 6c | 61 67 29 0a 09 20 09 09 |f (do_fl|ag).. ..|
|00004e50| 09 72 6f 74 61 74 65 20 | 3d 20 4c 41 4e 44 53 43 |.rotate |= LANDSC|
|00004e60| 41 50 45 3b 0a 20 09 09 | 09 62 72 65 61 6b 3b 0a |APE;. ..|.break;.|
|00004e70| 20 0a 09 09 63 61 73 65 | 20 27 6f 27 3a 09 09 2f | ...case| 'o':../|
|00004e80| 2a 20 73 70 65 63 69 66 | 79 20 61 6c 74 65 72 6e |* specif|y altern|
|00004e90| 61 74 65 20 6f 75 74 70 | 75 74 20 66 69 6c 65 20 |ate outp|ut file |
|00004ea0| 2a 2f 0a 09 09 09 47 45 | 54 41 52 47 28 70 29 3b |*/....GE|TARG(p);|
|00004eb0| 0a 09 09 09 69 66 20 28 | 64 6f 5f 66 6c 61 67 29 |....if (|do_flag)|
|00004ec0| 0a 09 09 09 09 73 74 72 | 63 70 79 28 6f 75 74 66 |.....str|cpy(outf|
|00004ed0| 69 6c 65 2c 20 70 20 3f | 20 70 20 3a 20 4f 55 54 |ile, p ?| p : OUT|
|00004ee0| 46 49 4c 45 29 3b 0a 09 | 09 09 62 72 65 61 6b 3b |FILE);..|..break;|
|00004ef0| 0a 0a 20 09 09 63 61 73 | 65 20 27 70 27 3a 09 09 |.. ..cas|e 'p':..|
|00004f00| 2f 2a 20 67 65 6e 65 72 | 61 74 65 20 70 6f 72 74 |/* gener|ate port|
|00004f10| 72 61 69 74 20 63 61 6c | 65 6e 64 61 72 20 2a 2f |rait cal|endar */|
|00004f20| 0a 09 09 09 69 66 20 28 | 64 6f 5f 66 6c 61 67 29 |....if (|do_flag)|
|00004f30| 0a 09 20 09 09 09 72 6f | 74 61 74 65 20 3d 20 50 |.. ...ro|tate = P|
|00004f40| 4f 52 54 52 41 49 54 3b | 0a 20 09 09 09 62 72 65 |ORTRAIT;|. ...bre|
|00004f50| 61 6b 3b 0a 20 0a 20 09 | 09 63 61 73 65 20 27 74 |ak;. . .|.case 't|
|00004f60| 27 3a 09 09 2f 2a 20 73 | 70 65 63 69 66 79 20 61 |':../* s|pecify a|
|00004f70| 6c 74 65 72 6e 61 74 65 | 20 74 69 74 6c 65 20 66 |lternate| title f|
|00004f80| 6f 6e 74 20 2a 2f 0a 20 | 09 09 09 47 45 54 41 52 |ont */. |...GETAR|
|00004f90| 47 28 70 29 3b 0a 09 09 | 09 69 66 20 28 64 6f 5f |G(p);...|.if (do_|
|00004fa0| 66 6c 61 67 29 0a 09 09 | 09 09 73 74 72 63 70 79 |flag)...|..strcpy|
|00004fb0| 28 74 69 74 6c 65 66 6f | 6e 74 2c 20 70 20 3f 20 |(titlefo|nt, p ? |
|00004fc0| 70 20 3a 20 54 49 54 4c | 45 46 4f 4e 54 29 3b 0a |p : TITL|EFONT);.|
|00004fd0| 20 09 09 09 62 72 65 61 | 6b 3b 0a 0a 09 09 64 65 | ...brea|k;....de|
|00004fe0| 66 61 75 6c 74 3a 09 09 | 2f 2a 20 75 6e 72 65 63 |fault:..|/* unrec|
|00004ff0| 6f 67 6e 69 7a 65 64 20 | 66 6c 61 67 20 2a 2f 0a |ognized |flag */.|
|00005000| 09 09 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |...FPR(s|tderr, "|
|00005010| 25 73 3a 20 69 6c 6c 65 | 67 61 6c 20 6f 70 74 69 |%s: ille|gal opti|
|00005020| 6f 6e 20 2d 25 73 5c 6e | 22 2c 20 70 72 6f 67 6e |on -%s\n|", progn|
|00005030| 61 6d 65 2c 20 6f 70 74 | 29 3b 0a 09 09 09 62 61 |ame, opt|);....ba|
|00005040| 64 6f 70 74 20 3d 20 54 | 52 55 45 3b 0a 09 09 09 |dopt = T|RUE;....|
|00005050| 62 72 65 61 6b 3b 0a 09 | 09 7d 0a 20 20 20 20 20 |break;..|.}. |
|00005060| 20 20 20 7d 0a 0a 09 69 | 66 20 28 21 64 6f 5f 6e | }...i|f (!do_n|
|00005070| 75 6d 61 72 67 73 29 0a | 09 09 72 65 74 75 72 6e |umargs).|..return|
|00005080| 20 28 21 62 61 64 6f 70 | 74 29 3b 09 2f 2a 20 72 | (!badop|t);./* r|
|00005090| 65 74 75 72 6e 20 54 52 | 55 45 20 69 66 20 4f 4b |eturn TR|UE if OK|
|000050a0| 2c 20 46 41 4c 53 45 20 | 69 66 20 65 72 72 6f 72 |, FALSE |if error|
|000050b0| 20 2a 2f 0a 0a 09 2f 2a | 20 56 61 6c 69 64 61 74 | */.../*| Validat|
|000050c0| 65 20 6e 6f 6e 2d 66 6c | 61 67 20 28 6e 75 6d 65 |e non-fl|ag (nume|
|000050d0| 72 69 63 29 20 70 61 72 | 61 6d 65 74 65 72 73 20 |ric) par|ameters |
|000050e0| 2a 2f 0a 0a 09 73 77 69 | 74 63 68 20 28 6e 61 72 |*/...swi|tch (nar|
|000050f0| 67 73 29 20 7b 0a 09 63 | 61 73 65 20 30 3a 09 09 |gs) {..c|ase 0:..|
|00005100| 2f 2a 20 6e 6f 20 61 72 | 67 75 6d 65 6e 74 73 20 |/* no ar|guments |
|00005110| 2d 20 70 72 69 6e 74 20 | 63 75 72 72 65 6e 74 20 |- print |current |
|00005120| 6d 6f 6e 74 68 2f 79 65 | 61 72 20 2a 2f 0a 09 09 |month/ye|ar */...|
|00005130| 74 69 6d 65 28 26 74 6d | 70 29 3b 0a 09 09 70 5f |time(&tm|p);...p_|
|00005140| 74 6d 20 3d 20 6c 6f 63 | 61 6c 74 69 6d 65 28 26 |tm = loc|altime(&|
|00005150| 74 6d 70 29 3b 0a 09 09 | 69 6e 69 74 5f 6d 6f 6e |tmp);...|init_mon|
|00005160| 74 68 20 3d 20 70 5f 74 | 6d 2d 3e 74 6d 5f 6d 6f |th = p_t|m->tm_mo|
|00005170| 6e 20 2b 20 31 3b 0a 09 | 09 69 6e 69 74 5f 79 65 |n + 1;..|.init_ye|
|00005180| 61 72 20 3d 20 70 5f 74 | 6d 2d 3e 74 6d 5f 79 65 |ar = p_t|m->tm_ye|
|00005190| 61 72 3b 0a 09 09 6e 6d | 6f 6e 74 68 73 20 3d 20 |ar;...nm|onths = |
|000051a0| 31 3b 0a 09 09 62 72 65 | 61 6b 3b 09 09 09 0a 09 |1;...bre|ak;.....|
|000051b0| 63 61 73 65 20 31 3a 09 | 09 2f 2a 20 6f 6e 65 20 |case 1:.|./* one |
|000051c0| 61 72 67 75 6d 65 6e 74 | 20 2d 20 70 72 69 6e 74 |argument| - print|
|000051d0| 20 65 6e 74 69 72 65 20 | 79 65 61 72 20 2a 2f 0a | entire |year */.|
|000051e0| 09 09 69 6e 69 74 5f 6d | 6f 6e 74 68 20 3d 20 4a |..init_m|onth = J|
|000051f0| 41 4e 3b 0a 09 09 69 6e | 69 74 5f 79 65 61 72 20 |AN;...in|it_year |
|00005200| 3d 20 6e 75 6d 61 72 67 | 73 5b 30 5d 3b 0a 09 09 |= numarg|s[0];...|
|00005210| 6e 6d 6f 6e 74 68 73 20 | 3d 20 31 32 3b 0a 09 09 |nmonths |= 12;...|
|00005220| 62 72 65 61 6b 3b 0a 09 | 64 65 66 61 75 6c 74 3a |break;..|default:|
|00005230| 09 2f 2a 20 74 77 6f 20 | 6f 72 20 74 68 72 65 65 |./* two |or three|
|00005240| 20 61 72 67 75 6d 65 6e | 74 73 20 2d 20 70 72 69 | argumen|ts - pri|
|00005250| 6e 74 20 6f 6e 65 20 6f | 72 20 6d 6f 72 65 20 6d |nt one o|r more m|
|00005260| 6f 6e 74 68 73 20 2a 2f | 0a 09 09 69 6e 69 74 5f |onths */|...init_|
|00005270| 6d 6f 6e 74 68 20 3d 20 | 6e 75 6d 61 72 67 73 5b |month = |numargs[|
|00005280| 30 5d 3b 0a 09 09 69 6e | 69 74 5f 79 65 61 72 20 |0];...in|it_year |
|00005290| 3d 20 6e 75 6d 61 72 67 | 73 5b 31 5d 3b 0a 09 09 |= numarg|s[1];...|
|000052a0| 6e 6d 6f 6e 74 68 73 20 | 3d 20 6e 61 72 67 73 20 |nmonths |= nargs |
|000052b0| 3e 20 32 20 3f 20 6e 75 | 6d 61 72 67 73 5b 32 5d |> 2 ? nu|margs[2]|
|000052c0| 20 3a 20 31 3b 0a 09 09 | 62 72 65 61 6b 3b 0a 09 | : 1;...|break;..|
|000052d0| 7d 0a 0a 09 69 66 20 28 | 6e 6d 6f 6e 74 68 73 20 |}...if (|nmonths |
|000052e0| 3c 20 31 29 09 09 2f 2a | 20 65 6e 73 75 72 65 20 |< 1)../*| ensure |
|000052f0| 61 74 20 6c 65 61 73 74 | 20 6f 6e 65 20 6d 6f 6e |at least| one mon|
|00005300| 74 68 20 2a 2f 0a 09 09 | 6e 6d 6f 6e 74 68 73 20 |th */...|nmonths |
|00005310| 3d 20 31 3b 0a 0a 09 2f | 2a 20 63 68 65 63 6b 20 |= 1;.../|* check |
|00005320| 72 61 6e 67 65 20 6f 66 | 20 6d 6f 6e 74 68 20 61 |range of| month a|
|00005330| 6e 64 20 79 65 61 72 20 | 2a 2f 0a 0a 09 69 66 20 |nd year |*/...if |
|00005340| 28 69 6e 69 74 5f 6d 6f | 6e 74 68 20 3c 20 4a 41 |(init_mo|nth < JA|
|00005350| 4e 20 7c 7c 20 69 6e 69 | 74 5f 6d 6f 6e 74 68 20 |N || ini|t_month |
|00005360| 3e 20 44 45 43 29 20 7b | 0a 09 09 46 50 52 28 73 |> DEC) {|...FPR(s|
|00005370| 74 64 65 72 72 2c 20 22 | 25 73 3a 20 6d 6f 6e 74 |tderr, "|%s: mont|
|00005380| 68 20 25 64 20 6e 6f 74 | 20 69 6e 20 72 61 6e 67 |h %d not| in rang|
|00005390| 65 20 31 20 2e 2e 20 31 | 32 5c 6e 22 2c 20 70 72 |e 1 .. 1|2\n", pr|
|000053a0| 6f 67 6e 61 6d 65 2c 0a | 09 09 09 69 6e 69 74 5f |ogname,.|...init_|
|000053b0| 6d 6f 6e 74 68 29 3b 0a | 09 09 62 61 64 6f 70 74 |month);.|..badopt|
|000053c0| 20 3d 20 54 52 55 45 3b | 0a 09 7d 0a 09 0a 09 69 | = TRUE;|..}....i|
|000053d0| 66 20 28 69 6e 69 74 5f | 79 65 61 72 20 3e 20 30 |f (init_|year > 0|
|000053e0| 20 26 26 20 69 6e 69 74 | 5f 79 65 61 72 20 3c 20 | && init|_year < |
|000053f0| 31 30 30 29 09 2f 2a 20 | 74 72 65 61 74 20 6e 6e |100)./* |treat nn|
|00005400| 20 61 73 20 31 39 6e 6e | 20 2a 2f 0a 09 09 69 6e | as 19nn| */...in|
|00005410| 69 74 5f 79 65 61 72 20 | 2b 3d 20 31 39 30 30 3b |it_year |+= 1900;|
|00005420| 0a 09 0a 09 69 66 20 28 | 69 6e 69 74 5f 79 65 61 |....if (|init_yea|
|00005430| 72 20 3c 20 4d 49 4e 5f | 59 52 20 7c 7c 20 69 6e |r < MIN_|YR || in|
|00005440| 69 74 5f 79 65 61 72 20 | 3e 20 4d 41 58 5f 59 52 |it_year |> MAX_YR|
|00005450| 29 20 7b 0a 09 09 46 50 | 52 28 73 74 64 65 72 72 |) {...FP|R(stderr|
|00005460| 2c 20 22 25 73 20 79 65 | 61 72 20 25 64 20 6e 6f |, "%s ye|ar %d no|
|00005470| 74 20 69 6e 20 72 61 6e | 67 65 20 25 64 20 2e 2e |t in ran|ge %d ..|
|00005480| 20 25 64 5c 6e 22 2c 20 | 70 72 6f 67 6e 61 6d 65 | %d\n", |progname|
|00005490| 2c 0a 09 09 09 69 6e 69 | 74 5f 79 65 61 72 2c 20 |,....ini|t_year, |
|000054a0| 4d 49 4e 5f 59 52 2c 20 | 4d 41 58 5f 59 52 29 3b |MIN_YR, |MAX_YR);|
|000054b0| 0a 09 09 62 61 64 6f 70 | 74 20 3d 20 54 52 55 45 |...badop|t = TRUE|
|000054c0| 3b 0a 09 7d 0a 0a 09 72 | 65 74 75 72 6e 20 28 21 |;..}...r|eturn (!|
|000054d0| 62 61 64 6f 70 74 29 3b | 09 2f 2a 20 72 65 74 75 |badopt);|./* retu|
|000054e0| 72 6e 20 54 52 55 45 20 | 69 66 20 4f 4b 2c 20 46 |rn TRUE |if OK, F|
|000054f0| 41 4c 53 45 20 69 66 20 | 65 72 72 6f 72 20 2a 2f |ALSE if |error */|
|00005500| 0a 7d 0a 0a 0a 0c 0a 2f | 2a 0a 20 2a 09 75 73 61 |.}...../|*. *.usa|
|00005510| 67 65 20 2d 20 70 72 69 | 6e 74 20 6d 65 73 73 61 |ge - pri|nt messa|
|00005520| 67 65 20 65 78 70 6c 61 | 69 6e 69 6e 67 20 63 6f |ge expla|ining co|
|00005530| 72 72 65 63 74 20 75 73 | 61 67 65 20 6f 66 20 74 |rrect us|age of t|
|00005540| 68 65 20 63 6f 6d 6d 61 | 6e 64 2d 6c 69 6e 65 0a |he comma|nd-line.|
|00005550| 20 2a 09 61 72 67 75 6d | 65 6e 74 73 20 61 6e 64 | *.argum|ents and|
|00005560| 20 66 6c 61 67 73 0a 20 | 2a 2f 0a 75 73 61 67 65 | flags. |*/.usage|
|00005570| 28 29 0a 7b 0a 09 46 50 | 52 28 73 74 64 65 72 72 |().{..FP|R(stderr|
|00005580| 2c 20 22 5c 6e 55 73 61 | 67 65 3a 5c 74 25 73 20 |, "\nUsa|ge:\t%s |
|00005590| 5b 2d 62 20 44 41 59 5d | 2a 20 5b 2d 64 20 46 4f |[-b DAY]|* [-d FO|
|000055a0| 4e 54 5d 20 5b 2d 65 20 | 7c 20 2d 66 20 46 49 4c |NT] [-e || -f FIL|
|000055b0| 45 5d 20 5b 2d 67 20 44 | 41 59 5d 2a 20 5b 2d 6f |E] [-g D|AY]* [-o|
|000055c0| 20 46 49 4c 45 5d 5c 6e | 22 2c 20 70 72 6f 67 6e | FILE]\n|", progn|
|000055d0| 61 6d 65 29 3b 0a 09 46 | 50 52 28 73 74 64 65 72 |ame);..F|PR(stder|
|000055e0| 72 2c 20 22 5c 74 5c 74 | 5b 2d 6c 7c 2d 70 5d 20 |r, "\t\t|[-l|-p] |
|000055f0| 5b 2d 74 20 46 4f 4e 54 | 5d 20 5b 20 5b 20 5b 6d |[-t FONT|] [ [ [m|
|00005600| 6d 5d 20 79 79 20 5d 20 | 7c 20 5b 6d 6d 20 79 79 |m] yy ] || [mm yy|
|00005610| 20 6e 5d 20 5d 5c 6e 22 | 29 3b 0a 09 46 50 52 28 | n] ]\n"|);..FPR(|
|00005620| 73 74 64 65 72 72 2c 20 | 22 5c 6e 22 29 3b 0a 09 |stderr, |"\n");..|
|00005630| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 74 2d |FPR(stde|rr, "\t-|
|00005640| 62 20 44 41 59 5c 74 5c | 74 70 72 69 6e 74 20 77 |b DAY\t\|tprint w|
|00005650| 65 65 6b 64 61 79 20 44 | 41 59 20 69 6e 20 62 6c |eekday D|AY in bl|
|00005660| 61 63 6b 5c 6e 22 29 3b | 0a 09 46 50 52 28 73 74 |ack\n");|..FPR(st|
|00005670| 64 65 72 72 2c 20 22 5c | 74 2d 67 20 44 41 59 5c |derr, "\|t-g DAY\|
|00005680| 74 5c 74 70 72 69 6e 74 | 20 77 65 65 6b 64 61 79 |t\tprint| weekday|
|00005690| 20 44 41 59 20 69 6e 20 | 67 72 61 79 5c 6e 22 29 | DAY in |gray\n")|
|000056a0| 3b 0a 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |;..FPR(s|tderr, "|
|000056b0| 5c 74 5c 74 5c 74 28 64 | 65 66 61 75 6c 74 3a 20 |\t\t\t(d|efault: |
|000056c0| 25 73 29 5c 6e 22 2c 20 | 43 4f 4c 4f 52 5f 4d 53 |%s)\n", |COLOR_MS|
|000056d0| 47 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |G);..FPR|(stderr,|
|000056e0| 20 22 5c 6e 22 29 3b 0a | 09 46 50 52 28 73 74 64 | "\n");.|.FPR(std|
|000056f0| 65 72 72 2c 20 22 5c 74 | 2d 64 20 46 4f 4e 54 5c |err, "\t|-d FONT\|
|00005700| 74 5c 74 73 70 65 63 69 | 66 79 20 61 6c 74 65 72 |t\tspeci|fy alter|
|00005710| 6e 61 74 65 20 64 61 79 | 20 6e 61 6d 65 20 66 6f |nate day| name fo|
|00005720| 6e 74 20 28 64 65 66 61 | 75 6c 74 3a 20 25 73 29 |nt (defa|ult: %s)|
|00005730| 5c 6e 22 2c 0a 09 09 44 | 41 59 46 4f 4e 54 29 3b |\n",...D|AYFONT);|
|00005740| 0a 09 46 50 52 28 73 74 | 64 65 72 72 2c 20 22 5c |..FPR(st|derr, "\|
|00005750| 74 2d 74 20 46 4f 4e 54 | 5c 74 5c 74 73 70 65 63 |t-t FONT|\t\tspec|
|00005760| 69 66 79 20 61 6c 74 65 | 72 6e 61 74 65 20 74 69 |ify alte|rnate ti|
|00005770| 74 6c 65 20 66 6f 6e 74 | 20 28 64 65 66 61 75 6c |tle font| (defaul|
|00005780| 74 3a 20 25 73 29 5c 6e | 22 2c 0a 09 09 54 49 54 |t: %s)\n|",...TIT|
|00005790| 4c 45 46 4f 4e 54 29 3b | 0a 09 46 50 52 28 73 74 |LEFONT);|..FPR(st|
|000057a0| 64 65 72 72 2c 20 22 5c | 6e 22 29 3b 0a 09 46 50 |derr, "\|n");..FP|
|000057b0| 52 28 73 74 64 65 72 72 | 2c 20 22 5c 74 2d 65 5c |R(stderr|, "\t-e\|
|000057c0| 74 5c 74 67 65 6e 65 72 | 61 74 65 20 65 6d 70 74 |t\tgener|ate empt|
|000057d0| 79 20 63 61 6c 65 6e 64 | 61 72 20 28 69 67 6e 6f |y calend|ar (igno|
|000057e0| 72 65 20 64 61 74 65 20 | 66 69 6c 65 29 5c 6e 22 |re date |file)\n"|
|000057f0| 29 3b 0a 09 46 50 52 28 | 73 74 64 65 72 72 2c 20 |);..FPR(|stderr, |
|00005800| 22 5c 74 2d 66 20 46 49 | 4c 45 5c 74 5c 74 73 70 |"\t-f FI|LE\t\tsp|
|00005810| 65 63 69 66 79 20 61 6c | 74 65 72 6e 61 74 65 20 |ecify al|ternate |
|00005820| 64 61 74 65 20 66 69 6c | 65 20 28 64 65 66 61 75 |date fil|e (defau|
|00005830| 6c 74 3a 20 25 73 29 5c | 6e 22 2c 0a 09 09 44 41 |lt: %s)\|n",...DA|
|00005840| 54 45 46 49 4c 45 29 3b | 0a 09 46 50 52 28 73 74 |TEFILE);|..FPR(st|
|00005850| 64 65 72 72 2c 20 22 5c | 74 2d 6f 20 46 49 4c 45 |derr, "\|t-o FILE|
|00005860| 5c 74 5c 74 73 70 65 63 | 69 66 79 20 61 6c 74 65 |\t\tspec|ify alte|
|00005870| 72 6e 61 74 65 20 6f 75 | 74 70 75 74 20 66 69 6c |rnate ou|tput fil|
|00005880| 65 20 28 64 65 66 61 75 | 6c 74 3a 20 25 73 29 5c |e (defau|lt: %s)\|
|00005890| 6e 22 2c 0a 09 09 4f 55 | 54 46 49 4c 45 5b 30 5d |n",...OU|TFILE[0]|
|000058a0| 20 3f 20 4f 55 54 46 49 | 4c 45 20 3a 20 22 73 74 | ? OUTFI|LE : "st|
|000058b0| 64 6f 75 74 22 29 3b 0a | 09 46 50 52 28 73 74 64 |dout");.|.FPR(std|
|000058c0| 65 72 72 2c 20 22 5c 6e | 22 29 3b 0a 09 46 50 52 |err, "\n|");..FPR|
|000058d0| 28 73 74 64 65 72 72 2c | 20 22 5c 74 2d 6c 5c 74 |(stderr,| "\t-l\t|
|000058e0| 5c 74 67 65 6e 65 72 61 | 74 65 20 6c 61 6e 64 73 |\tgenera|te lands|
|000058f0| 63 61 70 65 2d 73 74 79 | 6c 65 20 63 61 6c 65 6e |cape-sty|le calen|
|00005900| 64 61 72 73 22 29 3b 0a | 23 69 66 20 28 52 4f 54 |dars");.|#if (ROT|
|00005910| 41 54 45 20 3d 3d 20 4c | 41 4e 44 53 43 41 50 45 |ATE == L|ANDSCAPE|
|00005920| 29 0a 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |)..FPR(s|tderr, "|
|00005930| 20 28 64 65 66 61 75 6c | 74 29 22 29 3b 0a 23 65 | (defaul|t)");.#e|
|00005940| 6e 64 69 66 0a 09 46 50 | 52 28 73 74 64 65 72 72 |ndif..FP|R(stderr|
|00005950| 2c 20 22 5c 6e 5c 74 2d | 70 5c 74 5c 74 67 65 6e |, "\n\t-|p\t\tgen|
|00005960| 65 72 61 74 65 20 70 6f | 72 74 72 61 69 74 2d 73 |erate po|rtrait-s|
|00005970| 74 79 6c 65 20 63 61 6c | 65 6e 64 61 72 73 22 29 |tyle cal|endars")|
|00005980| 3b 0a 23 69 66 20 28 52 | 4f 54 41 54 45 20 3d 3d |;.#if (R|OTATE ==|
|00005990| 20 50 4f 52 54 52 41 49 | 54 29 0a 09 46 50 52 28 | PORTRAI|T)..FPR(|
|000059a0| 73 74 64 65 72 72 2c 20 | 22 20 28 64 65 66 61 75 |stderr, |" (defau|
|000059b0| 6c 74 29 22 29 3b 0a 23 | 65 6e 64 69 66 0a 09 46 |lt)");.#|endif..F|
|000059c0| 50 52 28 73 74 64 65 72 | 72 2c 20 22 5c 6e 5c 6e |PR(stder|r, "\n\n|
|000059d0| 22 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |");..FPR|(stderr,|
|000059e0| 20 22 5c 74 79 79 5c 74 | 5c 74 67 65 6e 65 72 61 | "\tyy\t|\tgenera|
|000059f0| 74 65 20 63 61 6c 65 6e | 64 61 72 20 66 6f 72 20 |te calen|dar for |
|00005a00| 79 65 61 72 20 79 79 20 | 28 31 39 79 79 20 69 66 |year yy |(19yy if|
|00005a10| 20 79 79 20 3c 20 31 30 | 30 29 5c 6e 22 29 3b 0a | yy < 10|0)\n");.|
|00005a20| 09 46 50 52 28 73 74 64 | 65 72 72 2c 20 22 5c 74 |.FPR(std|err, "\t|
|00005a30| 6d 6d 20 79 79 5c 74 5c | 74 67 65 6e 65 72 61 74 |mm yy\t\|tgenerat|
|00005a40| 65 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 6d |e calend|ar for m|
|00005a50| 6f 6e 74 68 20 6d 6d 20 | 28 4a 61 6e 20 3d 20 31 |onth mm |(Jan = 1|
|00005a60| 29 2c 20 79 65 61 72 20 | 79 79 5c 6e 22 29 3b 0a |), year |yy\n");.|
|00005a70| 09 46 50 52 28 73 74 64 | 65 72 72 2c 20 22 5c 74 |.FPR(std|err, "\t|
|00005a80| 6d 6d 20 79 79 20 6e 5c | 74 5c 74 67 65 6e 65 72 |mm yy n\|t\tgener|
|00005a90| 61 74 65 20 63 61 6c 65 | 6e 64 61 72 73 20 66 6f |ate cale|ndars fo|
|00005aa0| 72 20 6e 20 6d 6f 6e 74 | 68 73 2c 20 73 74 61 72 |r n mont|hs, star|
|00005ab0| 74 69 6e 67 20 61 74 20 | 6d 6d 2f 79 79 5c 6e 22 |ting at |mm/yy\n"|
|00005ac0| 29 3b 0a 09 46 50 52 28 | 73 74 64 65 72 72 2c 20 |);..FPR(|stderr, |
|00005ad0| 22 5c 74 28 64 65 66 61 | 75 6c 74 29 5c 74 67 65 |"\t(defa|ult)\tge|
|00005ae0| 6e 65 72 61 74 65 20 63 | 61 6c 65 6e 64 61 72 20 |nerate c|alendar |
|00005af0| 66 6f 72 20 63 75 72 72 | 65 6e 74 20 6d 6f 6e 74 |for curr|ent mont|
|00005b00| 68 2f 79 65 61 72 5c 6e | 22 29 3b 0a 7d 0a 0a 0c |h/year\n|");.}...|
|00005b10| 0a 2f 2a 0a 20 2a 20 69 | 73 5f 76 61 6c 69 64 20 |./*. * i|s_valid |
|00005b20| 2d 20 72 65 74 75 72 6e | 20 54 52 55 45 20 69 66 |- return| TRUE if|
|00005b30| 20 64 20 69 73 20 61 20 | 76 61 6c 69 64 20 64 61 | d is a |valid da|
|00005b40| 74 65 20 69 6e 20 6d 2f | 79 20 28 61 73 73 75 6d |te in m/|y (assum|
|00005b50| 65 64 20 76 61 6c 69 64 | 29 0a 20 2a 2f 0a 69 6e |ed valid|). */.in|
|00005b60| 74 20 69 73 5f 76 61 6c | 69 64 28 6d 2c 20 64 2c |t is_val|id(m, d,|
|00005b70| 20 79 29 0a 09 72 65 67 | 69 73 74 65 72 20 69 6e | y)..reg|ister in|
|00005b80| 74 20 6d 2c 20 64 2c 20 | 79 3b 0a 7b 0a 09 73 74 |t m, d, |y;.{..st|
|00005b90| 61 74 69 63 20 63 68 61 | 72 20 6c 65 6e 5b 31 33 |atic cha|r len[13|
|00005ba0| 5d 20 3d 20 7b 30 2c 20 | 33 31 2c 20 32 38 2c 20 |] = {0, |31, 28, |
|00005bb0| 33 31 2c 20 33 30 2c 20 | 33 31 2c 20 33 30 2c 20 |31, 30, |31, 30, |
|00005bc0| 33 31 2c 20 33 31 2c 20 | 33 30 2c 20 33 31 2c 20 |31, 31, |30, 31, |
|00005bd0| 33 30 2c 20 33 31 20 7d | 3b 0a 0a 09 72 65 74 75 |30, 31 }|;...retu|
|00005be0| 72 6e 20 28 64 20 3e 3d | 20 31 20 26 26 20 64 20 |rn (d >=| 1 && d |
|00005bf0| 3c 3d 20 28 6c 65 6e 5b | 6d 5d 20 2b 20 28 6d 20 |<= (len[|m] + (m |
|00005c00| 3d 3d 20 46 45 42 20 26 | 26 20 49 53 5f 4c 45 41 |== FEB &|& IS_LEA|
|00005c10| 50 28 79 29 29 29 20 29 | 3b 0a 7d 0a 0a 0a 2f 2a |P(y))) )|;.}.../*|
|00005c20| 0a 20 2a 20 6c 6f 61 64 | 77 6f 72 64 73 20 2d 20 |. * load|words - |
|00005c30| 74 6f 6b 65 6e 69 7a 65 | 20 6c 69 6e 65 20 62 75 |tokenize| line bu|
|00005c40| 66 66 65 72 20 69 6e 74 | 6f 20 77 6f 72 64 20 61 |ffer int|o word a|
|00005c50| 72 72 61 79 2c 20 72 65 | 74 75 72 6e 20 77 6f 72 |rray, re|turn wor|
|00005c60| 64 20 63 6f 75 6e 74 0a | 20 2a 20 28 61 73 73 75 |d count.| * (assu|
|00005c70| 6d 65 73 20 73 74 72 74 | 6f 6b 28 29 20 68 61 73 |mes strt|ok() has|
|00005c80| 20 61 6c 72 65 61 64 79 | 20 62 65 65 6e 20 63 61 | already| been ca|
|00005c90| 6c 6c 65 64 20 77 69 74 | 68 20 6e 6f 6e 2d 6e 75 |lled wit|h non-nu|
|00005ca0| 6c 6c 20 66 69 72 73 74 | 20 61 72 67 29 0a 20 2a |ll first| arg). *|
|00005cb0| 2f 0a 69 6e 74 20 6c 6f | 61 64 77 6f 72 64 73 28 |/.int lo|adwords(|
|00005cc0| 29 0a 7b 0a 09 72 65 67 | 69 73 74 65 72 20 63 68 |).{..reg|ister ch|
|00005cd0| 61 72 20 2a 2a 61 70 20 | 3d 20 77 6f 72 64 73 3b |ar **ap |= words;|
|00005ce0| 0a 09 72 65 67 69 73 74 | 65 72 20 69 3b 0a 0a 09 |..regist|er i;...|
|00005cf0| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 2a 61 70 20 |for (i =| 0; *ap |
|00005d00| 3d 20 73 74 72 74 6f 6b | 28 4e 55 4c 4c 2c 20 57 |= strtok|(NULL, W|
|00005d10| 48 49 54 45 53 50 41 43 | 45 29 20 3b 20 61 70 2b |HITESPAC|E) ; ap+|
|00005d20| 2b 2c 20 69 2b 2b 29 20 | 3b 0a 09 72 65 74 75 72 |+, i++) |;..retur|
|00005d30| 6e 28 69 29 3b 0a 7d 0a | 0a 0a 2f 2a 0a 20 2a 20 |n(i);.}.|../*. * |
|00005d40| 73 74 72 63 61 70 20 2d | 20 63 6f 6e 76 65 72 74 |strcap -| convert|
|00005d50| 20 66 69 72 73 74 20 63 | 68 61 72 61 63 74 65 72 | first c|haracter|
|00005d60| 20 6f 66 20 73 74 72 69 | 6e 67 20 74 6f 20 75 70 | of stri|ng to up|
|00005d70| 70 65 72 63 61 73 65 2c | 20 72 65 73 74 20 74 6f |percase,| rest to|
|00005d80| 20 6c 6f 77 65 72 63 61 | 73 65 0a 20 2a 2f 0a 63 | lowerca|se. */.c|
|00005d90| 68 61 72 20 2a 73 74 72 | 63 61 70 28 73 29 0a 09 |har *str|cap(s)..|
|00005da0| 63 68 61 72 20 2a 73 3b | 0a 7b 0a 09 63 68 61 72 |char *s;|.{..char|
|00005db0| 20 2a 70 20 3d 20 73 3b | 0a 0a 09 69 66 20 28 2a | *p = s;|...if (*|
|00005dc0| 70 29 20 7b 0a 09 09 69 | 66 20 28 69 73 6c 6f 77 |p) {...i|f (islow|
|00005dd0| 65 72 28 2a 70 29 29 0a | 09 09 09 2a 70 20 3d 20 |er(*p)).|...*p = |
|00005de0| 74 6f 75 70 70 65 72 28 | 2a 70 29 3b 0a 09 09 77 |toupper(|*p);...w|
|00005df0| 68 69 6c 65 20 28 2a 2b | 2b 70 29 0a 09 09 09 69 |hile (*+|+p)....i|
|00005e00| 66 20 28 69 73 75 70 70 | 65 72 28 2a 70 29 29 0a |f (isupp|er(*p)).|
|00005e10| 09 09 09 09 2a 70 20 3d | 20 74 6f 6c 6f 77 65 72 |....*p =| tolower|
|00005e20| 28 2a 70 29 3b 0a 09 7d | 0a 09 72 65 74 75 72 6e |(*p);..}|..return|
|00005e30| 28 73 29 3b 0a 7d 0a 0a | 0a 2f 2a 0a 20 2a 20 73 |(s);.}..|./*. * s|
|00005e40| 65 74 5f 63 6f 6c 6f 72 | 20 2d 20 73 65 74 20 6f |et_color| - set o|
|00005e50| 6e 65 20 6f 72 20 61 6c | 6c 20 77 65 65 6b 64 61 |ne or al|l weekda|
|00005e60| 79 73 20 74 6f 20 70 72 | 69 6e 74 20 69 6e 20 62 |ys to pr|int in b|
|00005e70| 6c 61 63 6b 20 6f 72 20 | 67 72 61 79 0a 20 2a 2f |lack or |gray. */|
|00005e80| 0a 73 65 74 5f 63 6f 6c | 6f 72 28 64 61 79 2c 20 |.set_col|or(day, |
|00005e90| 63 6f 6c 29 0a 09 63 68 | 61 72 20 2a 64 61 79 3b |col)..ch|ar *day;|
|00005ea0| 09 09 2f 2a 20 77 65 65 | 6b 64 61 79 20 6e 61 6d |../* wee|kday nam|
|00005eb0| 65 20 28 6f 72 20 22 61 | 6c 6c 22 29 20 2a 2f 0a |e (or "a|ll") */.|
|00005ec0| 09 69 6e 74 20 20 63 6f | 6c 3b 09 09 2f 2a 20 73 |.int co|l;../* s|
|00005ed0| 65 6c 65 63 74 20 62 6c | 61 63 6b 20 6f 72 20 67 |elect bl|ack or g|
|00005ee0| 72 61 79 20 2a 2f 0a 7b | 0a 09 69 6e 74 20 69 2c |ray */.{|..int i,|
|00005ef0| 20 64 6f 5f 61 6c 6c 3b | 0a 0a 09 64 6f 5f 61 6c | do_all;|...do_al|
|00005f00| 6c 20 3d 20 73 74 72 6e | 63 6d 70 28 73 74 72 63 |l = strn|cmp(strc|
|00005f10| 61 70 28 64 61 79 29 2c | 20 41 4c 4c 2c 20 73 74 |ap(day),| ALL, st|
|00005f20| 72 6c 65 6e 28 41 4c 4c | 29 29 20 3d 3d 20 30 3b |rlen(ALL|)) == 0;|
|00005f30| 09 2f 2a 20 73 65 74 20 | 61 6c 6c 20 64 61 79 73 |./* set |all days|
|00005f40| 3f 20 2a 2f 0a 0a 09 66 | 6f 72 20 28 69 20 3d 20 |? */...f|or (i = |
|00005f50| 30 3b 20 69 20 3c 20 37 | 3b 20 69 2b 2b 29 0a 09 |0; i < 7|; i++)..|
|00005f60| 09 69 66 20 28 64 6f 5f | 61 6c 6c 20 7c 7c 20 73 |.if (do_|all || s|
|00005f70| 74 72 6e 63 6d 70 28 64 | 61 79 2c 20 64 61 79 73 |trncmp(d|ay, days|
|00005f80| 5b 69 5d 2c 20 4d 49 4e | 5f 44 41 59 5f 4c 45 4e |[i], MIN|_DAY_LEN|
|00005f90| 29 20 3d 3d 20 30 29 0a | 09 09 09 63 6f 6c 6f 72 |) == 0).|...color|
|00005fa0| 5b 69 5d 20 3d 20 63 6f | 6c 3b 0a 7d 0a 0a 0a 2f |[i] = co|l;.}.../|
|00005fb0| 2a 0a 20 2a 20 70 72 74 | 5f 77 6f 72 64 20 2d 20 |*. * prt|_word - |
|00005fc0| 70 72 69 6e 74 20 77 6f | 72 64 20 61 73 20 50 6f |print wo|rd as Po|
|00005fd0| 73 74 53 63 72 69 70 74 | 20 73 74 72 69 6e 67 2c |stScript| string,|
|00005fe0| 20 63 6f 6e 76 65 72 74 | 69 6e 67 20 27 28 27 20 | convert|ing '(' |
|00005ff0| 61 6e 64 20 27 29 27 20 | 74 6f 20 6f 63 74 61 6c |and ')' |to octal|
|00006000| 0a 20 2a 2f 0a 70 72 74 | 5f 77 6f 72 64 28 70 29 |. */.prt|_word(p)|
|00006010| 0a 09 63 68 61 72 20 2a | 70 3b 0a 7b 0a 09 50 52 |..char *|p;.{..PR|
|00006020| 54 28 22 28 22 29 3b 0a | 09 66 6f 72 20 28 20 3b |T("(");.|.for ( ;|
|00006030| 20 2a 70 20 3b 20 70 2b | 2b 29 0a 09 09 69 66 20 | *p ; p+|+)...if |
|00006040| 28 2a 70 20 3d 3d 20 27 | 28 27 20 7c 7c 20 2a 70 |(*p == '|(' || *p|
|00006050| 20 3d 3d 20 27 29 27 29 | 0a 09 09 09 50 52 54 28 | == ')')|....PRT(|
|00006060| 22 5c 5c 25 30 33 6f 22 | 2c 20 2a 70 29 3b 0a 09 |"\\%03o"|, *p);..|
|00006070| 09 65 6c 73 65 0a 09 09 | 09 50 52 54 28 22 25 63 |.else...|.PRT("%c|
|00006080| 22 2c 20 2a 70 29 3b 0a | 09 50 52 54 28 22 29 5c |", *p);.|.PRT(")\|
|00006090| 6e 22 29 3b 0a 7d 0a 0c | 0a 2f 2a 0a 20 2a 20 70 |n");.}..|./*. * p|
|000060a0| 61 72 73 65 20 2d 20 63 | 68 65 63 6b 20 64 61 74 |arse - c|heck dat|
|000060b0| 65 20 66 69 6c 65 20 65 | 6e 74 72 79 20 66 6f 72 |e file e|ntry for|
|000060c0| 20 28 69 6e 20 6c 62 75 | 66 5b 5d 29 20 66 6f 72 | (in lbu|f[]) for|
|000060d0| 20 64 65 73 69 72 65 64 | 20 6d 6f 6e 74 68 2f 79 | desired| month/y|
|000060e0| 65 61 72 0a 20 2a 0a 20 | 2a 20 4c 6f 6f 6b 73 20 |ear. *. |* Looks |
|000060f0| 66 6f 72 20 61 6e 20 65 | 6e 74 72 79 20 6f 66 20 |for an e|ntry of |
|00006100| 6f 6e 65 20 6f 66 20 74 | 68 65 20 66 6f 6c 6c 6f |one of t|he follo|
|00006110| 77 69 6e 67 20 66 6f 72 | 6d 73 3a 0a 20 2a 0a 20 |wing for|ms:. *. |
|00006120| 2a 09 79 65 61 72 20 3c | 79 65 61 72 3e 0a 20 2a |*.year <|year>. *|
|00006130| 09 3c 6d 6f 6e 74 68 5f | 6e 61 6d 65 3e 20 3c 64 |.<month_|name> <d|
|00006140| 61 79 3e 7b 2a 7d 20 7b | 3c 74 65 78 74 3e 7d 0a |ay>{*} {|<text>}.|
|00006150| 20 2a 09 3c 6d 6f 6e 74 | 68 3e 3c 73 65 70 3e 3c | *.<mont|h><sep><|
|00006160| 64 61 79 3e 7b 3c 73 65 | 70 3e 3c 79 65 61 72 3e |day>{<se|p><year>|
|00006170| 7d 7b 2a 7d 20 7b 3c 74 | 65 78 74 3e 7d 0a 20 2a |}{*} {<t|ext>}. *|
|00006180| 0a 20 2a 20 77 68 65 72 | 65 0a 20 2a 09 3c 6d 6f |. * wher|e. *.<mo|
|00006190| 6e 74 68 5f 6e 61 6d 65 | 3e 20 3a 3d 20 66 69 72 |nth_name|> := fir|
|000061a0| 73 74 20 33 2b 20 63 68 | 61 72 61 63 74 65 72 73 |st 3+ ch|aracters|
|000061b0| 20 6f 66 20 6e 61 6d 65 | 20 6f 66 20 6d 6f 6e 74 | of name| of mont|
|000061c0| 68 20 28 69 6e 20 45 6e | 67 6c 69 73 68 29 0a 20 |h (in En|glish). |
|000061d0| 2a 09 3c 73 65 70 3e 20 | 3a 3d 20 6f 6e 65 20 6f |*.<sep> |:= one o|
|000061e0| 72 20 6d 6f 72 65 20 6e | 6f 6e 2d 6e 75 6d 65 72 |r more n|on-numer|
|000061f0| 69 63 2c 20 6e 6f 6e 2d | 73 70 61 63 65 2c 20 6e |ic, non-|space, n|
|00006200| 6f 6e 2d 27 2a 27 20 63 | 68 61 72 61 63 74 65 72 |on-'*' c|haracter|
|00006210| 73 0a 20 2a 0a 20 2a 20 | 52 65 74 75 72 6e 73 20 |s. *. * |Returns |
|00006220| 64 61 79 20 28 77 69 74 | 68 20 68 6f 6c 69 64 61 |day (wit|h holida|
|00006230| 79 20 66 6c 61 67 20 73 | 65 74 20 69 66 20 73 70 |y flag s|et if sp|
|00006240| 65 63 69 66 69 65 64 29 | 20 69 66 20 64 61 74 65 |ecified)| if date|
|00006250| 20 66 69 6c 65 20 65 6e | 74 72 79 0a 20 2a 20 69 | file en|try. * i|
|00006260| 73 20 61 70 70 6c 69 63 | 61 62 6c 65 20 74 6f 20 |s applic|able to |
|00006270| 63 75 72 72 65 6e 74 20 | 6d 6f 6e 74 68 2f 79 65 |current |month/ye|
|00006280| 61 72 3b 20 30 20 69 66 | 20 6e 6f 74 2e 20 20 49 |ar; 0 if| not. I|
|00006290| 66 20 61 70 70 6c 69 63 | 61 62 6c 65 2c 20 70 61 |f applic|able, pa|
|000062a0| 72 73 65 73 0a 20 2a 20 | 61 6e 79 20 66 6f 6c 6c |rses. * |any foll|
|000062b0| 6f 77 69 6e 67 20 74 65 | 78 74 20 69 6e 74 6f 20 |owing te|xt into |
|000062c0| 67 6c 6f 62 61 6c 20 61 | 72 72 61 79 20 77 6f 72 |global a|rray wor|
|000062d0| 64 73 5b 5d 2e 0a 20 2a | 0a 20 2a 20 41 6c 73 6f |ds[].. *|. * Also|
|000062e0| 20 73 65 65 20 66 69 6e | 64 5f 6f 70 74 69 6f 6e | see fin|d_option|
|000062f0| 73 28 29 2c 20 77 68 69 | 63 68 20 69 73 20 75 73 |s(), whi|ch is us|
|00006300| 65 64 20 64 75 72 69 6e | 67 20 61 6e 20 69 6e 69 |ed durin|g an ini|
|00006310| 74 69 61 6c 20 70 61 73 | 73 20 74 6f 20 69 64 65 |tial pas|s to ide|
|00006320| 6e 74 69 66 79 0a 20 2a | 20 61 6e 64 20 70 61 72 |ntify. *| and par|
|00006330| 73 65 20 6f 6e 6c 79 20 | 6c 69 6e 65 73 20 6f 66 |se only |lines of|
|00006340| 20 74 68 65 20 66 6f 72 | 6d 0a 20 2a 0a 20 2a 09 | the for|m. *. *.|
|00006350| 6f 70 74 20 3c 6f 70 74 | 69 6f 6e 73 3e 0a 20 2a |opt <opt|ions>. *|
|00006360| 0a 20 2a 20 77 68 69 63 | 68 20 6f 76 65 72 72 69 |. * whic|h overri|
|00006370| 64 65 20 64 65 66 61 75 | 6c 74 73 20 66 6f 72 20 |de defau|lts for |
|00006380| 63 6f 6d 6d 61 6e 64 2d | 6c 69 6e 65 20 6f 70 74 |command-|line opt|
|00006390| 69 6f 6e 73 2e 0a 20 2a | 2f 0a 69 6e 74 20 70 61 |ions.. *|/.int pa|
|000063a0| 72 73 65 28 6d 6f 6e 74 | 68 2c 20 79 65 61 72 29 |rse(mont|h, year)|
|000063b0| 0a 09 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 6d |..regist|er int m|
|000063c0| 6f 6e 74 68 2c 20 79 65 | 61 72 3b 0a 7b 0a 09 72 |onth, ye|ar;.{..r|
|000063d0| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 63 70 |egister |char *cp|
|000063e0| 3b 0a 09 69 6e 74 20 6d | 6d 2c 20 64 64 2c 20 79 |;..int m|m, dd, y|
|000063f0| 79 3b 0a 09 69 6e 74 20 | 69 73 5f 68 6f 6c 69 64 |y;..int |is_holid|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.