home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1617 < prev    next >
SHell self-extracting ARchive  |  1990-12-28  |  19.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: 1617

ConfidenceProgramDetectionMatch TypeSupport
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 text default
99% file C source text default
98% file C source, 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| 52 65 74 75 72 6e 20 6f | 66 20 74 68 65 20 53 6f |Return o|f the So|
|00000060| 6e 20 6f 66 20 59 65 74 | 20 41 6e 6f 74 68 65 72 |n of Yet| Another|
|00000070| 20 50 63 61 6c 20 52 65 | 76 69 73 69 6f 6e 0a 4d | Pcal Re|vision.M|
|00000080| 65 73 73 61 67 65 2d 49 | 44 3a 20 3c 31 38 34 36 |essage-I|D: <1846|
|00000090| 40 73 75 64 35 30 39 2e | 65 64 2e 72 61 79 2e 63 |@sud509.|ed.ray.c|
|000000a0| 6f 6d 3e 0a 44 61 74 65 | 3a 20 32 33 20 4a 75 6c |om>.Date|: 23 Jul|
|000000b0| 20 39 30 20 31 37 3a 33 | 35 3a 35 34 20 47 4d 54 | 90 17:3|5:54 GMT|
|000000c0| 0a 0a 54 68 69 73 20 69 | 73 20 2d 20 77 68 61 74 |..This i|s - what|
|000000d0| 20 65 6c 73 65 20 2d 20 | 61 6e 6f 74 68 65 72 20 | else - |another |
|000000e0| 72 65 76 69 73 69 6f 6e | 20 74 6f 20 74 68 65 20 |revision| to the |
|000000f0| 6e 65 66 61 72 69 6f 75 | 73 20 50 63 61 6c 20 70 |nefariou|s Pcal p|
|00000100| 72 6f 67 72 61 6d 2e 20 | 20 49 0a 68 61 76 65 20 |rogram. | I.have |
|00000110| 72 65 77 72 69 74 74 65 | 6e 20 70 63 61 6c 2e 63 |rewritte|n pcal.c|
|00000120| 20 2d 20 70 61 72 74 69 | 61 6c 6c 79 20 74 6f 20 | - parti|ally to |
|00000130| 66 69 78 20 73 6f 6d 65 | 20 6d 69 6e 6f 72 20 62 |fix some| minor b|
|00000140| 75 67 73 2c 20 62 75 74 | 20 6d 6f 73 74 6c 79 20 |ugs, but| mostly |
|00000150| 74 6f 0a 69 6d 70 72 6f | 76 65 20 6d 61 69 6e 74 |to.impro|ve maint|
|00000160| 61 69 6e 61 62 69 6c 69 | 74 79 2e 20 20 49 27 76 |ainabili|ty. I'v|
|00000170| 65 20 61 6c 73 6f 20 69 | 6e 63 6c 75 64 65 64 20 |e also i|ncluded |
|00000180| 61 20 62 65 74 74 65 72 | 20 63 61 6c 65 6e 64 61 |a better| calenda|
|00000190| 72 2f 43 41 4c 45 4e 44 | 41 52 2e 44 41 54 0a 66 |r/CALEND|AR.DAT.f|
|000001a0| 69 6c 65 20 69 6e 20 72 | 65 73 70 6f 6e 73 65 20 |ile in r|esponse |
|000001b0| 74 6f 20 63 6f 6d 70 6c | 61 69 6e 74 73 20 74 68 |to compl|aints th|
|000001c0| 61 74 20 74 68 65 20 65 | 78 70 65 63 74 65 64 20 |at the e|xpected |
|000001d0| 66 6f 72 6d 61 74 20 69 | 73 20 6e 6f 74 20 64 6f |format i|s not do|
|000001e0| 63 75 6d 65 6e 74 65 64 | 0a 76 65 72 79 20 77 65 |cumented|.very we|
|000001f0| 6c 6c 2e 0a 0a 53 69 6e | 63 65 20 74 68 65 20 61 |ll...Sin|ce the a|
|00000200| 62 6f 76 65 20 74 77 6f | 20 66 69 6c 65 73 20 61 |bove two| files a|
|00000210| 72 65 20 74 68 65 20 6f | 6e 6c 79 20 6f 6e 65 73 |re the o|nly ones|
|00000220| 20 74 68 61 74 20 61 72 | 65 20 6e 65 77 2c 20 49 | that ar|e new, I|
|00000230| 27 76 65 20 65 6c 65 63 | 74 65 64 20 74 6f 0a 70 |'ve elec|ted to.p|
|00000240| 6f 73 74 20 6a 75 73 74 | 20 74 68 6f 73 65 20 66 |ost just| those f|
|00000250| 69 6c 65 73 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |iles ins|tead of |
|00000260| 74 68 65 20 63 6f 6d 70 | 6c 65 74 65 20 27 73 68 |the comp|lete 'sh|
|00000270| 61 72 27 20 66 69 6c 65 | 2e 0a 0a 41 6e 64 72 65 |ar' file|...Andre|
|00000280| 77 0a 0a 50 53 3a 20 4d | 79 20 61 70 6f 6c 6f 67 |w..PS: M|y apolog|
|00000290| 69 65 73 20 69 66 20 79 | 6f 75 27 76 65 20 73 65 |ies if y|ou've se|
|000002a0| 65 6e 20 74 68 69 73 20 | 62 65 66 6f 72 65 20 2d |en this |before -|
|000002b0| 20 61 6e 20 65 61 72 6c | 69 65 72 20 70 6f 73 74 | an earl|ier post|
|000002c0| 69 6e 67 20 61 70 70 65 | 61 72 73 0a 74 6f 20 68 |ing appe|ars.to h|
|000002d0| 61 76 65 20 62 65 65 6e | 20 67 61 72 62 6c 65 64 |ave been| garbled|
|000002e0| 2e 0a 0a 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |...-----|--------|
|000002f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000300| 2d 2d 2d 20 63 75 74 20 | 68 65 72 65 20 2d 2d 2d |--- cut |here ---|
|00000310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 0a 23 21 |--------|-----.#!|
|00000330| 20 2f 62 69 6e 2f 73 68 | 0a 23 20 54 68 69 73 20 | /bin/sh|.# This |
|00000340| 69 73 20 61 20 73 68 65 | 6c 6c 20 61 72 63 68 69 |is a she|ll archi|
|00000350| 76 65 2c 20 6d 65 61 6e | 69 6e 67 3a 0a 23 20 31 |ve, mean|ing:.# 1|
|00000360| 2e 20 52 65 6d 6f 76 65 | 20 65 76 65 72 79 74 68 |. Remove| everyth|
|00000370| 69 6e 67 20 61 62 6f 76 | 65 20 74 68 65 20 23 21 |ing abov|e the #!|
|00000380| 20 2f 62 69 6e 2f 73 68 | 20 6c 69 6e 65 2e 0a 23 | /bin/sh| line..#|
|00000390| 20 32 2e 20 53 61 76 65 | 20 74 68 65 20 72 65 73 | 2. Save| the res|
|000003a0| 75 6c 74 69 6e 67 20 74 | 65 78 74 20 69 6e 20 61 |ulting t|ext in a|
|000003b0| 20 66 69 6c 65 2e 0a 23 | 20 33 2e 20 45 78 65 63 | file..#| 3. Exec|
|000003c0| 75 74 65 20 74 68 65 20 | 66 69 6c 65 20 77 69 74 |ute the |file wit|
|000003d0| 68 20 2f 62 69 6e 2f 73 | 68 20 28 6e 6f 74 20 63 |h /bin/s|h (not c|
|000003e0| 73 68 29 20 74 6f 20 63 | 72 65 61 74 65 3a 0a 23 |sh) to c|reate:.#|
|000003f0| 09 20 70 63 61 6c 2e 63 | 0a 23 09 20 63 61 6c 65 |. pcal.c|.#. cale|
|00000400| 6e 64 61 72 0a 23 20 54 | 68 69 73 20 61 72 63 68 |ndar.# T|his arch|
|00000410| 69 76 65 20 63 72 65 61 | 74 65 64 3a 20 4d 6f 6e |ive crea|ted: Mon|
|00000420| 20 4a 75 6c 20 32 33 20 | 31 33 3a 31 33 3a 30 36 | Jul 23 |13:13:06|
|00000430| 20 45 44 54 20 31 39 39 | 30 0a 65 78 70 6f 72 74 | EDT 199|0.export|
|00000440| 20 50 41 54 48 3b 20 50 | 41 54 48 3d 2f 62 69 6e | PATH; P|ATH=/bin|
|00000450| 3a 2f 75 73 72 2f 62 69 | 6e 3a 24 50 41 54 48 0a |:/usr/bi|n:$PATH.|
|00000460| 69 66 20 74 65 73 74 20 | 2d 66 20 27 70 63 61 6c |if test |-f 'pcal|
|00000470| 2e 63 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |.c'.then|..echo s|
|00000480| 68 61 72 3a 20 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |har: wil|l not ov|
|00000490| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|000004a0| 67 20 66 69 6c 65 20 27 | 70 63 61 6c 2e 63 27 0a |g file '|pcal.c'.|
|000004b0| 65 6c 73 65 0a 63 61 74 | 20 3c 3c 20 5c 53 48 41 |else.cat| << \SHA|
|000004c0| 52 5f 45 4f 46 20 3e 20 | 27 70 63 61 6c 2e 63 27 |R_EOF > |'pcal.c'|
|000004d0| 0a 2f 2a 0a 20 2a 20 70 | 63 61 6c 2e 63 20 2d 20 |./*. * p|cal.c - |
|000004e0| 67 65 6e 65 72 61 74 65 | 20 50 6f 73 74 53 63 72 |generate| PostScr|
|000004f0| 69 70 74 20 66 69 6c 65 | 20 74 6f 20 70 72 69 6e |ipt file| to prin|
|00000500| 74 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 61 |t calend|ar for a|
|00000510| 6e 79 20 6d 6f 6e 74 68 | 20 61 6e 64 20 79 65 61 |ny month| and yea|
|00000520| 72 0a 20 2a 0a 20 2a 20 | 54 68 65 20 6f 72 69 67 |r. *. * |The orig|
|00000530| 69 6e 61 6c 20 50 6f 73 | 74 53 63 72 69 70 74 20 |inal Pos|tScript |
|00000540| 63 6f 64 65 20 74 6f 20 | 67 65 6e 65 72 61 74 65 |code to |generate|
|00000550| 20 74 68 65 20 63 61 6c | 65 6e 64 61 72 73 20 77 | the cal|endars w|
|00000560| 61 73 20 77 72 69 74 74 | 65 6e 20 62 79 0a 20 2a |as writt|en by. *|
|00000570| 20 50 61 74 72 69 63 6b | 20 57 6f 6f 64 20 28 43 | Patrick| Wood (C|
|00000580| 6f 70 79 77 72 69 74 65 | 20 28 63 29 20 31 39 38 |opywrite| (c) 198|
|00000590| 37 20 62 79 20 50 61 74 | 72 69 63 6b 20 57 6f 6f |7 by Pat|rick Woo|
|000005a0| 64 20 6f 66 20 50 69 70 | 65 6c 69 6e 65 20 41 73 |d of Pip|eline As|
|000005b0| 73 6f 63 69 61 74 65 73 | 2c 0a 20 2a 20 49 6e 63 |sociates|,. * Inc|
|000005c0| 2e 29 2c 20 61 6e 64 20 | 61 75 74 68 6f 72 69 7a |.), and |authoriz|
|000005d0| 65 64 20 66 6f 72 20 6d | 6f 64 69 66 69 63 61 74 |ed for m|odificat|
|000005e0| 69 6f 6e 20 61 6e 64 20 | 72 65 64 69 73 74 72 69 |ion and |redistri|
|000005f0| 62 75 74 69 6f 6e 2e 20 | 20 54 68 65 20 63 61 6c |bution. | The cal|
|00000600| 65 6e 64 61 72 0a 20 2a | 20 66 69 6c 65 20 69 6e |endar. *| file in|
|00000610| 63 6c 75 73 69 6f 6e 20 | 63 6f 64 65 20 77 61 73 |clusion |code was|
|00000620| 20 6f 72 69 67 69 6e 61 | 6c 6c 79 20 77 72 69 74 | origina|lly writ|
|00000630| 74 65 6e 20 69 6e 20 22 | 62 73 28 31 29 22 20 62 |ten in "|bs(1)" b|
|00000640| 79 20 42 69 6c 6c 20 56 | 6f 67 65 6c 20 6f 66 0a |y Bill V|ogel of.|
|00000650| 20 2a 20 41 54 26 54 2e | 20 20 50 61 74 72 69 63 | * AT&T.| Patric|
|00000660| 6b 27 73 20 6f 72 69 67 | 69 6e 61 6c 20 50 6f 73 |k's orig|inal Pos|
|00000670| 74 53 63 72 69 70 74 20 | 77 61 73 20 6d 6f 64 69 |tScript |was modi|
|00000680| 66 69 65 64 20 61 6e 64 | 20 65 6e 68 61 6e 63 65 |fied and| enhance|
|00000690| 64 20 73 65 76 65 72 61 | 6c 0a 20 2a 20 74 69 6d |d severa|l. * tim|
|000006a0| 65 73 20 62 79 20 6f 74 | 68 65 72 73 20 77 68 6f |es by ot|hers who|
|000006b0| 73 65 20 6e 61 6d 65 73 | 20 68 61 76 65 20 72 65 |se names| have re|
|000006c0| 67 72 65 74 74 61 62 6c | 79 20 62 65 65 6e 20 6c |grettabl|y been l|
|000006d0| 6f 73 74 2e 20 20 54 68 | 69 73 20 43 20 76 65 72 |ost. Th|is C ver|
|000006e0| 73 69 6f 6e 0a 20 2a 20 | 77 61 73 20 6f 72 69 67 |sion. * |was orig|
|000006f0| 69 6e 61 6c 6c 79 20 63 | 72 65 61 74 65 64 20 62 |inally c|reated b|
|00000700| 79 20 4b 65 6e 20 4b 65 | 69 72 6e 61 6e 20 6f 66 |y Ken Ke|irnan of|
|00000710| 20 50 61 63 69 66 69 63 | 20 42 65 6c 6c 3b 20 61 | Pacific| Bell; a|
|00000720| 64 64 69 74 69 6f 6e 61 | 6c 0a 20 2a 20 65 6e 68 |dditiona|l. * enh|
|00000730| 61 6e 63 65 6d 65 6e 74 | 73 20 62 79 20 4a 6f 73 |ancement|s by Jos|
|00000740| 65 70 68 20 50 2e 20 4c | 61 72 73 6f 6e 2c 20 45 |eph P. L|arson, E|
|00000750| 64 20 48 61 6e 64 2c 20 | 61 6e 64 20 41 6e 64 72 |d Hand, |and Andr|
|00000760| 65 77 20 52 6f 67 65 72 | 73 20 28 77 68 6f 20 61 |ew Roger|s (who a|
|00000770| 6c 73 6f 0a 20 2a 20 64 | 69 64 20 74 68 65 20 56 |lso. * d|id the V|
|00000780| 4d 53 20 70 6f 72 74 29 | 2e 0a 20 2a 0a 20 2a 09 |MS port)|.. *. *.|
|00000790| 50 61 72 61 6d 65 74 65 | 72 73 3a 0a 20 2a 0a 20 |Paramete|rs:. *. |
|000007a0| 2a 09 09 70 63 61 6c 20 | 5b 6f 70 74 73 5d 09 09 |*..pcal |[opts]..|
|000007b0| 67 65 6e 65 72 61 74 65 | 20 63 61 6c 65 6e 64 61 |generate| calenda|
|000007c0| 72 20 66 6f 72 20 63 75 | 72 72 65 6e 74 20 6d 6f |r for cu|rrent mo|
|000007d0| 6e 74 68 2f 79 65 61 72 | 0a 20 2a 0a 20 2a 09 09 |nth/year|. *. *..|
|000007e0| 70 63 61 6c 20 5b 6f 70 | 74 73 5d 20 79 79 09 09 |pcal [op|ts] yy..|
|000007f0| 67 65 6e 65 72 61 74 65 | 20 63 61 6c 65 6e 64 61 |generate| calenda|
|00000800| 72 20 66 6f 72 20 65 6e | 74 69 72 65 20 79 65 61 |r for en|tire yea|
|00000810| 72 20 79 79 0a 20 2a 0a | 20 2a 09 09 70 63 61 6c |r yy. *.| *..pcal|
|00000820| 20 5b 6f 70 74 73 5d 20 | 6d 6d 20 79 79 09 67 65 | [opts] |mm yy.ge|
|00000830| 6e 65 72 61 74 65 20 63 | 61 6c 65 6e 64 61 72 20 |nerate c|alendar |
|00000840| 66 6f 72 20 6d 6f 6e 74 | 68 20 6d 6d 0a 20 2a 09 |for mont|h mm. *.|
|00000850| 09 09 09 09 28 4a 61 6e | 20 3d 20 31 29 2c 20 79 |....(Jan| = 1), y|
|00000860| 65 61 72 20 79 79 20 28 | 31 39 79 79 20 69 66 20 |ear yy (|19yy if |
|00000870| 79 79 20 3c 20 31 30 30 | 29 0a 20 2a 0a 20 2a 09 |yy < 100|). *. *.|
|00000880| 09 70 63 61 6c 20 5b 6f | 70 74 73 5d 20 6d 6d 20 |.pcal [o|pts] mm |
|00000890| 79 79 20 6e 09 61 73 20 | 61 62 6f 76 65 2c 20 66 |yy n.as |above, f|
|000008a0| 6f 72 20 6e 20 63 6f 6e | 73 65 63 75 74 69 76 65 |or n con|secutive|
|000008b0| 20 6d 6f 6e 74 68 73 0a | 20 2a 0a 20 2a 09 4f 75 | months.| *. *.Ou|
|000008c0| 74 70 75 74 3a 0a 20 2a | 0a 20 2a 09 09 50 6f 73 |tput:. *|. *..Pos|
|000008d0| 74 53 63 72 69 70 74 20 | 66 69 6c 65 20 74 6f 20 |tScript |file to |
|000008e0| 70 72 69 6e 74 20 63 61 | 6c 65 6e 64 61 72 73 20 |print ca|lendars |
|000008f0| 66 6f 72 20 61 6c 6c 20 | 73 65 6c 65 63 74 65 64 |for all |selected|
|00000900| 20 6d 6f 6e 74 68 73 2e | 0a 20 2a 0a 20 2a 09 4f | months.|. *. *.O|
|00000910| 70 74 69 6f 6e 73 3a 0a | 20 2a 0a 20 2a 09 09 2d |ptions:.| *. *..-|
|00000920| 64 20 3c 46 4f 4e 54 3e | 09 73 70 65 63 69 66 79 |d <FONT>|.specify|
|00000930| 20 61 6c 74 65 72 6e 61 | 74 65 20 66 6f 6e 74 20 | alterna|te font |
|00000940| 66 6f 72 20 64 61 79 20 | 6e 61 6d 65 73 0a 20 2a |for day |names. *|
|00000950| 09 09 09 09 28 64 65 66 | 61 75 6c 74 3a 20 54 69 |....(def|ault: Ti|
|00000960| 6d 65 73 2d 42 6f 6c 64 | 29 0a 20 2a 0a 20 2a 09 |mes-Bold|). *. *.|
|00000970| 09 2d 65 09 09 67 65 6e | 65 72 61 74 65 20 65 6d |.-e..gen|erate em|
|00000980| 70 74 79 20 63 61 6c 65 | 6e 64 61 72 20 28 69 67 |pty cale|ndar (ig|
|00000990| 6e 6f 72 65 20 64 61 74 | 65 20 66 69 6c 65 29 0a |nore dat|e file).|
|000009a0| 20 2a 0a 20 2a 09 09 2d | 66 20 3c 46 49 4c 45 3e | *. *..-|f <FILE>|
|000009b0| 09 73 70 65 63 69 66 79 | 20 61 6c 74 65 72 6e 61 |.specify| alterna|
|000009c0| 74 65 20 64 61 74 65 20 | 66 69 6c 65 20 28 64 65 |te date |file (de|
|000009d0| 66 61 75 6c 74 3a 0a 20 | 2a 09 09 09 09 7e 2f 63 |fault:. |*....~/c|
|000009e0| 61 6c 65 6e 64 61 72 20 | 6f 6e 20 55 6e 2a 78 2c |alendar |on Un*x,|
|000009f0| 20 53 59 53 24 4c 4f 47 | 49 4e 3a 43 41 4c 45 4e | SYS$LOG|IN:CALEN|
|00000a00| 44 41 52 2e 44 41 54 0a | 20 2a 09 09 09 09 6f 6e |DAR.DAT.| *....on|
|00000a10| 20 56 4d 53 29 0a 20 2a | 0a 20 2a 09 09 2d 6f 20 | VMS). *|. *..-o |
|00000a20| 3c 46 49 4c 45 3e 09 73 | 70 65 63 69 66 79 20 61 |<FILE>.s|pecify a|
|00000a30| 6c 74 65 72 6e 61 74 65 | 20 6f 75 74 70 75 74 20 |lternate| output |
|00000a40| 66 69 6c 65 20 28 64 65 | 66 61 75 6c 74 3a 0a 20 |file (de|fault:. |
|00000a50| 2a 09 09 09 09 73 74 64 | 6f 75 74 20 6f 6e 20 55 |*....std|out on U|
|00000a60| 6e 2a 78 2c 20 43 41 4c | 45 4e 44 41 52 2e 50 53 |n*x, CAL|ENDAR.PS|
|00000a70| 20 6f 6e 20 56 4d 53 29 | 0a 20 2a 0a 20 2a 09 09 | on VMS)|. *. *..|
|00000a80| 2d 72 09 09 67 65 6e 65 | 72 61 74 65 20 70 6f 72 |-r..gene|rate por|
|00000a90| 74 72 61 69 74 2d 73 74 | 79 6c 65 20 63 61 6c 65 |trait-st|yle cale|
|00000aa0| 6e 64 61 72 73 0a 20 2a | 09 09 09 09 28 64 65 66 |ndars. *|....(def|
|00000ab0| 61 75 6c 74 3a 20 6c 61 | 6e 64 73 63 61 70 65 29 |ault: la|ndscape)|
|00000ac0| 0a 20 2a 0a 20 2a 09 09 | 2d 73 09 09 70 72 69 6e |. *. *..|-s..prin|
|00000ad0| 74 20 53 61 74 75 72 64 | 61 79 73 20 69 6e 20 62 |t Saturd|ays in b|
|00000ae0| 6c 61 63 6b 0a 20 2a 09 | 09 2d 53 09 09 70 72 69 |lack. *.|.-S..pri|
|00000af0| 6e 74 20 53 61 74 75 72 | 64 61 79 73 20 61 6e 64 |nt Satur|days and|
|00000b00| 20 53 75 6e 64 61 79 73 | 20 69 6e 20 62 6c 61 63 | Sundays| in blac|
|00000b10| 6b 0a 20 2a 09 09 09 09 | 28 64 65 66 61 75 6c 74 |k. *....|(default|
|00000b20| 3a 20 70 72 69 6e 74 20 | 53 61 74 75 72 64 61 79 |: print |Saturday|
|00000b30| 73 20 61 6e 64 20 53 75 | 6e 64 61 79 73 20 69 6e |s and Su|ndays in|
|00000b40| 20 67 72 61 79 29 0a 20 | 2a 09 09 0a 20 2a 09 09 | gray). |*... *..|
|00000b50| 2d 74 20 3c 46 4f 4e 54 | 3e 09 73 70 65 63 69 66 |-t <FONT|>.specif|
|00000b60| 79 20 61 6c 74 65 72 6e | 61 74 65 20 66 6f 6e 74 |y altern|ate font|
|00000b70| 20 66 6f 72 20 74 69 74 | 6c 65 73 0a 20 2a 09 09 | for tit|les. *..|
|00000b80| 09 09 28 64 65 66 61 75 | 6c 74 3a 20 54 69 6d 65 |..(defau|lt: Time|
|00000b90| 73 2d 42 6f 6c 64 29 0a | 20 2a 0a 20 2a 09 09 50 |s-Bold).| *. *..P|
|00000ba0| 61 72 61 6d 65 74 65 72 | 73 20 61 6e 64 20 66 6c |arameter|s and fl|
|00000bb0| 61 67 73 20 6d 61 79 20 | 62 65 20 6d 69 78 65 64 |ags may |be mixed|
|00000bc0| 20 6f 6e 20 74 68 65 20 | 63 6f 6d 6d 61 6e 64 20 | on the |command |
|00000bd0| 6c 69 6e 65 2e 0a 20 2a | 2f 0a 0a 0c 0a 23 69 6e |line.. *|/....#in|
|00000be0| 63 6c 75 64 65 20 3c 73 | 74 64 69 6f 2e 68 3e 0a |clude <s|tdio.h>.|
|00000bf0| 23 69 6e 63 6c 75 64 65 | 20 3c 63 74 79 70 65 2e |#include| <ctype.|
|00000c00| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 74 69 6d |h>.#incl|ude <tim|
|00000c10| 65 2e 68 3e 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 |e.h>.#in|clude <s|
|00000c20| 74 72 69 6e 67 2e 68 3e | 0a 0a 23 69 66 64 65 66 |tring.h>|..#ifdef|
|00000c30| 20 56 4d 53 09 09 2f 2a | 20 56 4d 53 20 6f 64 64 | VMS../*| VMS odd|
|00000c40| 69 74 69 65 73 20 69 73 | 6f 6c 61 74 65 64 20 68 |ities is|olated h|
|00000c50| 65 72 65 20 2a 2f 0a 0a | 23 64 65 66 69 6e 65 20 |ere */..|#define |
|00000c60| 49 4e 46 49 4c 45 20 20 | 22 43 41 4c 45 4e 44 41 |INFILE |"CALENDA|
|00000c70| 52 2e 44 41 54 22 0a 23 | 64 65 66 69 6e 65 20 4f |R.DAT".#|define O|
|00000c80| 55 54 46 49 4c 45 20 22 | 43 41 4c 45 4e 44 41 52 |UTFILE "|CALENDAR|
|00000c90| 2e 50 53 22 0a 23 64 65 | 66 69 6e 65 20 53 5f 4f |.PS".#de|fine S_O|
|00000ca0| 50 54 20 22 5c 22 53 5c | 22 22 0a 23 64 65 66 69 |PT "\"S\|"".#defi|
|00000cb0| 6e 65 20 45 4e 44 5f 50 | 41 54 48 20 27 5d 27 0a |ne END_P|ATH ']'.|
|00000cc0| 23 64 65 66 69 6e 65 20 | 45 58 49 54 5f 53 55 43 |#define |EXIT_SUC|
|00000cd0| 43 45 53 53 20 31 0a 23 | 64 65 66 69 6e 65 20 45 |CESS 1.#|define E|
|00000ce0| 58 49 54 5f 46 41 49 4c | 55 52 45 20 33 0a 0a 23 |XIT_FAIL|URE 3..#|
|00000cf0| 65 6c 73 65 09 09 09 2f | 2a 20 6e 6f 6e 2d 56 4d |else.../|* non-VM|
|00000d00| 53 20 2d 20 61 73 73 75 | 6d 65 20 55 6e 2a 78 20 |S - assu|me Un*x |
|00000d10| 6f 66 20 73 6f 6d 65 20 | 73 6f 72 74 20 2a 2f 0a |of some |sort */.|
|00000d20| 0a 23 64 65 66 69 6e 65 | 20 49 4e 46 49 4c 45 20 |.#define| INFILE |
|00000d30| 20 22 63 61 6c 65 6e 64 | 61 72 22 0a 23 64 65 66 | "calend|ar".#def|
|00000d40| 69 6e 65 20 4f 55 54 46 | 49 4c 45 20 4e 55 4c 4c |ine OUTF|ILE NULL|
|00000d50| 0a 23 64 65 66 69 6e 65 | 20 53 5f 4f 50 54 20 22 |.#define| S_OPT "|
|00000d60| 53 22 0a 23 64 65 66 69 | 6e 65 20 45 4e 44 5f 50 |S".#defi|ne END_P|
|00000d70| 41 54 48 20 27 2f 27 0a | 23 64 65 66 69 6e 65 20 |ATH '/'.|#define |
|00000d80| 45 58 49 54 5f 53 55 43 | 43 45 53 53 20 30 0a 23 |EXIT_SUC|CESS 0.#|
|00000d90| 64 65 66 69 6e 65 20 45 | 58 49 54 5f 46 41 49 4c |define E|XIT_FAIL|
|00000da0| 55 52 45 20 31 0a 65 78 | 74 65 72 6e 20 63 68 61 |URE 1.ex|tern cha|
|00000db0| 72 20 2a 67 65 74 65 6e | 76 28 29 3b 09 2f 2a 20 |r *geten|v();./* |
|00000dc0| 74 6f 20 74 72 61 6e 73 | 6c 61 74 65 20 22 48 4f |to trans|late "HO|
|00000dd0| 4d 45 22 20 74 6f 20 70 | 61 74 68 20 6e 61 6d 65 |ME" to p|ath name|
|00000de0| 20 2a 2f 0a 0a 23 65 6e | 64 69 66 0a 0a 0a 23 64 | */..#en|dif...#d|
|00000df0| 65 66 69 6e 65 20 44 41 | 59 46 4f 4e 54 20 20 20 |efine DA|YFONT |
|00000e00| 22 54 69 6d 65 73 2d 42 | 6f 6c 64 22 0a 23 64 65 |"Times-B|old".#de|
|00000e10| 66 69 6e 65 20 54 49 54 | 4c 45 46 4f 4e 54 20 22 |fine TIT|LEFONT "|
|00000e20| 54 69 6d 65 73 2d 42 6f | 6c 64 22 0a 0a 23 64 65 |Times-Bo|ld"..#de|
|00000e30| 66 69 6e 65 20 46 41 4c | 53 45 09 30 0a 23 64 65 |fine FAL|SE.0.#de|
|00000e40| 66 69 6e 65 20 54 52 55 | 45 09 31 0a 0a 23 64 65 |fine TRU|E.1..#de|
|00000e50| 66 69 6e 65 20 50 52 54 | 09 28 76 6f 69 64 29 70 |fine PRT|.(void)p|
|00000e60| 72 69 6e 74 66 0a 23 64 | 65 66 69 6e 65 20 46 50 |rintf.#d|efine FP|
|00000e70| 52 09 28 76 6f 69 64 29 | 66 70 72 69 6e 74 66 0a |R.(void)|fprintf.|
|00000e80| 0a 23 64 65 66 69 6e 65 | 20 69 73 5f 6c 65 61 70 |.#define| is_leap|
|00000e90| 28 79 29 20 28 28 79 29 | 20 25 20 34 20 3d 3d 20 |(y) ((y)| % 4 == |
|00000ea0| 30 20 26 26 20 28 28 79 | 29 20 25 20 31 30 30 20 |0 && ((y|) % 100 |
|00000eb0| 21 3d 20 30 20 7c 7c 20 | 28 79 29 20 25 20 34 30 |!= 0 || |(y) % 40|
|00000ec0| 30 20 3d 3d 20 30 29 29 | 0a 0a 23 64 65 66 69 6e |0 == 0))|..#defin|
|00000ed0| 65 20 4d 49 4e 5f 59 52 | 09 31 39 30 30 09 09 2f |e MIN_YR|.1900../|
|00000ee0| 2a 20 73 69 67 6e 69 66 | 69 63 61 6e 74 20 79 65 |* signif|icant ye|
|00000ef0| 61 72 73 20 28 63 61 6c | 65 6e 64 61 72 20 6c 69 |ars (cal|endar li|
|00000f00| 6d 69 74 73 29 20 2a 2f | 0a 23 64 65 66 69 6e 65 |mits) */|.#define|
|00000f10| 20 4d 41 58 5f 59 52 09 | 39 39 39 39 0a 0a 23 64 | MAX_YR.|9999..#d|
|00000f20| 65 66 69 6e 65 20 4a 41 | 4e 09 20 31 09 09 2f 2a |efine JA|N. 1../*|
|00000f30| 20 73 69 67 6e 69 66 69 | 63 61 6e 74 20 6d 6f 6e | signifi|cant mon|
|00000f40| 74 68 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 46 |ths */.#|define F|
|00000f50| 45 42 09 20 32 0a 23 64 | 65 66 69 6e 65 20 44 45 |EB. 2.#d|efine DE|
|00000f60| 43 09 31 32 0a 0a 23 64 | 65 66 69 6e 65 20 4d 41 |C.12..#d|efine MA|
|00000f70| 58 41 52 47 53 20 33 09 | 09 2f 2a 20 6e 75 6d 65 |XARGS 3.|./* nume|
|00000f80| 72 69 63 20 63 6f 6d 6d | 61 6e 64 2d 6c 69 6e 65 |ric comm|and-line|
|00000f90| 20 61 72 67 73 20 2a 2f | 0a 23 64 65 66 69 6e 65 | args */|.#define|
|00000fa0| 20 48 4f 4c 49 44 41 59 | 09 28 31 20 3c 3c 20 36 | HOLIDAY|.(1 << 6|
|00000fb0| 29 09 2f 2a 20 62 69 74 | 20 73 65 74 20 74 6f 20 |)./* bit| set to |
|00000fc0| 66 6c 61 67 20 64 61 79 | 20 61 73 20 68 6f 6c 69 |flag day| as holi|
|00000fd0| 64 61 79 20 2a 2f 0a 0a | 23 64 65 66 69 6e 65 20 |day */..|#define |
|00000fe0| 57 48 49 54 45 53 50 41 | 43 45 20 22 20 5c 74 22 |WHITESPA|CE " \t"|
|00000ff0| 09 2f 2a 20 74 6f 6b 65 | 6e 20 64 65 6c 69 6d 69 |./* toke|n delimi|
|00001000| 74 65 72 73 20 69 6e 20 | 64 61 74 65 20 66 69 6c |ters in |date fil|
|00001010| 65 20 2a 2f 0a 0a 23 69 | 6e 63 6c 75 64 65 20 22 |e */..#i|nclude "|
|00001020| 70 63 61 6c 69 6e 69 74 | 2e 68 22 09 09 2f 2a 20 |pcalinit|.h"../* |
|00001030| 50 6f 73 74 53 63 72 69 | 70 74 20 62 6f 69 6c 65 |PostScri|pt boile|
|00001040| 72 70 6c 61 74 65 20 2a | 2f 0a 0a 2f 2a 0a 20 2a |rplate *|/../*. *|
|00001050| 20 47 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | Global |variable|
|00001060| 73 3a 0a 20 2a 2f 0a 0a | 46 49 4c 45 20 2a 64 66 |s:. */..|FILE *df|
|00001070| 70 20 3d 20 4e 55 4c 4c | 3b 09 09 2f 2a 20 64 61 |p = NULL|;../* da|
|00001080| 74 65 20 66 69 6c 65 20 | 70 6f 69 6e 74 65 72 20 |te file |pointer |
|00001090| 2a 2f 0a 69 6e 74 20 69 | 6e 69 74 5f 79 65 61 72 |*/.int i|nit_year|
|000010a0| 3b 09 09 09 2f 2a 20 69 | 6e 69 74 69 61 6c 20 64 |;.../* i|nitial d|
|000010b0| 65 66 61 75 6c 74 20 79 | 65 61 72 20 66 6f 72 20 |efault y|ear for |
|000010c0| 64 61 74 65 20 66 69 6c | 65 20 65 6e 74 72 69 65 |date fil|e entrie|
|000010d0| 73 20 2a 2f 0a 69 6e 74 | 20 63 75 72 72 5f 79 65 |s */.int| curr_ye|
|000010e0| 61 72 3b 09 09 09 2f 2a | 20 63 75 72 72 65 6e 74 |ar;.../*| current|
|000010f0| 20 64 65 66 61 75 6c 74 | 20 79 65 61 72 20 66 6f | default| year fo|
|00001100| 72 20 64 61 74 65 20 66 | 69 6c 65 20 65 6e 74 72 |r date f|ile entr|
|00001110| 69 65 73 20 2a 2f 0a 63 | 68 61 72 20 2a 77 6f 72 |ies */.c|har *wor|
|00001120| 64 73 5b 31 30 30 5d 3b | 09 09 2f 2a 20 6d 61 78 |ds[100];|../* max|
|00001130| 69 6d 75 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 77 |imum num|ber of w|
|00001140| 6f 72 64 73 20 70 65 72 | 20 64 61 74 65 20 66 69 |ords per| date fi|
|00001150| 6c 65 20 6c 69 6e 65 20 | 2a 2f 0a 63 68 61 72 20 |le line |*/.char |
|00001160| 6c 62 75 66 5b 35 31 32 | 5d 3b 09 09 09 2f 2a 20 |lbuf[512|];.../* |
|00001170| 6d 61 78 69 6d 75 6d 20 | 64 61 74 65 20 66 69 6c |maximum |date fil|
|00001180| 65 20 6c 69 6e 65 20 73 | 69 7a 65 20 2a 2f 0a 0a |e line s|ize */..|
|00001190| 0c 0a 2f 2a 0a 20 2a 20 | 4d 61 69 6e 20 70 72 6f |../*. * |Main pro|
|000011a0| 67 72 61 6d 20 2d 20 70 | 61 72 73 65 20 61 6e 64 |gram - p|arse and|
|000011b0| 20 76 61 6c 69 64 61 74 | 65 20 63 6f 6d 6d 61 6e | validat|e comman|
|000011c0| 64 2d 6c 69 6e 65 20 61 | 72 67 75 6d 65 6e 74 73 |d-line a|rguments|
|000011d0| 2c 20 6f 70 65 6e 20 66 | 69 6c 65 73 2c 0a 20 2a |, open f|iles,. *|
|000011e0| 20 67 65 6e 65 72 61 74 | 65 20 50 6f 73 74 53 63 | generat|e PostSc|
|000011f0| 72 69 70 74 20 62 6f 69 | 6c 65 72 70 6c 61 74 65 |ript boi|lerplate|
|00001200| 20 61 6e 64 20 63 6f 64 | 65 20 74 6f 20 67 65 6e | and cod|e to gen|
|00001210| 65 72 61 74 65 20 63 61 | 6c 65 6e 64 61 72 73 2e |erate ca|lendars.|
|00001220| 0a 20 2a 0a 20 2a 20 50 | 72 6f 67 72 61 6d 20 73 |. *. * P|rogram s|
|00001230| 74 72 75 63 74 75 72 65 | 3a 0a 20 2a 0a 20 2a 20 |tructure|:. *. * |
|00001240| 6d 61 69 6e 28 29 20 67 | 65 6e 65 72 61 74 65 73 |main() g|enerates|
|00001250| 20 74 68 65 20 63 6f 6d | 6d 6f 6e 20 50 6f 73 74 | the com|mon Post|
|00001260| 53 63 72 69 70 74 20 63 | 6f 64 65 20 61 6e 64 20 |Script c|ode and |
|00001270| 74 68 65 6e 20 63 61 6c | 6c 73 20 70 6d 6f 6e 74 |then cal|ls pmont|
|00001280| 68 28 29 20 74 6f 0a 20 | 2a 20 70 72 69 6e 74 20 |h() to. |* print |
|00001290| 74 68 65 20 63 61 6c 65 | 6e 64 61 72 73 2e 0a 20 |the cale|ndars.. |
|000012a0| 2a 0a 20 2a 20 70 6d 6f | 6e 74 68 28 29 20 63 61 |*. * pmo|nth() ca|
|000012b0| 6c 6c 73 20 66 69 6e 64 | 5f 68 6f 6c 69 64 61 79 |lls find|_holiday|
|000012c0| 73 28 29 20 74 6f 20 6d | 61 6b 65 20 61 20 66 69 |s() to m|ake a fi|
|000012d0| 72 73 74 20 70 61 73 73 | 20 74 68 72 6f 75 67 68 |rst pass| through|
|000012e0| 20 74 68 65 20 64 61 74 | 65 20 66 69 6c 65 0a 20 | the dat|e file. |
|000012f0| 2a 20 74 6f 20 67 65 6e | 65 72 61 74 65 20 74 68 |* to gen|erate th|
|00001300| 65 20 6c 69 73 74 20 6f | 66 20 68 6f 6c 69 64 61 |e list o|f holida|
|00001310| 79 73 20 74 6f 20 62 65 | 20 70 72 69 6e 74 65 64 |ys to be| printed|
|00001320| 20 69 6e 20 67 72 61 79 | 3b 20 69 74 20 74 68 65 | in gray|; it the|
|00001330| 6e 20 63 61 6c 6c 73 0a | 20 2a 20 66 69 6e 64 5f |n calls.| * find_|
|00001340| 64 61 79 74 65 78 74 28 | 29 20 74 6f 20 6d 61 6b |daytext(|) to mak|
|00001350| 65 20 61 20 73 65 63 6f | 6e 64 20 70 61 73 73 20 |e a seco|nd pass |
|00001360| 74 6f 20 67 65 6e 65 72 | 61 74 65 20 74 68 65 20 |to gener|ate the |
|00001370| 74 65 78 74 20 74 6f 20 | 62 65 20 70 72 69 6e 74 |text to |be print|
|00001380| 65 64 0a 20 2a 20 69 6e | 73 69 64 65 20 74 68 65 |ed. * in|side the|
|00001390| 20 63 61 6c 65 6e 64 61 | 72 20 62 6f 78 65 73 2e | calenda|r boxes.|
|000013a0| 0a 20 2a 0a 20 2a 20 66 | 69 6e 64 5f 68 6f 6c 69 |. *. * f|ind_holi|
|000013b0| 64 61 79 73 28 29 20 61 | 6e 64 20 66 69 6e 64 5f |days() a|nd find_|
|000013c0| 64 61 79 74 65 78 74 28 | 29 20 62 6f 74 68 20 63 |daytext(|) both c|
|000013d0| 61 6c 6c 20 67 65 74 64 | 61 79 28 29 20 74 6f 20 |all getd|ay() to |
|000013e0| 72 65 74 72 69 65 76 65 | 20 74 68 65 20 6e 65 78 |retrieve| the nex|
|000013f0| 74 0a 20 2a 20 64 61 79 | 20 6f 66 20 69 6e 74 65 |t. * day| of inte|
|00001400| 72 65 73 74 20 66 72 6f | 6d 20 74 68 65 20 64 61 |rest fro|m the da|
|00001410| 74 65 20 66 69 6c 65 2e | 0a 20 2a 0a 20 2a 20 67 |te file.|. *. * g|
|00001420| 65 74 64 61 79 28 29 20 | 72 65 61 64 73 20 73 75 |etday() |reads su|
|00001430| 63 63 65 73 73 69 76 65 | 20 6c 69 6e 65 73 20 66 |ccessive| lines f|
|00001440| 72 6f 6d 20 74 68 65 20 | 64 61 74 65 20 66 69 6c |rom the |date fil|
|00001450| 65 20 28 73 74 72 69 70 | 70 69 6e 67 20 63 6f 6d |e (strip|ping com|
|00001460| 6d 65 6e 74 73 20 61 6e | 64 0a 20 2a 20 69 67 6e |ments an|d. * ign|
|00001470| 6f 72 69 6e 67 20 62 6c | 61 6e 6b 20 6c 69 6e 65 |oring bl|ank line|
|00001480| 73 29 2c 20 73 74 6f 70 | 70 69 6e 67 20 77 68 65 |s), stop|ping whe|
|00001490| 6e 20 70 61 72 73 65 28 | 29 20 64 65 74 65 72 6d |n parse(|) determ|
|000014a0| 69 6e 65 73 20 74 68 61 | 74 20 74 68 65 20 6c 69 |ines tha|t the li|
|000014b0| 6e 65 0a 20 2a 20 63 6f | 6e 74 61 69 6e 73 20 61 |ne. * co|ntains a|
|000014c0| 20 75 73 61 62 6c 65 20 | 64 61 74 65 20 6f 72 20 | usable |date or |
|000014d0| 77 68 65 6e 20 45 4f 46 | 20 69 73 20 72 65 61 63 |when EOF| is reac|
|000014e0| 68 65 64 2e 0a 20 2a 0a | 20 2a 20 70 61 72 73 65 |hed.. *.| * parse|
|000014f0| 28 29 20 70 61 72 73 65 | 73 20 61 20 6c 69 6e 65 |() parse|s a line|
|00001500| 20 66 72 6f 6d 20 74 68 | 65 20 64 61 74 65 20 66 | from th|e date f|
|00001510| 69 6c 65 2c 20 64 65 74 | 65 72 6d 69 6e 69 6e 67 |ile, det|ermining|
|00001520| 20 77 68 65 74 68 65 72 | 20 6f 72 20 6e 6f 74 20 | whether| or not |
|00001530| 69 74 0a 20 2a 20 63 6f | 6e 74 61 69 6e 73 20 61 |it. * co|ntains a|
|00001540| 20 64 61 74 65 20 69 6e | 20 74 68 65 20 63 75 72 | date in| the cur|
|00001550| 72 65 6e 74 20 6d 6f 6e | 74 68 20 61 6e 64 20 79 |rent mon|th and y|
|00001560| 65 61 72 2e 20 20 49 74 | 20 63 61 6c 6c 73 20 75 |ear. It| calls u|
|00001570| 74 69 6c 69 74 79 20 72 | 6f 75 74 69 6e 65 73 0a |tility r|outines.|
|00001580| 20 2a 20 69 73 5f 76 61 | 6c 69 64 28 29 20 74 6f | * is_va|lid() to|
|00001590| 20 76 61 6c 69 64 61 74 | 65 20 74 68 65 20 64 61 | validat|e the da|
|000015a0| 74 65 20 66 6f 75 6e 64 | 20 61 6e 64 20 6c 6f 61 |te found| and loa|
|000015b0| 64 77 6f 72 64 73 28 29 | 20 74 6f 20 73 70 6c 69 |dwords()| to spli|
|000015c0| 74 20 61 6e 79 0a 20 2a | 20 61 63 63 6f 6d 70 61 |t any. *| accompa|
|000015d0| 6e 79 69 6e 67 20 74 65 | 78 74 20 69 6e 74 6f 20 |nying te|xt into |
|000015e0| 69 6e 64 69 76 69 64 75 | 61 6c 20 74 6f 6b 65 6e |individu|al token|
|000015f0| 73 20 66 6f 72 20 50 6f | 73 74 53 63 72 69 70 74 |s for Po|stScript|
|00001600| 20 74 6f 20 70 72 69 6e | 74 2e 0a 20 2a 20 0a 20 | to prin|t.. * . |
|00001610| 2a 2f 0a 6d 61 69 6e 28 | 61 72 67 63 2c 20 61 72 |*/.main(|argc, ar|
|00001620| 67 76 29 0a 09 69 6e 74 | 20 61 72 67 63 3b 0a 09 |gv)..int| argc;..|
|00001630| 63 68 61 72 20 2a 2a 61 | 72 67 76 3b 0a 7b 0a 0a |char **a|rgv;.{..|
|00001640| 2f 2a 20 4c 6f 6f 6b 20 | 66 6f 72 20 74 68 65 20 |/* Look |for the |
|00001650| 61 72 67 75 6d 65 6e 74 | 20 66 6f 6c 6c 6f 77 69 |argument| followi|
|00001660| 6e 67 20 61 20 66 6c 61 | 67 20 2d 20 6d 61 79 20 |ng a fla|g - may |
|00001670| 62 65 20 73 65 70 61 72 | 61 74 65 64 20 62 79 20 |be separ|ated by |
|00001680| 73 70 61 63 65 73 20 6f | 72 0a 20 2a 20 6e 6f 74 |spaces o|r. * not|
|00001690| 2e 20 20 49 66 20 6e 6f | 20 6e 6f 6e 2d 66 6c 61 |. If no| non-fla|
|000016a0| 67 20 61 72 67 75 6d 65 | 6e 74 20 61 70 70 65 61 |g argume|nt appea|
|000016b0| 72 73 2c 20 6c 65 61 76 | 65 20 22 61 72 67 22 20 |rs, leav|e "arg" |
|000016c0| 61 6c 6f 6e 65 0a 20 2a | 2f 0a 23 64 65 66 69 6e |alone. *|/.#defin|
|000016d0| 65 20 47 45 54 41 52 47 | 28 61 72 67 29 20 69 66 |e GETARG|(arg) if|
|000016e0| 20 28 28 70 61 72 67 20 | 3d 20 2a 2b 2b 6f 70 74 | ((parg |= *++opt|
|000016f0| 20 3f 20 6f 70 74 20 3a | 20 5c 0a 09 09 09 28 2a | ? opt :| \....(*|
|00001700| 28 61 72 67 76 2b 31 29 | 20 26 26 20 2a 2a 28 61 |(argv+1)| && **(a|
|00001710| 72 67 76 2b 31 29 20 21 | 3d 20 27 2d 27 20 3f 20 |rgv+1) !|= '-' ? |
|00001720| 2a 2b 2b 61 72 67 76 20 | 3a 20 4e 55 4c 4c 29 20 |*++argv |: NULL) |
|00001730| 29 20 5c 0a 09 09 09 21 | 3d 20 4e 55 4c 4c 29 20 |) \....!|= NULL) |
|00001740| 61 72 67 20 3d 20 70 61 | 72 67 3b 20 65 6c 73 65 |arg = pa|rg; else|
|00001750| 0a 0a 2f 2a 20 4c 6f 6f | 70 20 74 68 72 6f 75 67 |../* Loo|p throug|
|00001760| 68 20 6f 6e 65 20 6f 66 | 20 74 68 65 20 68 65 61 |h one of| the hea|
|00001770| 64 65 72 20 73 65 63 74 | 69 6f 6e 73 20 69 6e 20 |der sect|ions in |
|00001780| 70 63 61 6c 69 6e 69 74 | 2e 68 20 2a 2f 0a 23 64 |pcalinit|.h */.#d|
|00001790| 65 66 69 6e 65 20 44 4f | 48 45 41 44 45 52 28 70 |efine DO|HEADER(p|
|000017a0| 68 64 72 29 20 66 6f 72 | 20 28 61 70 20 3d 20 70 |hdr) for| (ap = p|
|000017b0| 68 64 72 3b 20 2a 61 70 | 3b 20 61 70 2b 2b 29 20 |hdr; *ap|; ap++) |
|000017c0| 50 52 54 28 22 25 73 5c | 6e 22 2c 20 2a 61 70 29 |PRT("%s\|n", *ap)|
|000017d0| 0a 0a 09 63 68 61 72 20 | 2a 70 72 6f 67 6e 61 6d |...char |*prognam|
|000017e0| 65 20 3d 20 2a 2a 61 72 | 67 76 20 3f 20 2a 61 72 |e = **ar|gv ? *ar|
|000017f0| 67 76 20 3a 20 22 70 63 | 61 6c 22 3b 0a 09 73 74 |gv : "pc|al";..st|
|00001800| 72 75 63 74 20 74 6d 20 | 2a 70 5f 74 6d 3b 0a 09 |ruct tm |*p_tm;..|
|00001810| 72 65 67 69 73 74 65 72 | 20 63 68 61 72 20 2a 2a |register| char **|
|00001820| 61 70 3b 0a 09 63 68 61 | 72 20 2a 64 61 74 65 5f |ap;..cha|r *date_|
|00001830| 66 69 6c 65 20 3d 20 4e | 55 4c 4c 3b 0a 09 63 68 |file = N|ULL;..ch|
|00001840| 61 72 20 2a 6f 70 74 2c | 20 2a 70 61 72 67 2c 20 |ar *opt,| *parg, |
|00001850| 2a 70 3b 0a 09 6c 6f 6e | 67 20 74 6d 70 3b 0a 09 |*p;..lon|g tmp;..|
|00001860| 69 6e 74 20 6e 6f 63 61 | 6c 20 3d 20 46 41 4c 53 |int noca|l = FALS|
|00001870| 45 3b 0a 09 69 6e 74 20 | 73 61 74 5f 67 72 61 79 |E;..int |sat_gray|
|00001880| 20 3d 20 54 52 55 45 3b | 0a 09 69 6e 74 20 73 75 | = TRUE;|..int su|
|00001890| 6e 5f 67 72 61 79 20 3d | 20 54 52 55 45 3b 0a 20 |n_gray =| TRUE;. |
|000018a0| 09 63 68 61 72 20 2a 74 | 69 74 6c 65 66 6f 6e 74 |.char *t|itlefont|
|000018b0| 20 3d 20 54 49 54 4c 45 | 46 4f 4e 54 3b 0a 20 09 | = TITLE|FONT;. .|
|000018c0| 63 68 61 72 20 2a 64 61 | 79 66 6f 6e 74 20 3d 20 |char *da|yfont = |
|000018d0| 44 41 59 46 4f 4e 54 3b | 0a 09 63 68 61 72 20 2a |DAYFONT;|..char *|
|000018e0| 6f 75 74 66 69 6c 65 20 | 3d 20 4f 55 54 46 49 4c |outfile |= OUTFIL|
|000018f0| 45 3b 0a 20 09 69 6e 74 | 20 72 6f 74 61 74 65 20 |E;. .int| rotate |
|00001900| 3d 20 39 30 3b 0a 20 09 | 69 6e 74 20 6d 6f 6e 74 |= 90;. .|int mont|
|00001910| 68 2c 20 79 65 61 72 2c | 20 6e 6d 6f 6e 74 68 73 |h, year,| nmonths|
|00001920| 3b 0a 09 69 6e 74 20 62 | 61 64 6f 70 74 20 3d 20 |;..int b|adopt = |
|00001930| 46 41 4c 53 45 3b 09 09 | 2f 2a 20 66 6c 61 67 20 |FALSE;..|/* flag |
|00001940| 73 65 74 20 69 66 20 62 | 61 64 20 6f 70 74 69 6f |set if b|ad optio|
|00001950| 6e 20 20 2a 2f 0a 09 69 | 6e 74 20 62 61 64 70 61 |n */..i|nt badpa|
|00001960| 72 20 3d 20 46 41 4c 53 | 45 3b 09 09 2f 2a 20 66 |r = FALS|E;../* f|
|00001970| 6c 61 67 20 73 65 74 20 | 69 66 20 62 61 64 20 70 |lag set |if bad p|
|00001980| 61 72 61 6d 20 20 20 2a | 2f 0a 09 69 6e 74 20 64 |aram *|/..int d|
|00001990| 65 66 61 75 6c 74 5f 6f | 75 74 20 3d 20 54 52 55 |efault_o|ut = TRU|
|000019a0| 45 3b 09 09 2f 2a 20 66 | 6c 61 67 20 69 66 20 64 |E;../* f|lag if d|
|000019b0| 65 66 61 75 6c 74 20 6f | 75 74 70 75 74 20 66 69 |efault o|utput fi|
|000019c0| 6c 65 20 28 56 4d 53 29 | 20 2a 2f 0a 09 69 6e 74 |le (VMS)| */..int|
|000019d0| 20 6e 61 72 67 73 20 3d | 20 30 3b 09 09 09 2f 2a | nargs =| 0;.../*|
|000019e0| 20 63 6f 75 6e 74 20 6f | 66 20 6e 6f 6e 2d 66 6c | count o|f non-fl|
|000019f0| 61 67 20 61 72 67 73 20 | 20 2a 2f 0a 09 69 6e 74 |ag args | */..int|
|00001a00| 20 6e 75 6d 61 72 67 73 | 5b 4d 41 58 41 52 47 53 | numargs|[MAXARGS|
|00001a10| 5d 3b 09 09 2f 2a 20 6e | 6f 6e 2d 66 6c 61 67 20 |];../* n|on-flag |
|00001a20| 28 6e 75 6d 65 72 69 63 | 29 20 61 72 67 73 20 2a |(numeric|) args *|
|00001a30| 2f 0a 0a 09 2f 2a 20 69 | 73 6f 6c 61 74 65 20 72 |/.../* i|solate r|
|00001a40| 6f 6f 74 20 70 72 6f 67 | 72 61 6d 20 6e 61 6d 65 |oot prog|ram name|
|00001a50| 20 28 66 6f 72 20 75 73 | 65 20 69 6e 20 65 72 72 | (for us|e in err|
|00001a60| 6f 72 20 6d 65 73 73 61 | 67 65 73 29 20 2a 2f 0a |or messa|ges) */.|
|00001a70| 0a 09 69 66 20 28 28 70 | 20 3d 20 73 74 72 72 63 |..if ((p| = strrc|
|00001a80| 68 72 28 70 72 6f 67 6e | 61 6d 65 2c 20 45 4e 44 |hr(progn|ame, END|
|00001a90| 5f 50 41 54 48 29 29 20 | 21 3d 20 4e 55 4c 4c 29 |_PATH)) |!= NULL)|
|00001aa0| 0a 09 09 70 72 6f 67 6e | 61 6d 65 20 3d 20 2b 2b |...progn|ame = ++|
|00001ab0| 70 3b 0a 09 69 66 20 28 | 28 70 20 3d 20 73 74 72 |p;..if (|(p = str|
|00001ac0| 63 68 72 28 70 72 6f 67 | 6e 61 6d 65 2c 20 27 2e |chr(prog|name, '.|
|00001ad0| 27 29 29 20 21 3d 20 4e | 55 4c 4c 29 0a 09 09 2a |')) != N|ULL)...*|
|00001ae0| 70 20 3d 20 27 5c 30 27 | 3b 0a 0a 09 2f 2a 20 77 |p = '\0'|;.../* w|
|00001af0| 61 6c 6b 20 74 68 72 6f | 75 67 68 20 63 6f 6d 6d |alk thro|ugh comm|
|00001b00| 61 6e 64 2d 6c 69 6e 65 | 20 61 72 67 75 6d 65 6e |and-line| argumen|
|00001b10| 74 73 20 2a 2f 0a 0a 20 | 09 77 68 69 6c 65 20 28 |ts */.. |.while (|
|00001b20| 2a 2b 2b 61 72 67 76 29 | 20 7b 0a 0a 09 09 69 66 |*++argv)| {....if|
|00001b30| 20 28 2a 2a 61 72 67 76 | 20 21 3d 20 27 2d 27 29 | (**argv| != '-')|
|00001b40| 20 7b 09 2f 2a 20 61 73 | 73 75 6d 65 20 6e 75 6d | {./* as|sume num|
|00001b50| 65 72 69 63 20 61 72 67 | 75 6d 65 6e 74 20 2a 2f |eric arg|ument */|
|00001b60| 0a 09 09 20 20 20 20 09 | 69 66 20 28 6e 61 72 67 |... .|if (narg|
|00001b70| 73 20 3c 20 4d 41 58 41 | 52 47 53 29 0a 09 09 09 |s < MAXA|RGS)....|
|00001b80| 09 6e 75 6d 61 72 67 73 | 5b 6e 61 72 67 73 2b 2b |.numargs|[nargs++|
|00001b90| 5d 20 3d 20 61 74 6f 69 | 28 2a 61 72 67 76 29 3b |] = atoi|(*argv);|
|00001ba0| 0a 09 09 09 63 6f 6e 74 | 69 6e 75 65 3b 0a 09 09 |....cont|inue;...|
|00001bb0| 09 7d 0a 0a 09 09 6f 70 | 74 20 3d 20 28 2a 61 72 |.}....op|t = (*ar|
|00001bc0| 67 76 29 20 2b 20 31 3b | 0a 09 09 73 77 69 74 63 |gv) + 1;|...switc|
|00001bd0| 68 20 28 2a 6f 70 74 29 | 20 7b 0a 0a 20 09 09 63 |h (*opt)| {.. ..c|
|00001be0| 61 73 65 20 27 64 27 3a | 09 09 2f 2a 20 73 70 65 |ase 'd':|../* spe|
|00001bf0| 63 69 66 79 20 61 6c 74 | 65 72 6e 61 74 65 20 64 |cify alt|ernate d|
|00001c00| 61 79 20 66 6f 6e 74 20 | 2a 2f 0a 20 09 09 09 47 |ay font |*/. ...G|
|00001c10| 45 54 41 52 47 28 64 61 | 79 66 6f 6e 74 29 3b 0a |ETARG(da|yfont);.|
|00001c20| 20 09 09 09 62 72 65 61 | 6b 3b 0a 0a 09 09 63 61 | ...brea|k;....ca|
|00001c30| 73 65 20 27 65 27 3a 09 | 09 2f 2a 20 67 65 6e 65 |se 'e':.|./* gene|
|00001c40| 72 61 74 65 20 65 6d 70 | 74 79 20 63 61 6c 65 6e |rate emp|ty calen|
|00001c50| 64 61 72 20 2a 2f 0a 09 | 09 09 6e 6f 63 61 6c 20 |dar */..|..nocal |
|00001c60| 3d 20 54 52 55 45 3b 0a | 09 09 09 64 61 74 65 5f |= TRUE;.|...date_|
|00001c70| 66 69 6c 65 20 3d 20 4e | 55 4c 4c 3b 0a 09 09 09 |file = N|ULL;....|
|00001c80| 62 72 65 61 6b 3b 0a 0a | 09 09 63 61 73 65 20 27 |break;..|..case '|
|00001c90| 66 27 3a 09 09 2f 2a 20 | 73 70 65 63 69 66 79 20 |f':../* |specify |
|00001ca0| 61 6c 74 65 72 6e 61 74 | 65 20 64 61 74 65 20 66 |alternat|e date f|
|00001cb0| 69 6c 65 20 2a 2f 0a 09 | 09 09 47 45 54 41 52 47 |ile */..|..GETARG|
|00001cc0| 28 64 61 74 65 5f 66 69 | 6c 65 29 3b 0a 09 09 09 |(date_fi|le);....|
|00001cd0| 6e 6f 63 61 6c 20 3d 20 | 46 41 4c 53 45 3b 0a 09 |nocal = |FALSE;..|
|00001ce0| 09 09 62 72 65 61 6b 3b | 0a 0a 09 09 63 61 73 65 |..break;|....case|
|00001cf0| 20 27 6f 27 3a 09 09 2f | 2a 20 73 70 65 63 69 66 | 'o':../|* specif|
|00001d00| 79 20 61 6c 74 65 72 6e | 61 74 65 20 6f 75 74 70 |y altern|ate outp|
|00001d10| 75 74 20 66 69 6c 65 20 | 2a 2f 0a 09 09 09 47 45 |ut file |*/....GE|
|00001d20| 54 41 52 47 28 6f 75 74 | 66 69 6c 65 29 3b 0a 09 |TARG(out|file);..|
|00001d30| 09 09 64 65 66 61 75 6c | 74 5f 6f 75 74 20 3d 20 |..defaul|t_out = |
|00001d40| 46 41 4c 53 45 3b 0a 09 | 09 09 62 72 65 61 6b 3b |FALSE;..|..break;|
|00001d50| 0a 0a 20 09 09 63 61 73 | 65 20 27 72 27 3a 09 09 |.. ..cas|e 'r':..|
|00001d60| 2f 2a 20 67 65 6e 65 72 | 61 74 65 20 70 6f 72 74 |/* gener|ate port|
|00001d70| 72 61 69 74 20 63 61 6c | 65 6e 64 61 72 20 2a 2f |rait cal|endar */|
|00001d80| 0a 20 09 09 09 72 6f 74 | 61 74 65 20 3d 20 30 3b |. ...rot|ate = 0;|
|00001d90| 0a 20 09 09 09 62 72 65 | 61 6b 3b 0a 20 0a 09 09 |. ...bre|ak;. ...|
|00001da0| 63 61 73 65 20 27 53 27 | 3a 09 09 2f 2a 20 53 61 |case 'S'|:../* Sa|
|00001db0| 74 75 72 64 61 79 73 20 | 61 6e 64 20 53 75 6e 64 |turdays |and Sund|
|00001dc0| 61 79 73 20 69 6e 20 62 | 6c 61 63 6b 20 2a 2f 0a |ays in b|lack */.|
|00001dd0| 09 09 09 73 75 6e 5f 67 | 72 61 79 20 3d 20 46 41 |...sun_g|ray = FA|
|00001de0| 4c 53 45 3b 0a 09 09 63 | 61 73 65 20 27 73 27 3a |LSE;...c|ase 's':|
|00001df0| 09 09 2f 2a 20 53 61 74 | 75 72 64 61 79 73 20 69 |../* Sat|urdays i|
|00001e00| 6e 20 62 6c 61 63 6b 20 | 2a 2f 0a 09 09 09 73 61 |n black |*/....sa|
|00001e10| 74 5f 67 72 61 79 20 3d | 20 46 41 4c 53 45 3b 0a |t_gray =| FALSE;.|
|00001e20| 09 09 09 62 72 65 61 6b | 3b 0a 0a 20 09 09 63 61 |...break|;.. ..ca|
|00001e30| 73 65 20 27 74 27 3a 09 | 09 2f 2a 20 73 70 65 63 |se 't':.|./* spec|
|00001e40| 69 66 79 20 61 6c 74 65 | 72 6e 61 74 65 20 74 69 |ify alte|rnate ti|
|00001e50| 74 6c 65 20 66 6f 6e 74 | 20 2a 2f 0a 20 09 09 09 |tle font| */. ...|
|00001e60| 47 45 54 41 52 47 28 74 | 69 74 6c 65 66 6f 6e 74 |GETARG(t|itlefont|
|00001e70| 29 3b 0a 20 09 09 09 62 | 72 65 61 6b 3b 0a 0a 09 |);. ...b|reak;...|
|00001e80| 09 64 65 66 61 75 6c 74 | 3a 0a 09 09 09 46 50 52 |.default|:....FPR|
|00001e90| 28 73 74 64 65 72 72 2c | 20 22 25 73 3a 20 69 6c |(stderr,| "%s: il|
|00001ea0| 6c 65 67 61 6c 20 6f 70 | 74 69 6f 6e 20 2d 25 73 |legal op|tion -%s|
|00001eb0| 5c 6e 22 2c 20 70 72 6f | 67 6e 61 6d 65 2c 20 6f |\n", pro|gname, o|
|00001ec0| 70 74 29 3b 0a 09 09 09 | 62 61 64 6f 70 74 20 3d |pt);....|badopt =|
|00001ed0| 20 54 52 55 45 3b 0a 09 | 09 09 62 72 65 61 6b 3b | TRUE;..|..break;|
|00001ee0| 0a 09 09 7d 0a 20 20 20 | 20 20 20 20 20 7d 0a 0a |...}. | }..|
|00001ef0| 09 2f 2a 20 47 65 74 20 | 61 6e 64 20 76 61 6c 69 |./* Get |and vali|
|00001f00| 64 61 74 65 20 6e 6f 6e | 2d 66 6c 61 67 20 28 6e |date non|-flag (n|
|00001f10| 75 6d 65 72 69 63 29 20 | 70 61 72 61 6d 65 74 65 |umeric) |paramete|
|00001f20| 72 73 20 2a 2f 0a 0a 09 | 73 77 69 74 63 68 20 28 |rs */...|switch (|
|00001f30| 6e 61 72 67 73 29 20 7b | 0a 09 63 61 73 65 20 30 |nargs) {|..case 0|
|00001f40| 3a 09 09 2f 2a 20 6e 6f | 20 61 72 67 75 6d 65 6e |:../* no| argumen|
|00001f50| 74 73 20 2d 20 70 72 69 | 6e 74 20 63 75 72 72 65 |ts - pri|nt curre|
|00001f60| 6e 74 20 6d 6f 6e 74 68 | 2f 79 65 61 72 20 2a 2f |nt month|/year */|
|00001f70| 0a 09 09 74 69 6d 65 28 | 26 74 6d 70 29 3b 0a 09 |...time(|&tmp);..|
|00001f80| 09 70 5f 74 6d 20 3d 20 | 6c 6f 63 61 6c 74 69 6d |.p_tm = |localtim|
|00001f90| 65 28 26 74 6d 70 29 3b | 0a 09 09 6d 6f 6e 74 68 |e(&tmp);|...month|
|00001fa0| 20 3d 20 70 5f 74 6d 2d | 3e 74 6d 5f 6d 6f 6e 20 | = p_tm-|>tm_mon |
|00001fb0| 2b 20 31 3b 0a 09 09 79 | 65 61 72 20 3d 20 70 5f |+ 1;...y|ear = p_|
|00001fc0| 74 6d 2d 3e 74 6d 5f 79 | 65 61 72 3b 0a 09 09 6e |tm->tm_y|ear;...n|
|00001fd0| 6d 6f 6e 74 68 73 20 3d | 20 31 3b 0a 09 09 62 72 |months =| 1;...br|
|00001fe0| 65 61 6b 3b 09 09 09 0a | 09 63 61 73 65 20 31 3a |eak;....|.case 1:|
|00001ff0| 09 09 2f 2a 20 6f 6e 65 | 20 61 72 67 75 6d 65 6e |../* one| argumen|
|00002000| 74 20 2d 20 70 72 69 6e | 74 20 65 6e 74 69 72 65 |t - prin|t entire|
|00002010| 20 79 65 61 72 20 2a 2f | 0a 09 09 6d 6f 6e 74 68 | year */|...month|
|00002020| 20 3d 20 31 3b 0a 09 09 | 79 65 61 72 20 3d 20 6e | = 1;...|year = n|
|00002030| 75 6d 61 72 67 73 5b 30 | 5d 3b 0a 09 09 6e 6d 6f |umargs[0|];...nmo|
|00002040| 6e 74 68 73 20 3d 20 31 | 32 3b 0a 09 09 62 72 65 |nths = 1|2;...bre|
|00002050| 61 6b 3b 0a 09 64 65 66 | 61 75 6c 74 3a 09 2f 2a |ak;..def|ault:./*|
|00002060| 20 74 77 6f 20 6f 72 20 | 74 68 72 65 65 20 61 72 | two or |three ar|
|00002070| 67 75 6d 65 6e 74 73 20 | 2d 20 70 72 69 6e 74 20 |guments |- print |
|00002080| 6f 6e 65 20 6f 72 20 6d | 6f 72 65 20 6d 6f 6e 74 |one or m|ore mont|
|00002090| 68 73 20 2a 2f 0a 09 09 | 6d 6f 6e 74 68 20 3d 20 |hs */...|month = |
|000020a0| 6e 75 6d 61 72 67 73 5b | 30 5d 3b 0a 09 09 79 65 |numargs[|0];...ye|
|000020b0| 61 72 20 3d 20 6e 75 6d | 61 72 67 73 5b 31 5d 3b |ar = num|args[1];|
|000020c0| 0a 09 09 6e 6d 6f 6e 74 | 68 73 20 3d 20 6e 61 72 |...nmont|hs = nar|
|000020d0| 67 73 20 3e 20 32 20 3f | 20 6e 75 6d 61 72 67 73 |gs > 2 ?| numargs|
|000020e0| 5b 32 5d 20 3a 20 31 3b | 0a 09 09 62 72 65 61 6b |[2] : 1;|...break|
|000020f0| 3b 0a 09 7d 0a 0a 09 69 | 66 20 28 79 65 61 72 20 |;..}...i|f (year |
|00002100| 3e 20 30 20 26 26 20 79 | 65 61 72 20 3c 20 31 30 |> 0 && y|ear < 10|
|00002110| 30 29 09 2f 2a 20 74 72 | 65 61 74 20 6e 6e 20 61 |0)./* tr|eat nn a|
|00002120| 73 20 31 39 6e 6e 20 2a | 2f 0a 09 09 79 65 61 72 |s 19nn *|/...year|
|00002130| 20 2b 3d 20 31 39 30 30 | 3b 0a 09 0a 09 69 66 20 | += 1900|;....if |
|00002140| 28 6e 6d 6f 6e 74 68 73 | 20 3c 20 31 29 09 09 2f |(nmonths| < 1)../|
|00002150| 2a 20 65 6e 73 75 72 65 | 20 61 74 20 6c 65 61 73 |* ensure| at leas|
|00002160| 74 20 6f 6e 65 20 6d 6f | 6e 74 68 20 2a 2f 0a 09 |t one mo|nth */..|
|00002170| 09 6e 6d 6f 6e 74 68 73 | 20 3d 20 31 3b 0a 09 0a |.nmonths| = 1;...|
|00002180| 09 69 66 20 28 6d 6f 6e | 74 68 20 3c 20 31 20 7c |.if (mon|th < 1 ||
|00002190| 7c 20 6d 6f 6e 74 68 20 | 3e 20 31 32 29 20 7b 09 || month |> 12) {.|
|000021a0| 2f 2a 20 63 68 65 63 6b | 20 72 61 6e 67 65 20 6f |/* check| range o|
|000021b0| 66 20 6d 6f 6e 74 68 20 | 61 6e 64 20 79 65 61 72 |f month |and year|
|000021c0| 20 2a 2f 0a 09 09 46 50 | 52 28 73 74 64 65 72 72 | */...FP|R(stderr|
|000021d0| 2c 20 22 25 73 3a 20 6d | 6f 6e 74 68 20 25 64 20 |, "%s: m|onth %d |
|000021e0| 6e 6f 74 20 69 6e 20 72 | 61 6e 67 65 20 31 20 2e |not in r|ange 1 .|
|000021f0| 2e 20 31 32 5c 6e 22 2c | 20 70 72 6f 67 6e 61 6d |. 12\n",| prognam|
|00002200| 65 2c 0a 09 09 09 6d 6f | 6e 74 68 29 3b 0a 09 09 |e,....mo|nth);...|
|00002210| 62 61 64 70 61 72 20 3d | 20 54 52 55 45 3b 0a 09 |badpar =| TRUE;..|
|00002220| 7d 0a 09 0a 09 69 66 20 | 28 79 65 61 72 20 3c 20 |}....if |(year < |
|00002230| 4d 49 4e 5f 59 52 20 7c | 7c 20 79 65 61 72 20 3e |MIN_YR ||| year >|
|00002240| 20 4d 41 58 5f 59 52 29 | 20 7b 0a 09 09 46 50 52 | MAX_YR)| {...FPR|
|00002250| 28 73 74 64 65 72 72 2c | 20 22 25 73 20 79 65 61 |(stderr,| "%s yea|
|00002260| 72 20 25 64 20 6e 6f 74 | 20 69 6e 20 72 61 6e 67 |r %d not| in rang|
|00002270| 65 20 25 64 20 2e 2e 20 | 25 64 5c 6e 22 2c 20 70 |e %d .. |%d\n", p|
|00002280| 72 6f 67 6e 61 6d 65 2c | 0a 09 09 09 79 65 61 72 |rogname,|....year|
|00002290| 2c 20 4d 49 4e 5f 59 52 | 2c 20 4d 41 58 5f 59 52 |, MIN_YR|, MAX_YR|
|000022a0| 29 3b 0a 09 09 62 61 64 | 70 61 72 20 3d 20 54 52 |);...bad|par = TR|
|000022b0| 55 45 3b 0a 09 7d 0a 0a | 09 2f 2a 20 63 6f 6d 6d |UE;..}..|./* comm|
|000022c0| 61 6e 64 2d 6c 69 6e 65 | 20 65 72 72 6f 72 73 3f |and-line| errors?|
|000022d0| 20 20 67 65 6e 65 72 61 | 74 65 20 75 73 61 67 65 | genera|te usage|
|000022e0| 20 6d 65 73 73 61 67 65 | 20 61 6e 64 20 71 75 69 | message| and qui|
|000022f0| 74 20 2a 2f 0a 09 20 20 | 20 0a 09 69 66 20 28 62 |t */.. | ..if (b|
|00002300| 61 64 70 61 72 20 7c 7c | 20 62 61 64 6f 70 74 29 |adpar ||| badopt)|
|00002310| 20 7b 0a 09 09 75 73 61 | 67 65 28 70 72 6f 67 6e | {...usa|ge(progn|
|00002320| 61 6d 65 29 3b 0a 09 09 | 65 78 69 74 28 45 58 49 |ame);...|exit(EXI|
|00002330| 54 5f 46 41 49 4c 55 52 | 45 29 3b 0a 09 09 7d 0a |T_FAILUR|E);...}.|
|00002340| 0a 09 2f 2a 20 66 6c 61 | 67 20 61 6e 64 20 6e 75 |../* fla|g and nu|
|00002350| 6d 65 72 69 63 20 70 61 | 72 61 6d 65 74 65 72 73 |meric pa|rameters|
|00002360| 20 4f 4b 20 2d 20 6e 6f | 77 20 74 72 79 20 74 6f | OK - no|w try to|
|00002370| 20 6f 70 65 6e 20 74 68 | 65 20 66 69 6c 65 73 20 | open th|e files |
|00002380| 2a 2f 0a 0a 09 69 66 20 | 28 6f 75 74 66 69 6c 65 |*/...if |(outfile|
|00002390| 20 26 26 20 66 72 65 6f | 70 65 6e 28 6f 75 74 66 | && freo|pen(outf|
|000023a0| 69 6c 65 2c 20 22 77 22 | 2c 20 73 74 64 6f 75 74 |ile, "w"|, stdout|
|000023b0| 29 20 3d 3d 20 28 46 49 | 4c 45 20 2a 29 20 4e 55 |) == (FI|LE *) NU|
|000023c0| 4c 4c 29 20 7b 0a 09 09 | 46 50 52 28 73 74 64 65 |LL) {...|FPR(stde|
|000023d0| 72 72 2c 20 22 25 73 3a | 20 63 61 6e 27 74 20 6f |rr, "%s:| can't o|
|000023e0| 70 65 6e 20 66 69 6c 65 | 20 25 73 5c 6e 22 2c 20 |pen file| %s\n", |
|000023f0| 70 72 6f 67 6e 61 6d 65 | 2c 20 6f 75 74 66 69 6c |progname|, outfil|
|00002400| 65 29 3b 0a 09 09 65 78 | 69 74 28 45 58 49 54 5f |e);...ex|it(EXIT_|
|00002410| 46 41 49 4c 55 52 45 29 | 3b 0a 09 09 7d 0a 0a 09 |FAILURE)|;...}...|
|00002420| 2f 2a 0a 09 20 2a 20 49 | 6e 20 63 61 73 65 20 77 |/*.. * I|n case w|
|00002430| 65 20 64 6f 6e 27 74 20 | 65 6e 63 6f 75 6e 74 65 |e don't |encounte|
|00002440| 72 20 61 6e 79 20 79 65 | 61 72 20 64 61 74 61 20 |r any ye|ar data |
|00002450| 69 6e 20 74 68 65 20 64 | 61 74 65 20 66 69 6c 65 |in the d|ate file|
|00002460| 2c 0a 09 20 2a 20 61 73 | 73 75 6d 65 20 74 68 65 |,.. * as|sume the|
|00002470| 20 63 75 72 72 65 6e 74 | 20 79 65 61 72 2e 0a 09 | current| year...|
|00002480| 20 2a 2f 0a 09 69 6e 69 | 74 5f 79 65 61 72 20 3d | */..ini|t_year =|
|00002490| 20 79 65 61 72 3b 0a 0a | 09 2f 2a 0a 09 20 2a 20 | year;..|./*.. * |
|000024a0| 41 74 74 65 6d 70 74 20 | 74 6f 20 6f 70 65 6e 20 |Attempt |to open |
|000024b0| 75 73 65 72 2d 73 70 65 | 63 69 66 69 65 64 20 63 |user-spe|cified c|
|000024c0| 61 6c 65 6e 64 61 72 20 | 66 69 6c 65 20 66 69 72 |alendar |file fir|
|000024d0| 73 74 0a 09 20 2a 2f 0a | 09 69 66 20 28 64 61 74 |st.. */.|.if (dat|
|000024e0| 65 5f 66 69 6c 65 20 21 | 3d 20 4e 55 4c 4c 29 20 |e_file !|= NULL) |
|000024f0| 7b 0a 09 09 69 66 20 28 | 28 64 66 70 20 3d 20 66 |{...if (|(dfp = f|
|00002500| 6f 70 65 6e 28 64 61 74 | 65 5f 66 69 6c 65 2c 20 |open(dat|e_file, |
|00002510| 22 72 22 29 29 20 3d 3d | 20 4e 55 4c 4c 29 20 7b |"r")) ==| NULL) {|
|00002520| 0a 09 09 09 46 50 52 28 | 73 74 64 65 72 72 2c 20 |....FPR(|stderr, |
|00002530| 22 25 73 3a 20 63 61 6e | 27 74 20 6f 70 65 6e 20 |"%s: can|'t open |
|00002540| 66 69 6c 65 20 25 73 5c | 6e 22 2c 20 70 72 6f 67 |file %s\|n", prog|
|00002550| 6e 61 6d 65 2c 20 0a 09 | 09 09 09 64 61 74 65 5f |name, ..|...date_|
|00002560| 66 69 6c 65 29 3b 0a 09 | 09 09 65 78 69 74 28 45 |file);..|..exit(E|
|00002570| 58 49 54 5f 46 41 49 4c | 55 52 45 29 3b 0a 09 09 |XIT_FAIL|URE);...|
|00002580| 7d 0a 09 7d 0a 0a 09 2f | 2a 0a 09 20 2a 20 45 6c |}..}.../|*.. * El|
|00002590| 73 65 20 73 65 65 20 69 | 66 20 74 68 65 20 64 65 |se see i|f the de|
|000025a0| 66 61 75 6c 74 20 63 61 | 6c 65 6e 64 61 72 20 66 |fault ca|lendar f|
|000025b0| 69 6c 65 20 65 78 69 73 | 74 73 20 28 6e 6f 20 65 |ile exis|ts (no e|
|000025c0| 72 72 6f 72 20 69 66 0a | 09 20 2a 20 6e 6f 6e 65 |rror if.|. * none|
|000025d0| 78 69 73 74 65 6e 74 3b | 20 70 72 6f 67 72 61 6d |xistent;| program|
|000025e0| 20 77 69 6c 6c 20 6a 75 | 73 74 20 70 72 69 6e 74 | will ju|st print|
|000025f0| 20 65 6d 70 74 79 20 63 | 61 6c 65 6e 64 61 72 29 | empty c|alendar)|
|00002600| 0a 09 20 2a 2f 0a 09 65 | 6c 73 65 20 69 66 20 28 |.. */..e|lse if (|
|00002610| 6e 6f 63 61 6c 20 3d 3d | 20 46 41 4c 53 45 29 20 |nocal ==| FALSE) |
|00002620| 7b 0a 23 69 66 64 65 66 | 20 56 4d 53 0a 09 09 73 |{.#ifdef| VMS...s|
|00002630| 74 72 63 70 79 28 6c 62 | 75 66 2c 20 22 53 59 53 |trcpy(lb|uf, "SYS|
|00002640| 24 4c 4f 47 49 4e 3a 22 | 29 3b 09 2f 2a 20 67 65 |$LOGIN:"|);./* ge|
|00002650| 74 20 68 6f 6d 65 20 64 | 69 72 65 63 74 6f 72 79 |t home d|irectory|
|00002660| 20 28 56 4d 53 29 20 2a | 2f 0a 23 65 6c 73 65 0a | (VMS) *|/.#else.|
|00002670| 09 09 2a 6c 62 75 66 20 | 3d 20 27 5c 30 27 3b 09 |..*lbuf |= '\0';.|
|00002680| 09 2f 2a 20 74 72 61 6e | 73 6c 61 74 65 20 22 48 |./* tran|slate "H|
|00002690| 4f 4d 45 22 20 74 6f 20 | 70 61 74 68 20 28 55 6e |OME" to |path (Un|
|000026a0| 2a 78 29 20 2a 2f 0a 09 | 09 69 66 20 28 28 70 20 |*x) */..|.if ((p |
|000026b0| 3d 20 67 65 74 65 6e 76 | 28 22 48 4f 4d 45 22 29 |= getenv|("HOME")|
|000026c0| 29 20 21 3d 20 4e 55 4c | 4c 29 20 7b 0a 09 09 09 |) != NUL|L) {....|
|000026d0| 73 74 72 63 61 74 28 6c | 62 75 66 2c 20 70 29 3b |strcat(l|buf, p);|
|000026e0| 0a 09 09 09 73 74 72 63 | 61 74 28 6c 62 75 66 2c |....strc|at(lbuf,|
|000026f0| 20 22 2f 22 29 3b 0a 09 | 09 7d 0a 23 65 6e 64 69 | "/");..|.}.#endi|
|00002700| 66 0a 09 09 73 74 72 63 | 61 74 28 6c 62 75 66 2c |f...strc|at(lbuf,|
|00002710| 20 49 4e 46 49 4c 45 29 | 3b 0a 09 09 64 66 70 20 | INFILE)|;...dfp |
|00002720| 3d 20 66 6f 70 65 6e 28 | 6c 62 75 66 2c 20 22 72 |= fopen(|lbuf, "r|
|00002730| 22 29 3b 0a 09 7d 0a 0a | 09 2f 2a 0a 09 20 2a 20 |");..}..|./*.. * |
|00002740| 57 72 69 74 65 20 6f 75 | 74 20 50 6f 73 74 53 63 |Write ou|t PostSc|
|00002750| 72 69 70 74 20 70 72 6f | 6c 6f 67 0a 09 20 2a 2f |ript pro|log.. */|
|00002760| 0a 20 09 50 52 54 28 22 | 25 25 21 5c 6e 22 29 3b |. .PRT("|%%!\n");|
|00002770| 0a 20 09 50 52 54 28 22 | 2f 74 69 74 6c 65 66 6f |. .PRT("|/titlefo|
|00002780| 6e 74 20 2f 25 73 20 64 | 65 66 5c 6e 2f 64 61 79 |nt /%s d|ef\n/day|
|00002790| 66 6f 6e 74 20 2f 25 73 | 20 64 65 66 5c 6e 22 2c |font /%s| def\n",|
|000027a0| 20 74 69 74 6c 65 66 6f | 6e 74 2c 20 64 61 79 66 | titlefo|nt, dayf|
|000027b0| 6f 6e 74 29 3b 0a 0a 09 | 44 4f 48 45 41 44 45 52 |ont);...|DOHEADER|
|000027c0| 28 68 65 61 64 65 72 5f | 31 29 3b 0a 09 69 66 20 |(header_|1);..if |
|000027d0| 28 73 75 6e 5f 67 72 61 | 79 29 20 7b 0a 09 09 50 |(sun_gra|y) {...P|
|000027e0| 52 54 28 22 5c 74 5c 74 | 5c 74 64 61 79 20 73 74 |RT("\t\t|\tday st|
|000027f0| 61 72 74 20 61 64 64 20 | 37 20 6d 6f 64 20 31 20 |art add |7 mod 1 |
|00002800| 25 73 20 7b 5c 6e 22 2c | 0a 09 09 09 73 61 74 5f |%s {\n",|....sat_|
|00002810| 67 72 61 79 20 3f 20 22 | 6c 65 22 20 3a 20 22 65 |gray ? "|le" : "e|
|00002820| 71 22 20 29 3b 0a 20 20 | 09 09 50 52 54 28 22 5c |q" );. |..PRT("\|
|00002830| 74 5c 74 5c 74 5c 74 2e | 38 20 73 65 74 67 72 61 |t\t\t\t.|8 setgra|
|00002840| 79 5c 6e 22 29 3b 0a 20 | 20 09 09 50 52 54 28 22 |y\n");. | ..PRT("|
|00002850| 5c 74 5c 74 5c 74 7d 20 | 69 66 5c 6e 22 29 3b 0a |\t\t\t} |if\n");.|
|00002860| 09 09 7d 0a 09 44 4f 48 | 45 41 44 45 52 28 68 65 |..}..DOH|EADER(he|
|00002870| 61 64 65 72 5f 32 29 3b | 0a 0a 20 09 50 52 54 28 |ader_2);|.. .PRT(|
|00002880| 22 5c 74 25 64 20 72 6f | 74 61 74 65 5c 6e 22 2c |"\t%d ro|tate\n",|
|00002890| 20 72 6f 74 61 74 65 29 | 3b 0a 20 09 69 66 20 28 | rotate)|;. .if (|
|000028a0| 72 6f 74 61 74 65 29 0a | 20 09 09 50 52 54 28 22 |rotate).| ..PRT("|
|000028b0| 5c 74 35 30 20 2d 31 32 | 30 20 74 72 61 6e 73 6c |\t50 -12|0 transl|
|000028c0| 61 74 65 5c 6e 22 29 3b | 0a 20 09 65 6c 73 65 0a |ate\n");|. .else.|
|000028d0| 20 09 09 50 52 54 28 22 | 5c 74 30 2e 37 35 20 30 | ..PRT("|\t0.75 0|
|000028e0| 2e 37 35 20 73 63 61 6c | 65 5c 6e 5c 74 35 30 20 |.75 scal|e\n\t50 |
|000028f0| 34 36 30 20 74 72 61 6e | 73 6c 61 74 65 5c 6e 22 |460 tran|slate\n"|
|00002900| 29 3b 0a 0a 09 44 4f 48 | 45 41 44 45 52 28 68 65 |);...DOH|EADER(he|
|00002910| 61 64 65 72 5f 33 29 3b | 0a 0a 09 2f 2a 0a 09 20 |ader_3);|.../*.. |
|00002920| 2a 20 4c 6f 6f 70 20 74 | 68 72 6f 75 67 68 20 61 |* Loop t|hrough a|
|00002930| 6c 6c 20 74 68 65 20 72 | 65 71 75 65 73 74 65 64 |ll the r|equested|
|00002940| 20 6d 6f 6e 74 68 73 0a | 09 20 2a 2f 0a 09 77 68 | months.|. */..wh|
|00002950| 69 6c 65 20 28 6e 6d 6f | 6e 74 68 73 2d 2d 29 20 |ile (nmo|nths--) |
|00002960| 7b 0a 09 09 70 6d 6f 6e | 74 68 28 6d 6f 6e 74 68 |{...pmon|th(month|
|00002970| 2c 20 79 65 61 72 29 3b | 0a 09 09 69 66 20 28 2b |, year);|...if (+|
|00002980| 2b 6d 6f 6e 74 68 20 3e | 20 44 45 43 29 20 7b 0a |+month >| DEC) {.|
|00002990| 09 09 09 6d 6f 6e 74 68 | 20 3d 20 4a 41 4e 3b 0a |...month| = JAN;.|
|000029a0| 09 09 09 79 65 61 72 2b | 2b 3b 0a 09 09 7d 0a 09 |...year+|+;...}..|
|000029b0| 7d 0a 0a 09 69 66 20 28 | 64 66 70 29 09 09 2f 2a |}...if (|dfp)../*|
|000029c0| 20 63 6c 6f 73 65 20 64 | 61 74 65 20 66 69 6c 65 | close d|ate file|
|000029d0| 20 2a 2f 0a 09 09 66 63 | 6c 6f 73 65 28 64 66 70 | */...fc|lose(dfp|
|000029e0| 29 3b 0a 0a 23 69 66 64 | 65 66 20 56 4d 53 0a 09 |);..#ifd|ef VMS..|
|000029f0| 69 66 20 28 64 65 66 61 | 75 6c 74 5f 6f 75 74 29 |if (defa|ult_out)|
|00002a00| 09 2f 2a 20 69 6e 66 6f | 72 6d 20 56 4d 53 20 75 |./* info|rm VMS u|
|00002a10| 73 65 72 73 20 77 68 65 | 72 65 20 6f 75 74 70 75 |sers whe|re outpu|
|00002a20| 74 20 69 73 20 2a 2f 0a | 09 09 46 50 52 28 73 74 |t is */.|..FPR(st|
|00002a30| 64 65 72 72 2c 20 22 4f | 75 74 70 75 74 20 69 73 |derr, "O|utput is|
|00002a40| 20 69 6e 20 66 69 6c 65 | 20 25 73 5c 6e 22 2c 20 | in file| %s\n", |
|00002a50| 6f 75 74 66 69 6c 65 29 | 3b 0a 23 65 6e 64 69 66 |outfile)|;.#endif|
|00002a60| 0a 09 65 78 69 74 28 45 | 58 49 54 5f 53 55 43 43 |..exit(E|XIT_SUCC|
|00002a70| 45 53 53 29 3b 0a 7d 0a | 0c 0a 2f 2a 0a 20 2a 09 |ESS);.}.|../*. *.|
|00002a80| 50 72 69 6e 74 20 6d 65 | 73 73 61 67 65 20 65 78 |Print me|ssage ex|
|00002a90| 70 6c 61 69 6e 69 6e 67 | 20 63 6f 72 72 65 63 74 |plaining| correct|
|00002aa0| 20 75 73 61 67 65 20 6f | 66 20 74 68 65 20 63 6f | usage o|f the co|
|00002ab0| 6d 6d 61 6e 64 2d 6c 69 | 6e 65 0a 20 2a 09 61 72 |mmand-li|ne. *.ar|
|00002ac0| 67 75 6d 65 6e 74 73 20 | 61 6e 64 20 66 6c 61 67 |guments |and flag|
|00002ad0| 73 0a 20 2a 2f 0a 75 73 | 61 67 65 28 70 72 6f 67 |s. */.us|age(prog|
|00002ae0| 29 0a 09 63 68 61 72 20 | 2a 70 72 6f 67 3b 0a 7b |)..char |*prog;.{|
|00002af0| 0a 09 46 50 52 28 73 74 | 64 65 72 72 2c 20 22 5c |..FPR(st|derr, "\|
|00002b00| 6e 55 73 61 67 65 3a 5c | 6e 5c 6e 22 29 3b 0a 09 |nUsage:\|n\n");..|
|00002b10| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 74 25 |FPR(stde|rr, "\t%|
|00002b20| 73 20 5b 2d 64 20 46 4f | 4e 54 5d 20 5b 2d 65 20 |s [-d FO|NT] [-e |
|00002b30| 7c 20 2d 66 20 46 49 4c | 45 5d 20 5b 2d 6f 20 46 || -f FIL|E] [-o F|
|00002b40| 49 4c 45 5d 20 5b 2d 72 | 5d 20 5b 2d 73 20 7c 20 |ILE] [-r|] [-s | |
|00002b50| 2d 25 73 5d 20 5b 2d 74 | 20 46 4f 4e 54 5d 5c 6e |-%s] [-t| FONT]\n|
|00002b60| 22 2c 0a 09 09 70 72 6f | 67 2c 20 53 5f 4f 50 54 |",...pro|g, S_OPT|
|00002b70| 29 3b 0a 09 46 50 52 28 | 73 74 64 65 72 72 2c 20 |);..FPR(|stderr, |
|00002b80| 22 5c 74 5c 74 5b 20 5b | 20 5b 6d 6d 5d 20 79 79 |"\t\t[ [| [mm] yy|
|00002b90| 20 5d 20 7c 20 5b 6d 6d | 20 79 79 20 6e 5d 20 5d | ] | [mm| yy n] ]|
|00002ba0| 5c 6e 5c 6e 22 29 3b 0a | 09 46 50 52 28 73 74 64 |\n\n");.|.FPR(std|
|00002bb0| 65 72 72 2c 20 22 5c 74 | 5c 74 2d 64 20 46 4f 4e |err, "\t|\t-d FON|
|00002bc0| 54 5c 74 5c 74 73 70 65 | 63 69 66 79 20 61 6c 74 |T\t\tspe|cify alt|
|00002bd0| 65 72 6e 61 74 65 20 66 | 6f 6e 74 20 66 6f 72 20 |ernate f|ont for |
|00002be0| 64 61 79 20 6e 61 6d 65 | 73 5c 6e 22 29 3b 0a 09 |day name|s\n");..|
|00002bf0| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 74 5c |FPR(stde|rr, "\t\|
|00002c00| 74 5c 74 5c 74 28 64 65 | 66 61 75 6c 74 3a 20 25 |t\t\t(de|fault: %|
|00002c10| 73 29 5c 6e 22 2c 20 44 | 41 59 46 4f 4e 54 29 3b |s)\n", D|AYFONT);|
|00002c20| 0a 09 46 50 52 28 73 74 | 64 65 72 72 2c 20 22 5c |..FPR(st|derr, "\|
|00002c30| 6e 22 29 3b 0a 09 46 50 | 52 28 73 74 64 65 72 72 |n");..FP|R(stderr|
|00002c40| 2c 20 22 5c 74 5c 74 2d | 65 5c 74 5c 74 67 65 6e |, "\t\t-|e\t\tgen|
|00002c50| 65 72 61 74 65 20 65 6d | 70 74 79 20 63 61 6c 65 |erate em|pty cale|
|00002c60| 6e 64 61 72 20 28 69 67 | 6e 6f 72 65 20 64 61 74 |ndar (ig|nore dat|
|00002c70| 65 20 66 69 6c 65 29 5c | 6e 22 29 3b 0a 09 46 50 |e file)\|n");..FP|
|00002c80| 52 28 73 74 64 65 72 72 | 2c 20 22 5c 6e 22 29 3b |R(stderr|, "\n");|
|00002c90| 0a 09 46 50 52 28 73 74 | 64 65 72 72 2c 20 22 5c |..FPR(st|derr, "\|
|00002ca0| 74 5c 74 2d 66 20 46 49 | 4c 45 5c 74 5c 74 73 70 |t\t-f FI|LE\t\tsp|
|00002cb0| 65 63 69 66 79 20 61 6c | 74 65 72 6e 61 74 65 20 |ecify al|ternate |
|00002cc0| 64 61 74 65 20 66 69 6c | 65 5c 6e 22 29 3b 0a 09 |date fil|e\n");..|
|00002cd0| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 74 5c |FPR(stde|rr, "\t\|
|00002ce0| 74 5c 74 5c 74 28 64 65 | 66 61 75 6c 74 3a 20 25 |t\t\t(de|fault: %|
|00002cf0| 73 29 5c 6e 22 2c 20 49 | 4e 46 49 4c 45 29 3b 0a |s)\n", I|NFILE);.|
|00002d00| 09 46 50 52 28 73 74 64 | 65 72 72 2c 20 22 5c 6e |.FPR(std|err, "\n|
|00002d10| 22 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |");..FPR|(stderr,|
|00002d20| 20 22 5c 74 5c 74 2d 6f | 20 46 49 4c 45 5c 74 5c | "\t\t-o| FILE\t\|
|00002d30| 74 73 70 65 63 69 66 79 | 20 61 6c 74 65 72 6e 61 |tspecify| alterna|
|00002d40| 74 65 20 6f 75 74 70 75 | 74 20 66 69 6c 65 5c 6e |te outpu|t file\n|
|00002d50| 22 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |");..FPR|(stderr,|
|00002d60| 20 22 5c 74 5c 74 5c 74 | 5c 74 28 64 65 66 61 75 | "\t\t\t|\t(defau|
|00002d70| 6c 74 3a 20 25 73 29 5c | 6e 22 2c 20 4f 55 54 46 |lt: %s)\|n", OUTF|
|00002d80| 49 4c 45 20 3f 20 4f 55 | 54 46 49 4c 45 20 3a 20 |ILE ? OU|TFILE : |
|00002d90| 22 73 74 64 6f 75 74 22 | 29 3b 0a 09 46 50 52 28 |"stdout"|);..FPR(|
|00002da0| 73 74 64 65 72 72 2c 20 | 22 5c 6e 22 29 3b 0a 09 |stderr, |"\n");..|
|00002db0| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 74 5c |FPR(stde|rr, "\t\|
|00002dc0| 74 2d 72 5c 74 5c 74 67 | 65 6e 65 72 61 74 65 20 |t-r\t\tg|enerate |
|00002dd0| 70 6f 72 74 72 61 69 74 | 2d 73 74 79 6c 65 20 63 |portrait|-style c|
|00002de0| 61 6c 65 6e 64 61 72 73 | 5c 6e 22 29 3b 0a 09 46 |alendars|\n");..F|
|00002df0| 50 52 28 73 74 64 65 72 | 72 2c 20 22 5c 74 5c 74 |PR(stder|r, "\t\t|
|00002e00| 5c 74 5c 74 28 64 65 66 | 61 75 6c 74 3a 20 6c 61 |\t\t(def|ault: la|
|00002e10| 6e 64 73 63 61 70 65 29 | 5c 6e 22 29 3b 0a 09 46 |ndscape)|\n");..F|
|00002e20| 50 52 28 73 74 64 65 72 | 72 2c 20 22 5c 6e 22 29 |PR(stder|r, "\n")|
|00002e30| 3b 0a 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |;..FPR(s|tderr, "|
|00002e40| 5c 74 5c 74 2d 73 5c 74 | 5c 74 70 72 69 6e 74 20 |\t\t-s\t|\tprint |
|00002e50| 53 61 74 75 72 64 61 79 | 73 20 69 6e 20 62 6c 61 |Saturday|s in bla|
|00002e60| 63 6b 5c 6e 22 29 3b 0a | 09 46 50 52 28 73 74 64 |ck\n");.|.FPR(std|
|00002e70| 65 72 72 2c 20 22 5c 74 | 5c 74 2d 25 73 5c 74 5c |err, "\t|\t-%s\t\|
|00002e80| 74 70 72 69 6e 74 20 53 | 61 74 75 72 64 61 79 73 |tprint S|aturdays|
|00002e90| 20 61 6e 64 20 53 75 6e | 64 61 79 73 20 69 6e 20 | and Sun|days in |
|00002ea0| 62 6c 61 63 6b 5c 6e 22 | 2c 20 53 5f 4f 50 54 29 |black\n"|, S_OPT)|
|00002eb0| 3b 0a 09 46 50 52 28 73 | 74 64 65 72 72 2c 20 22 |;..FPR(s|tderr, "|
|00002ec0| 5c 74 5c 74 5c 74 5c 74 | 28 64 65 66 61 75 6c 74 |\t\t\t\t|(default|
|00002ed0| 3a 20 70 72 69 6e 74 20 | 53 61 74 75 72 64 61 79 |: print |Saturday|
|00002ee0| 73 20 61 6e 64 20 53 75 | 6e 64 61 79 73 20 69 6e |s and Su|ndays in|
|00002ef0| 20 67 72 61 79 29 5c 6e | 22 29 3b 0a 09 46 50 52 | gray)\n|");..FPR|
|00002f00| 28 73 74 64 65 72 72 2c | 20 22 5c 6e 22 29 3b 0a |(stderr,| "\n");.|
|00002f10| 09 46 50 52 28 73 74 64 | 65 72 72 2c 20 22 5c 74 |.FPR(std|err, "\t|
|00002f20| 5c 74 2d 74 20 46 4f 4e | 54 5c 74 5c 74 73 70 65 |\t-t FON|T\t\tspe|
|00002f30| 63 69 66 79 20 61 6c 74 | 65 72 6e 61 74 65 20 66 |cify alt|ernate f|
|00002f40| 6f 6e 74 20 66 6f 72 20 | 74 69 74 6c 65 73 5c 6e |ont for |titles\n|
|00002f50| 22 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |");..FPR|(stderr,|
|00002f60| 20 22 5c 74 5c 74 5c 74 | 5c 74 28 64 65 66 61 75 | "\t\t\t|\t(defau|
|00002f70| 6c 74 3a 20 25 73 29 5c | 6e 22 2c 20 54 49 54 4c |lt: %s)\|n", TITL|
|00002f80| 45 46 4f 4e 54 29 3b 0a | 09 46 50 52 28 73 74 64 |EFONT);.|.FPR(std|
|00002f90| 65 72 72 2c 20 22 5c 6e | 22 29 3b 0a 09 46 50 52 |err, "\n|");..FPR|
|00002fa0| 28 73 74 64 65 72 72 2c | 20 22 5c 74 25 73 20 5b |(stderr,| "\t%s [|
|00002fb0| 6f 70 74 73 5d 5c 74 5c | 74 67 65 6e 65 72 61 74 |opts]\t\|tgenerat|
|00002fc0| 65 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 63 |e calend|ar for c|
|00002fd0| 75 72 72 65 6e 74 20 6d | 6f 6e 74 68 2f 79 65 61 |urrent m|onth/yea|
|00002fe0| 72 5c 6e 22 2c 0a 09 09 | 70 72 6f 67 29 3b 0a 09 |r\n",...|prog);..|
|00002ff0| 46 50 52 28 73 74 64 65 | 72 72 2c 20 22 5c 6e 22 |FPR(stde|rr, "\n"|
|00003000| 29 3b 0a 09 46 50 52 28 | 73 74 64 65 72 72 2c 20 |);..FPR(|stderr, |
|00003010| 22 5c 74 25 73 20 5b 6f | 70 74 73 5d 20 79 79 5c |"\t%s [o|pts] yy\|
|00003020| 74 5c 74 67 65 6e 65 72 | 61 74 65 20 63 61 6c 65 |t\tgener|ate cale|
|00003030| 6e 64 61 72 20 66 6f 72 | 20 65 6e 74 69 72 65 20 |ndar for| entire |
|00003040| 79 65 61 72 20 79 79 5c | 6e 22 2c 0a 09 09 70 72 |year yy\|n",...pr|
|00003050| 6f 67 29 3b 0a 09 46 50 | 52 28 73 74 64 65 72 72 |og);..FP|R(stderr|
|00003060| 2c 20 22 5c 6e 22 29 3b | 0a 09 46 50 52 28 73 74 |, "\n");|..FPR(st|
|00003070| 64 65 72 72 2c 20 22 5c | 74 25 73 20 5b 6f 70 74 |derr, "\|t%s [opt|
|00003080| 73 5d 20 6d 6d 20 79 79 | 5c 74 67 65 6e 65 72 61 |s] mm yy|\tgenera|
|00003090| 74 65 20 63 61 6c 65 6e | 64 61 72 20 66 6f 72 20 |te calen|dar for |
|000030a0| 6d 6f 6e 74 68 20 6d 6d | 5c 6e 22 2c 20 70 72 6f |month mm|\n", pro|
|000030b0| 67 29 3b 0a 09 46 50 52 | 28 73 74 64 65 72 72 2c |g);..FPR|(stderr,|
|000030c0| 20 22 5c 74 5c 74 5c 74 | 5c 74 28 4a 61 6e 20 3d | "\t\t\t|\t(Jan =|
|000030d0| 20 31 29 2c 20 79 65 61 | 72 20 79 79 20 28 31 39 | 1), yea|r yy (19|
|000030e0| 79 79 20 69 66 20 79 79 | 20 3c 20 31 30 30 29 5c |yy if yy| < 100)\|
|000030f0| 6e 22 29 3b 0a 09 46 50 | 52 28 73 74 64 65 72 72 |n");..FP|R(stderr|
|00003100| 2c 20 22 5c 6e 22 29 3b | 0a 09 46 50 52 28 73 74 |, "\n");|..FPR(st|
|00003110| 64 65 72 72 2c 20 22 5c | 74 25 73 20 5b 6f 70 74 |derr, "\|t%s [opt|
|00003120| 73 5d 20 6d 6d 20 79 79 | 20 6e 5c 74 61 73 20 61 |s] mm yy| n\tas a|
|00003130| 62 6f 76 65 2c 20 66 6f | 72 20 6e 20 63 6f 6e 73 |bove, fo|r n cons|
|00003140| 65 63 75 74 69 76 65 20 | 6d 6f 6e 74 68 73 5c 6e |ecutive |months\n|
|00003150| 22 2c 0a 09 09 70 72 6f | 67 29 3b 0a 09 46 50 52 |",...pro|g);..FPR|
|00003160| 28 73 74 64 65 72 72 2c | 20 22 5c 6e 22 29 3b 0a |(stderr,| "\n");.|
|00003170| 7d 0a 0a 0c 0a 2f 2a 0a | 20 2a 20 69 73 5f 76 61 |}..../*.| * is_va|
|00003180| 6c 69 64 20 2d 20 72 65 | 74 75 72 6e 20 54 52 55 |lid - re|turn TRU|
|00003190| 45 20 69 66 20 6d 2f 64 | 2f 79 20 69 73 20 61 20 |E if m/d|/y is a |
|000031a0| 76 61 6c 69 64 20 64 61 | 74 65 0a 20 2a 2f 0a 69 |valid da|te. */.i|
|000031b0| 6e 74 20 69 73 5f 76 61 | 6c 69 64 28 6d 2c 20 64 |nt is_va|lid(m, d|
|000031c0| 2c 20 79 29 0a 09 72 65 | 67 69 73 74 65 72 20 69 |, y)..re|gister i|
|000031d0| 6e 74 20 6d 2c 20 64 2c | 20 79 3b 0a 7b 0a 09 73 |nt m, d,| y;.{..s|
|000031e0| 74 61 74 69 63 20 63 68 | 61 72 20 6c 65 6e 5b 31 |tatic ch|ar len[1|
|000031f0| 33 5d 20 3d 20 7b 30 2c | 20 33 31 2c 20 32 38 2c |3] = {0,| 31, 28,|
|00003200| 20 33 31 2c 20 33 30 2c | 20 33 31 2c 20 33 30 2c | 31, 30,| 31, 30,|
|00003210| 20 33 31 2c 20 33 31 2c | 20 33 30 2c 20 33 31 2c | 31, 31,| 30, 31,|
|00003220| 20 33 30 2c 20 33 31 20 | 7d 3b 0a 0a 09 72 65 74 | 30, 31 |};...ret|
|00003230| 75 72 6e 20 28 64 20 3e | 3d 20 31 20 26 26 20 64 |urn (d >|= 1 && d|
|00003240| 20 3c 3d 20 28 6c 65 6e | 5b 6d 5d 20 2b 20 28 6d | <= (len|[m] + (m|
|00003250| 20 3d 3d 20 46 45 42 20 | 26 26 20 69 73 5f 6c 65 | == FEB |&& is_le|
|00003260| 61 70 28 79 29 29 29 20 | 29 3b 0a 7d 0a 0a 0a 2f |ap(y))) |);.}.../|
|00003270| 2a 0a 20 2a 20 6c 6f 61 | 64 77 6f 72 64 73 20 2d |*. * loa|dwords -|
|00003280| 20 74 6f 6b 65 6e 69 7a | 65 20 6c 69 6e 65 20 62 | tokeniz|e line b|
|00003290| 75 66 66 65 72 20 69 6e | 74 6f 20 77 6f 72 64 20 |uffer in|to word |
|000032a0| 61 72 72 61 79 2c 20 72 | 65 74 75 72 6e 20 77 6f |array, r|eturn wo|
|000032b0| 72 64 20 63 6f 75 6e 74 | 0a 20 2a 20 28 61 73 73 |rd count|. * (ass|
|000032c0| 75 6d 65 73 20 73 74 72 | 74 6f 6b 28 29 20 68 61 |umes str|tok() ha|
|000032d0| 73 20 61 6c 72 65 61 64 | 79 20 62 65 65 6e 20 63 |s alread|y been c|
|000032e0| 61 6c 6c 65 64 20 77 69 | 74 68 20 6e 6f 6e 2d 6e |alled wi|th non-n|
|000032f0| 75 6c 6c 20 66 69 72 73 | 74 20 61 72 67 29 0a 20 |ull firs|t arg). |
|00003300| 2a 2f 0a 69 6e 74 20 6c | 6f 61 64 77 6f 72 64 73 |*/.int l|oadwords|
|00003310| 28 29 0a 7b 0a 09 72 65 | 67 69 73 74 65 72 20 63 |().{..re|gister c|
|00003320| 68 61 72 20 2a 2a 61 70 | 20 3d 20 77 6f 72 64 73 |har **ap| = words|
|00003330| 3b 0a 09 72 65 67 69 73 | 74 65 72 20 69 3b 0a 0a |;..regis|ter i;..|
|00003340| 09 66 6f 72 20 28 69 20 | 3d 20 30 3b 20 2a 61 70 |.for (i |= 0; *ap|
|00003350| 20 3d 20 73 74 72 74 6f | 6b 28 4e 55 4c 4c 2c 20 | = strto|k(NULL, |
|00003360| 57 48 49 54 45 53 50 41 | 43 45 29 20 3b 20 61 70 |WHITESPA|CE) ; ap|
|00003370| 2b 2b 2c 20 69 2b 2b 29 | 20 3b 0a 09 72 65 74 75 |++, i++)| ;..retu|
|00003380| 72 6e 28 69 29 3b 0a 7d | 0a 0a 0c 0a 2f 2a 0a 20 |rn(i);.}|..../*. |
|00003390| 2a 20 70 61 72 73 65 20 | 2d 20 63 68 65 63 6b 20 |* parse |- check |
|000033a0| 64 61 74 65 20 66 69 6c | 65 20 65 6e 74 72 79 20 |date fil|e entry |
|000033b0| 66 6f 72 20 28 69 6e 20 | 6c 62 75 66 5b 5d 29 20 |for (in |lbuf[]) |
|000033c0| 66 6f 72 20 64 65 73 69 | 72 65 64 20 6d 6f 6e 74 |for desi|red mont|
|000033d0| 68 2f 79 65 61 72 0a 20 | 2a 0a 20 2a 20 4c 6f 6f |h/year. |*. * Loo|
|000033e0| 6b 73 20 66 6f 72 20 61 | 6e 20 65 6e 74 72 79 20 |ks for a|n entry |
|000033f0| 6f 66 20 6f 6e 65 20 6f | 66 20 74 68 65 20 66 6f |of one o|f the fo|
|00003400| 6c 6c 6f 77 69 6e 67 20 | 66 6f 72 6d 73 3a 0a 20 |llowing |forms:. |
|00003410| 2a 0a 20 2a 09 79 65 61 | 72 20 3c 79 65 61 72 3e |*. *.yea|r <year>|
|00003420| 0a 20 2a 09 3c 6d 6f 6e | 74 68 5f 6e 61 6d 65 3e |. *.<mon|th_name>|
|00003430| 20 3c 64 61 79 3e 7b 2a | 7d 20 7b 3c 74 65 78 74 | <day>{*|} {<text|
|00003440| 3e 7d 0a 20 2a 09 3c 6d | 6f 6e 74 68 3e 3c 73 65 |>}. *.<m|onth><se|
|00003450| 70 3e 3c 64 61 79 3e 7b | 3c 73 65 70 3e 3c 79 65 |p><day>{|<sep><ye|
|00003460| 61 72 3e 7d 7b 2a 7d 20 | 7b 3c 74 65 78 74 3e 7d |ar>}{*} |{<text>}|
|00003470| 0a 20 2a 0a 20 2a 20 77 | 68 65 72 65 0a 20 2a 09 |. *. * w|here. *.|
|00003480| 3c 6d 6f 6e 74 68 5f 6e | 61 6d 65 3e 20 3a 3d 20 |<month_n|ame> := |
|00003490| 66 69 72 73 74 20 33 2b | 20 63 68 61 72 61 63 74 |first 3+| charact|
|000034a0| 65 72 73 20 6f 66 20 6e | 61 6d 65 20 6f 66 20 6d |ers of n|ame of m|
|000034b0| 6f 6e 74 68 20 28 69 6e | 20 45 6e 67 6c 69 73 68 |onth (in| English|
|000034c0| 29 0a 20 2a 09 3c 73 65 | 70 3e 20 3a 3d 20 6f 6e |). *.<se|p> := on|
|000034d0| 65 20 6f 72 20 6d 6f 72 | 65 20 6e 6f 6e 2d 6e 75 |e or mor|e non-nu|
|000034e0| 6d 65 72 69 63 2c 20 6e | 6f 6e 2d 73 70 61 63 65 |meric, n|on-space|
|000034f0| 2c 20 6e 6f 6e 2d 27 2a | 27 20 63 68 61 72 61 63 |, non-'*|' charac|
|00003500| 74 65 72 73 0a 20 2a 0a | 20 2a 20 52 65 74 75 72 |ters. *.| * Retur|
|00003510| 6e 73 20 64 61 79 20 28 | 77 69 74 68 20 68 6f 6c |ns day (|with hol|
|00003520| 69 64 61 79 20 66 6c 61 | 67 20 73 65 74 20 69 66 |iday fla|g set if|
|00003530| 20 73 70 65 63 69 66 69 | 65 64 29 20 69 66 20 64 | specifi|ed) if d|
|00003540| 61 74 65 20 66 69 6c 65 | 20 65 6e 74 72 79 0a 20 |ate file| entry. |
|00003550| 2a 20 69 73 20 61 70 70 | 6c 69 63 61 62 6c 65 20 |* is app|licable |
|00003560| 74 6f 20 63 75 72 72 65 | 6e 74 20 6d 6f 6e 74 68 |to curre|nt month|
|00003570| 2f 79 65 61 72 3b 20 30 | 20 69 66 20 6e 6f 74 3b |/year; 0| if not;|
|00003580| 20 70 61 72 73 65 73 20 | 61 6e 79 20 66 6f 6c 6c | parses |any foll|
|00003590| 6f 77 69 6e 67 0a 20 2a | 20 74 65 78 74 20 69 6e |owing. *| text in|
|000035a0| 74 6f 20 67 6c 6f 62 61 | 6c 20 61 72 72 61 79 20 |to globa|l array |
|000035b0| 77 6f 72 64 73 5b 5d 2e | 0a 20 2a 2f 0a 69 6e 74 |words[].|. */.int|
|000035c0| 20 70 61 72 73 65 28 6d | 6f 6e 74 68 2c 20 79 65 | parse(m|onth, ye|
|000035d0| 61 72 29 0a 09 72 65 67 | 69 73 74 65 72 20 69 6e |ar)..reg|ister in|
|000035e0| 74 20 6d 6f 6e 74 68 2c | 20 79 65 61 72 3b 0a 7b |t month,| year;.{|
|000035f0| 0a 09 72 65 67 69 73 74 | 65 72 20 63 68 61 72 20 |..regist|er char |
|00003600| 2a 63 70 3b 0a 09 69 6e | 74 20 6d 6d 2c 20 64 64 |*cp;..in|t mm, dd|
|00003610| 2c 20 79 79 3b 0a 09 69 | 6e 74 20 69 73 5f 68 6f |, yy;..i|nt is_ho|
|00003620| 6c 69 64 61 79 2c 20 76 | 61 6c 69 64 3b 0a 0a 09 |liday, v|alid;...|
|00003630| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 6d 6f 6e |static c|har *mon|
|00003640| 74 68 73 5b 31 33 5d 20 | 3d 20 7b 09 2f 2a 20 75 |ths[13] |= {./* u|
|00003650| 73 65 64 20 74 6f 20 6d | 61 74 63 68 20 61 6c 70 |sed to m|atch alp|
|00003660| 68 61 20 6d 6f 6e 74 68 | 73 20 2a 2f 0a 09 09 22 |ha month|s */..."|
|00003670| 22 2c 20 22 6a 61 6e 22 | 2c 20 22 66 65 62 22 2c |", "jan"|, "feb",|
|00003680| 20 22 6d 61 72 22 2c 20 | 22 61 70 72 22 2c 20 22 | "mar", |"apr", "|
|00003690| 6d 61 79 22 2c 20 22 6a | 75 6e 22 2c 0a 09 09 20 |may", "j|un",... |
|000036a0| 20 20 20 22 6a 75 6c 22 | 2c 20 22 61 75 67 22 2c | "jul"|, "aug",|
|000036b0| 20 22 73 65 70 22 2c 20 | 22 6f 63 74 22 2c 20 22 | "sep", |"oct", "|
|000036c0| 6e 6f 76 22 2c 20 22 64 | 65 63 22 2c 0a 09 7d 3b |nov", "d|ec",..};|
|000036d0| 0a 0a 23 64 65 66 69 6e | 65 20 53 4b 49 50 5f 46 |..#defin|e SKIP_F|
|000036e0| 49 45 4c 44 28 70 29 20 | 5c 0a 09 69 66 20 28 31 |IELD(p) |\..if (1|
|000036f0| 29 20 7b 77 68 69 6c 65 | 20 28 69 73 64 69 67 69 |) {while| (isdigi|
|00003700| 74 28 2a 70 29 29 20 70 | 2b 2b 3b 20 77 68 69 6c |t(*p)) p|++; whil|
|00003710| 65 20 28 2a 70 20 26 26 | 20 21 69 73 64 69 67 69 |e (*p &&| !isdigi|
|00003720| 74 28 2a 70 29 29 20 70 | 2b 2b 3b 7d 20 65 6c 73 |t(*p)) p|++;} els|
|00003730| 65 0a 0a 09 2f 2a 0a 09 | 20 2a 20 47 65 74 20 66 |e.../*..| * Get f|
|00003740| 69 72 73 74 20 66 69 65 | 6c 64 20 2d 20 63 61 6e |irst fie|ld - can|
|00003750| 20 62 65 20 65 69 74 68 | 65 72 20 22 79 65 61 72 | be eith|er "year|
|00003760| 22 2c 20 61 20 6d 6f 6e | 74 68 20 6e 61 6d 65 2c |", a mon|th name,|
|00003770| 20 6f 72 20 61 20 28 63 | 6f 6d 70 6c 65 74 65 29 | or a (c|omplete)|
|00003780| 0a 09 20 2a 20 6e 75 6d | 65 72 69 63 20 64 61 74 |.. * num|eric dat|
|00003790| 65 20 73 70 65 63 0a 20 | 20 20 20 20 20 20 20 20 |e spec. | |
|000037a0| 2a 2f 0a 09 63 70 20 3d | 20 73 74 72 74 6f 6b 28 |*/..cp =| strtok(|
|000037b0| 6c 62 75 66 2c 20 57 48 | 49 54 45 53 50 41 43 45 |lbuf, WH|ITESPACE|
|000037c0| 29 3b 0a 0a 09 77 68 69 | 6c 65 20 28 2a 63 70 29 |);...whi|le (*cp)|
|000037d0| 20 7b 0a 09 09 69 66 20 | 28 69 73 75 70 70 65 72 | {...if |(isupper|
|000037e0| 28 2a 63 70 29 29 0a 09 | 09 09 2a 63 70 20 3d 20 |(*cp))..|..*cp = |
|000037f0| 74 6f 6c 6f 77 65 72 28 | 2a 63 70 29 3b 0a 09 09 |tolower(|*cp);...|
|00003800| 63 70 2b 2b 3b 0a 09 7d | 0a 09 63 70 20 3d 20 6c |cp++;..}|..cp = l|
|00003810| 62 75 66 3b 0a 0a 09 2f | 2a 0a 09 20 2a 20 43 68 |buf;.../|*.. * Ch|
|00003820| 65 63 6b 20 66 6f 72 20 | 22 79 65 61 72 22 20 6c |eck for |"year" l|
|00003830| 69 6e 65 0a 09 20 2a 2f | 0a 09 69 66 20 28 73 74 |ine.. */|..if (st|
|00003840| 72 63 6d 70 28 63 70 2c | 20 22 79 65 61 72 22 29 |rcmp(cp,| "year")|
|00003850| 20 3d 3d 20 30 29 20 7b | 0a 09 09 63 70 20 3d 20 | == 0) {|...cp = |
|00003860| 73 74 72 74 6f 6b 28 4e | 55 4c 4c 2c 20 57 48 49 |strtok(N|ULL, WHI|
|00003870| 54 45 53 50 41 43 45 29 | 3b 0a 09 09 69 66 20 28 |TESPACE)|;...if (|
|00003880| 28 79 79 20 3d 20 61 74 | 6f 69 28 63 70 29 29 20 |(yy = at|oi(cp)) |
|00003890| 3e 20 30 29 20 7b 0a 09 | 09 09 69 66 20 28 79 79 |> 0) {..|..if (yy|
|000038a0| 20 3c 20 31 30 30 29 0a | 09 09 09 09 79 79 20 2b | < 100).|....yy +|
|000038b0| 3d 20 31 39 30 30 3b 0a | 09 09 09 63 75 72 72 5f |= 1900;.|...curr_|
|000038c0| 79 65 61 72 20 3d 20 79 | 79 3b 0a 09 09 7d 0a 09 |year = y|y;...}..|
|000038d0| 09 72 65 74 75 72 6e 28 | 30 29 3b 0a 09 7d 0a 0a |.return(|0);..}..|
|000038e0| 09 2f 2a 0a 09 20 2a 20 | 49 66 20 66 69 65 6c 64 |./*.. * |If field|
|000038f0| 20 62 65 67 69 6e 73 20 | 77 69 74 68 20 61 6c 70 | begins |with alp|
|00003900| 68 61 2c 20 74 72 79 20 | 74 6f 20 64 65 63 6f 64 |ha, try |to decod|
|00003910| 65 20 6d 6f 6e 74 68 20 | 6e 61 6d 65 0a 09 20 2a |e month |name.. *|
|00003920| 2f 0a 09 69 66 20 28 69 | 73 61 6c 70 68 61 28 2a |/..if (i|salpha(*|
|00003930| 63 70 29 29 20 7b 0a 09 | 09 2f 2a 20 61 72 65 20 |cp)) {..|./* are |
|00003940| 6d 6f 6e 74 68 20 61 6e | 64 20 79 65 61 72 20 74 |month an|d year t|
|00003950| 68 65 20 6f 6e 65 73 20 | 77 65 20 77 61 6e 74 3f |he ones |we want?|
|00003960| 20 2a 2f 0a 09 09 69 66 | 20 28 79 65 61 72 20 21 | */...if| (year !|
|00003970| 3d 20 63 75 72 72 5f 79 | 65 61 72 20 7c 7c 20 73 |= curr_y|ear || s|
|00003980| 74 72 6e 63 6d 70 28 63 | 70 2c 20 6d 6f 6e 74 68 |trncmp(c|p, month|
|00003990| 73 5b 6d 6f 6e 74 68 5d | 2c 20 33 29 20 21 3d 20 |s[month]|, 3) != |
|000039a0| 30 29 0a 09 09 09 72 65 | 74 75 72 6e 28 30 29 3b |0)....re|turn(0);|
|000039b0| 0a 0a 09 09 2f 2a 20 6d | 6f 6e 74 68 20 66 6f 75 |..../* m|onth fou|
|000039c0| 6e 64 2c 20 67 65 74 20 | 61 6e 64 20 76 61 6c 69 |nd, get |and vali|
|000039d0| 64 61 74 65 20 64 61 79 | 20 2a 2f 0a 0a 09 09 69 |date day| */....i|
|000039e0| 66 20 28 28 63 70 20 3d | 20 73 74 72 74 6f 6b 28 |f ((cp =| strtok(|
|000039f0| 4e 55 4c 4c 2c 20 57 48 | 49 54 45 53 50 41 43 45 |NULL, WH|ITESPACE|
|00003a00| 29 29 20 3d 3d 20 4e 55 | 4c 4c 20 7c 7c 20 0a 09 |)) == NU|LL || ..|
|00003a10| 09 20 20 20 20 21 69 73 | 5f 76 61 6c 69 64 28 6d |. !is|_valid(m|
|00003a20| 6f 6e 74 68 2c 20 64 64 | 20 3d 20 61 74 6f 69 28 |onth, dd| = atoi(|
|00003a30| 63 70 29 2c 20 79 65 61 | 72 29 29 0a 09 09 09 72 |cp), yea|r))....r|
|00003a40| 65 74 75 72 6e 28 30 29 | 3b 0a 0a 09 09 69 73 5f |eturn(0)|;....is_|
|00003a50| 68 6f 6c 69 64 61 79 20 | 3d 20 63 70 5b 73 74 72 |holiday |= cp[str|
|00003a60| 6c 65 6e 28 63 70 29 20 | 2d 20 31 5d 20 3d 3d 20 |len(cp) |- 1] == |
|00003a70| 27 2a 27 3b 09 2f 2a 20 | 6c 6f 6f 6b 20 66 6f 72 |'*';./* |look for|
|00003a80| 20 68 6f 6c 69 64 61 79 | 20 66 6c 61 67 20 2a 2f | holiday| flag */|
|00003a90| 0a 0a 09 09 69 66 20 28 | 6c 6f 61 64 77 6f 72 64 |....if (|loadword|
|00003aa0| 73 28 29 20 7c 7c 20 69 | 73 5f 68 6f 6c 69 64 61 |s() || i|s_holida|
|00003ab0| 79 29 0a 09 09 09 72 65 | 74 75 72 6e 28 64 64 20 |y)....re|turn(dd |
|00003ac0| 7c 20 69 73 5f 68 6f 6c | 69 64 61 79 20 2a 20 48 || is_hol|iday * H|
|00003ad0| 4f 4c 49 44 41 59 29 3b | 0a 09 09 72 65 74 75 72 |OLIDAY);|...retur|
|00003ae0| 6e 28 30 29 3b 0a 09 7d | 0a 0a 09 2f 2a 0a 09 20 |n(0);..}|.../*.. |
|00003af0| 2a 20 4e 6f 74 20 61 6c | 70 68 61 20 6d 6f 6e 74 |* Not al|pha mont|
|00003b00| 68 2c 20 74 72 79 20 6e | 75 6d 65 72 69 63 20 64 |h, try n|umeric d|
|00003b10| 61 74 65 20 28 70 61 72 | 73 65 20 63 6f 6d 70 6c |ate (par|se compl|
|00003b20| 65 74 65 6c 79 20 69 6e | 20 63 61 73 65 20 79 65 |etely in| case ye|
|00003b30| 61 72 0a 09 20 2a 20 68 | 61 73 20 63 68 61 6e 67 |ar.. * h|as chang|
|00003b40| 65 64 29 0a 09 20 2a 2f | 0a 0a 09 69 73 5f 68 6f |ed).. */|...is_ho|
|00003b50| 6c 69 64 61 79 20 3d 20 | 63 70 5b 73 74 72 6c 65 |liday = |cp[strle|
|00003b60| 6e 28 63 70 29 20 2d 20 | 31 5d 20 3d 3d 20 27 2a |n(cp) - |1] == '*|
|00003b70| 27 3b 09 2f 2a 20 6c 6f | 6f 6b 20 66 6f 72 20 68 |';./* lo|ok for h|
|00003b80| 6f 6c 69 64 61 79 20 66 | 6c 61 67 20 2a 2f 0a 20 |oliday f|lag */. |
|00003b90| 0a 09 2f 2a 20 67 65 74 | 20 6d 6f 6e 74 68 20 61 |../* get| month a|
|00003ba0| 6e 64 20 63 6f 6d 70 61 | 72 65 20 61 67 61 69 6e |nd compa|re again|
|00003bb0| 73 74 20 64 65 73 69 72 | 65 64 20 6d 6f 6e 74 68 |st desir|ed month|
|00003bc0| 20 2a 2f 0a 0a 09 76 61 | 6c 69 64 20 3d 20 28 6d | */...va|lid = (m|
|00003bd0| 6d 20 3d 20 61 74 6f 69 | 28 63 70 29 29 20 3d 3d |m = atoi|(cp)) ==|
|00003be0| 20 6d 6f 6e 74 68 3b 0a | 09 53 4b 49 50 5f 46 49 | month;.|.SKIP_FI|
|00003bf0| 45 4c 44 28 63 70 29 3b | 0a 0a 09 2f 2a 20 6e 6f |ELD(cp);|.../* no|
|00003c00| 77 20 67 65 74 20 61 6e | 64 20 76 61 6c 69 64 61 |w get an|d valida|
|00003c10| 74 65 20 64 61 79 20 2a | 2f 0a 0a 09 76 61 6c 69 |te day *|/...vali|
|00003c20| 64 20 26 3d 20 69 73 5f | 76 61 6c 69 64 28 6d 6f |d &= is_|valid(mo|
|00003c30| 6e 74 68 2c 20 64 64 20 | 3d 20 61 74 6f 69 28 63 |nth, dd |= atoi(c|
|00003c40| 70 29 2c 20 79 65 61 72 | 29 3b 0a 09 53 4b 49 50 |p), year|);..SKIP|
|00003c50| 5f 46 49 45 4c 44 28 63 | 70 29 3b 0a 0a 09 2f 2a |_FIELD(c|p);.../*|
|00003c60| 20 4e 75 6d 65 72 69 63 | 20 64 61 74 65 73 20 6d | Numeric| dates m|
|00003c70| 61 79 20 28 6f 72 20 6d | 61 79 20 6e 6f 74 29 20 |ay (or m|ay not) |
|00003c80| 68 61 76 65 20 61 20 79 | 65 61 72 20 2a 2f 0a 0a |have a y|ear */..|
|00003c90| 09 69 66 20 28 28 79 79 | 20 3d 20 61 74 6f 69 28 |.if ((yy| = atoi(|
|00003ca0| 63 70 29 29 20 3e 20 30 | 29 20 7b 0a 09 09 69 66 |cp)) > 0|) {...if|
|00003cb0| 20 28 79 79 20 3c 20 31 | 30 30 29 0a 09 09 09 79 | (yy < 1|00)....y|
|00003cc0| 79 20 2b 3d 20 31 39 30 | 30 3b 0a 09 09 63 75 72 |y += 190|0;...cur|
|00003cd0| 72 5f 79 65 61 72 20 3d | 20 79 79 3b 0a 09 7d 0a |r_year =| yy;..}.|
|00003ce0| 0a 09 76 61 6c 69 64 20 | 26 3d 20 63 75 72 72 5f |..valid |&= curr_|
|00003cf0| 79 65 61 72 20 3d 3d 20 | 79 65 61 72 3b 09 2f 2a |year == |year;./*|
|00003d00| 20 69 73 20 79 65 61 72 | 20 74 68 65 20 64 65 73 | is year| the des|
|00003d10| 69 72 65 64 20 6f 6e 65 | 3f 20 2a 2f 0a 0a 09 2f |ired one|? */.../|
|00003d20| 2a 20 69 66 20 64 61 74 | 65 20 69 73 20 76 61 6c |* if dat|e is val|
|00003d30| 69 64 20 61 6e 64 20 73 | 69 67 6e 69 66 69 63 61 |id and s|ignifica|
|00003d40| 6e 74 20 28 74 65 78 74 | 20 6f 72 20 68 6f 6c 69 |nt (text| or holi|
|00003d50| 64 61 79 20 66 6c 61 67 | 29 2c 20 72 65 74 75 72 |day flag|), retur|
|00003d60| 6e 20 69 74 20 2a 2f 0a | 0a 09 69 66 20 28 76 61 |n it */.|..if (va|
|00003d70| 6c 69 64 20 26 26 20 28 | 6c 6f 61 64 77 6f 72 64 |lid && (|loadword|
|00003d80| 73 28 29 20 7c 7c 20 69 | 73 5f 68 6f 6c 69 64 61 |s() || i|s_holida|
|00003d90| 79 29 29 0a 09 09 72 65 | 74 75 72 6e 28 64 64 20 |y))...re|turn(dd |
|00003da0| 7c 20 69 73 5f 68 6f 6c | 69 64 61 79 20 2a 20 48 || is_hol|iday * H|
|00003db0| 4f 4c 49 44 41 59 29 3b | 0a 09 72 65 74 75 72 6e |OLIDAY);|..return|
|00003dc0| 28 30 29 3b 0a 7d 0a 0a | 0c 0a 2f 2a 0a 20 2a 20 |(0);.}..|../*. * |
|00003dd0| 67 65 74 64 61 79 20 2d | 20 66 69 6e 64 20 6e 65 |getday -| find ne|
|00003de0| 78 74 20 64 61 79 20 65 | 6e 74 72 79 20 66 6f 72 |xt day e|ntry for|
|00003df0| 20 73 70 65 63 69 66 69 | 65 64 20 6d 6f 6e 74 68 | specifi|ed month|
|00003e00| 20 61 6e 64 20 79 65 61 | 72 20 69 6e 20 74 68 65 | and yea|r in the|
|00003e10| 20 64 61 74 65 20 66 69 | 6c 65 0a 20 2a 2f 0a 69 | date fi|le. */.i|
|00003e20| 6e 74 20 67 65 74 64 61 | 79 28 6d 6f 6e 74 68 2c |nt getda|y(month,|
|00003e30| 20 79 65 61 72 2c 20 72 | 65 73 65 74 29 0a 09 72 | year, r|eset)..r|
|00003e40| 65 67 69 73 74 65 72 20 | 69 6e 74 20 6d 6f 6e 74 |egister |int mont|
|00003e50| 68 2c 20 79 65 61 72 3b | 0a 09 69 6e 74 20 72 65 |h, year;|..int re|
|00003e60| 73 65 74 3b 09 09 2f 2a | 20 54 52 55 45 3a 20 72 |set;../*| TRUE: r|
|00003e70| 65 77 69 6e 64 20 64 61 | 74 65 20 66 69 6c 65 20 |ewind da|te file |
|00003e80| 2a 2f 0a 7b 0a 09 73 74 | 61 74 69 63 20 69 6e 74 |*/.{..st|atic int|
|00003e90| 20 65 6f 66 20 3d 20 46 | 41 4c 53 45 3b 0a 09 72 | eof = F|ALSE;..r|
|00003ea0| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 63 70 |egister |char *cp|
|00003eb0| 3b 0a 09 72 65 67 69 73 | 74 65 72 20 69 6e 74 20 |;..regis|ter int |
|00003ec0| 63 3b 0a 09 69 6e 74 20 | 64 61 79 3b 0a 09 69 6e |c;..int |day;..in|
|00003ed0| 74 20 69 6e 5f 63 6f 6d | 6d 65 6e 74 3b 09 09 2f |t in_com|ment;../|
|00003ee0| 2a 20 63 6f 6d 6d 65 6e | 74 73 3a 20 66 72 6f 6d |* commen|ts: from|
|00003ef0| 20 27 23 27 20 74 6f 20 | 65 6e 64 2d 6f 66 2d 6c | '#' to |end-of-l|
|00003f00| 69 6e 65 20 2a 2f 0a 0a | 09 69 66 20 28 64 66 70 |ine */..|.if (dfp|
|00003f10| 20 3d 3d 20 4e 55 4c 4c | 29 09 2f 2a 20 77 68 6f | == NULL|)./* who|
|00003f20| 6f 70 73 2c 20 6e 6f 20 | 64 61 74 65 20 66 69 6c |ops, no |date fil|
|00003f30| 65 20 2a 2f 0a 09 09 72 | 65 74 75 72 6e 28 30 29 |e */...r|eturn(0)|
|00003f40| 3b 0a 0a 09 69 66 20 28 | 72 65 73 65 74 29 20 7b |;...if (|reset) {|
|00003f50| 09 09 2f 2a 20 72 65 77 | 69 6e 64 20 66 69 6c 65 |../* rew|ind file|
|00003f60| 2c 20 72 65 73 65 74 20 | 64 65 66 61 75 6c 74 20 |, reset |default |
|00003f70| 79 65 61 72 2c 20 63 6c | 65 61 72 20 65 6f 66 20 |year, cl|ear eof |
|00003f80| 2a 2f 0a 09 09 72 65 77 | 69 6e 64 28 64 66 70 29 |*/...rew|ind(dfp)|
|00003f90| 3b 0a 09 09 63 75 72 72 | 5f 79 65 61 72 20 3d 20 |;...curr|_year = |
|00003fa0| 69 6e 69 74 5f 79 65 61 | 72 3b 0a 09 09 65 6f 66 |init_yea|r;...eof|
|00003fb0| 20 3d 20 46 41 4c 53 45 | 3b 0a 09 7d 0a 0a 09 69 | = FALSE|;..}...i|
|00003fc0| 66 20 28 65 6f 66 29 0a | 09 09 72 65 74 75 72 6e |f (eof).|..return|
|00003fd0| 28 30 29 3b 0a 0a 09 64 | 6f 20 7b 0a 09 09 63 70 |(0);...d|o {...cp|
|00003fe0| 20 3d 20 6c 62 75 66 3b | 0a 09 09 64 6f 20 7b 0a | = lbuf;|...do {.|
|00003ff0| 09 09 09 69 6e 5f 63 6f | 6d 6d 65 6e 74 20 3d 20 |...in_co|mment = |
|00004000| 46 41 4c 53 45 3b 0a 09 | 09 09 77 68 69 6c 65 20 |FALSE;..|..while |
|00004010| 28 28 63 20 3d 20 67 65 | 74 63 28 64 66 70 29 29 |((c = ge|tc(dfp))|
|00004020| 20 21 3d 20 27 5c 6e 27 | 20 26 26 20 63 20 21 3d | != '\n'| && c !=|
|00004030| 20 45 4f 46 29 20 7b 0a | 09 09 09 09 69 66 20 28 | EOF) {.|....if (|
|00004040| 63 20 3d 3d 20 27 23 27 | 29 0a 09 09 09 09 09 69 |c == '#'|)......i|
|00004050| 6e 5f 63 6f 6d 6d 65 6e | 74 20 3d 20 54 52 55 45 |n_commen|t = TRUE|
|00004060| 3b 0a 09 09 09 09 2f 2a | 20 69 67 6e 6f 72 65 20 |;...../*| ignore |
|00004070| 63 6f 6d 6d 65 6e 74 73 | 20 61 6e 64 20 6c 65 61 |comments| and lea|
|00004080| 64 69 6e 67 20 77 68 69 | 74 65 20 73 70 61 63 65 |ding whi|te space|
|00004090| 20 2a 2f 0a 09 09 09 09 | 69 66 20 28 69 6e 5f 63 | */.....|if (in_c|
|000040a0| 6f 6d 6d 65 6e 74 20 7c | 7c 0a 09 09 09 09 20 20 |omment |||..... |
|000040b0| 20 20 28 63 70 20 3d 3d | 20 6c 62 75 66 20 26 26 | (cp ==| lbuf &&|
|000040c0| 20 28 63 20 3d 3d 20 27 | 20 27 20 7c 7c 20 63 20 | (c == '| ' || c |
|000040d0| 3d 3d 20 27 5c 74 27 29 | 29 29 0a 09 09 09 09 09 |== '\t')|))......|
|000040e0| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 09 09 09 2a 63 |continue|;.....*c|
|000040f0| 70 2b 2b 20 3d 20 63 3b | 0a 09 09 09 7d 0a 09 09 |p++ = c;|....}...|
|00004100| 09 69 66 20 28 63 20 3d | 3d 20 45 4f 46 29 20 7b |.if (c =|= EOF) {|
|00004110| 0a 09 09 09 09 65 6f 66 | 20 3d 20 54 52 55 45 3b |.....eof| = TRUE;|
|00004120| 0a 09 09 09 09 72 65 74 | 75 72 6e 28 30 29 3b 0a |.....ret|urn(0);.|
|00004130| 09 09 09 7d 0a 09 09 7d | 20 77 68 69 6c 65 20 28 |...}...}| while (|
|00004140| 63 70 20 3d 3d 20 6c 62 | 75 66 29 3b 09 2f 2a 20 |cp == lb|uf);./* |
|00004150| 69 67 6e 6f 72 65 20 65 | 6d 70 74 79 20 6c 69 6e |ignore e|mpty lin|
|00004160| 65 73 20 2a 2f 0a 0a 09 | 09 2a 63 70 20 3d 20 27 |es */...|.*cp = '|
|00004170| 5c 30 27 3b 0a 0a 09 2f | 2a 20 65 78 61 6d 69 6e |\0';.../|* examin|
|00004180| 65 20 74 68 65 20 6c 69 | 6e 65 2c 20 73 65 65 20 |e the li|ne, see |
|00004190| 69 66 20 69 74 73 20 6f | 6e 65 20 77 65 20 77 61 |if its o|ne we wa|
|000041a0| 6e 74 20 2a 2f 0a 09 7d | 20 77 68 69 6c 65 20 28 |nt */..}| while (|
|000041b0| 20 28 64 61 79 20 3d 20 | 70 61 72 73 65 28 6d 6f | (day = |parse(mo|
|000041c0| 6e 74 68 2c 20 79 65 61 | 72 29 29 20 3d 3d 20 30 |nth, yea|r)) == 0|
|000041d0| 29 3b 0a 0a 09 72 65 74 | 75 72 6e 28 64 61 79 29 |);...ret|urn(day)|
|000041e0| 3b 0a 7d 0a 0c 0a 2f 2a | 0a 20 2a 20 42 72 6f 77 |;.}.../*|. * Brow|
|000041f0| 73 65 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 64 |se throu|gh the d|
|00004200| 61 74 65 20 66 69 6c 65 | 20 6c 6f 6f 6b 69 6e 67 |ate file| looking|
|00004210| 20 66 6f 72 20 64 61 79 | 20 74 65 78 74 20 69 6e | for day| text in|
|00004220| 20 73 70 65 63 69 66 69 | 65 64 20 6d 6f 6e 74 68 | specifi|ed month|
|00004230| 2f 79 65 61 72 0a 20 2a | 2f 0a 66 69 6e 64 5f 64 |/year. *|/.find_d|
|00004240| 61 79 74 65 78 74 28 6d | 6f 6e 74 68 2c 20 79 65 |aytext(m|onth, ye|
|00004250| 61 72 29 0a 09 69 6e 74 | 20 6d 6f 6e 74 68 2c 20 |ar)..int| month, |
|00004260| 79 65 61 72 3b 0a 7b 0a | 09 72 65 67 69 73 74 65 |year;.{.|.registe|
|00004270| 72 20 63 68 61 72 20 2a | 2a 73 3b 0a 09 72 65 67 |r char *|*s;..reg|
|00004280| 69 73 74 65 72 20 69 6e | 74 20 6f 6c 64 64 61 79 |ister in|t oldday|
|00004290| 20 3d 20 2d 31 3b 0a 09 | 72 65 67 69 73 74 65 72 | = -1;..|register|
|000042a0| 20 69 6e 74 20 64 61 79 | 3b 0a 0a 09 66 6f 72 20 | int day|;...for |
|000042b0| 28 64 61 79 20 3d 20 67 | 65 74 64 61 79 28 6d 6f |(day = g|etday(mo|
|000042c0| 6e 74 68 2c 20 79 65 61 | 72 2c 20 54 52 55 45 29 |nth, yea|r, TRUE)|
|000042d0| 3b 0a 09 20 20 20 20 20 | 64 61 79 20 21 3d 20 30 |;.. |day != 0|
|000042e0| 3b 0a 09 20 20 20 20 20 | 64 61 79 20 3d 20 67 65 |;.. |day = ge|
|000042f0| 74 64 61 79 28 6d 6f 6e | 74 68 2c 20 79 65 61 72 |tday(mon|th, year|
|00004300| 2c 20 46 41 4c 53 45 29 | 29 0a 09 09 69 66 20 28 |, FALSE)|)...if (|
|00004310| 2a 77 6f 72 64 73 29 20 | 7b 0a 09 09 09 64 61 79 |*words) |{....day|
|00004320| 20 26 3d 20 7e 48 4f 4c | 49 44 41 59 3b 0a 09 09 | &= ~HOL|IDAY;...|
|00004330| 09 69 66 20 28 64 61 79 | 20 21 3d 20 6f 6c 64 64 |.if (day| != oldd|
|00004340| 61 79 29 20 7b 0a 09 09 | 09 09 69 66 20 28 6f 6c |ay) {...|..if (ol|
|00004350| 64 64 61 79 20 21 3d 20 | 2d 31 29 0a 09 09 09 09 |dday != |-1).....|
|00004360| 09 50 52 54 28 22 5d 20 | 64 61 79 74 65 78 74 5c |.PRT("] |daytext\|
|00004370| 6e 22 29 3b 0a 09 09 09 | 09 50 52 54 28 22 25 64 |n");....|.PRT("%d|
|00004380| 20 5b 20 5c 6e 22 2c 20 | 64 61 79 29 3b 0a 09 09 | [ \n", |day);...|
|00004390| 09 09 6f 6c 64 64 61 79 | 20 3d 20 64 61 79 3b 0a |..oldday| = day;.|
|000043a0| 09 09 09 7d 20 65 6c 73 | 65 0a 09 09 09 09 50 52 |...} els|e.....PR|
|000043b0| 54 28 22 28 2e 70 29 5c | 6e 22 29 3b 0a 09 09 09 |T("(.p)\|n");....|
|000043c0| 66 6f 72 20 28 73 20 3d | 20 77 6f 72 64 73 3b 20 |for (s =| words; |
|000043d0| 2a 73 3b 20 73 2b 2b 29 | 0a 09 09 09 09 50 52 54 |*s; s++)|.....PRT|
|000043e0| 28 22 28 25 73 29 5c 6e | 22 2c 20 2a 73 29 3b 0a |("(%s)\n|", *s);.|
|000043f0| 09 09 7d 0a 0a 09 69 66 | 20 28 6f 6c 64 64 61 79 |..}...if| (oldday|
|00004400| 20 21 3d 20 2d 31 29 09 | 2f 2a 20 74 65 72 6d 69 | != -1).|/* termi|
|00004410| 6e 61 74 65 20 6c 61 73 | 74 20 63 61 6c 6c 20 74 |nate las|t call t|
|00004420| 6f 20 64 61 79 74 65 78 | 74 20 28 69 66 20 61 6e |o daytex|t (if an|
|00004430| 79 29 20 2a 2f 0a 09 09 | 50 52 54 28 22 5d 20 64 |y) */...|PRT("] d|
|00004440| 61 79 74 65 78 74 5c 6e | 22 29 3b 0a 7d 0a 0a 0c |aytext\n|");.}...|
|00004450| 0a 2f 2a 0a 20 2a 20 42 | 72 6f 77 73 65 20 74 68 |./*. * B|rowse th|
|00004460| 72 6f 75 67 68 20 74 68 | 65 20 64 61 74 65 20 66 |rough th|e date f|
|00004470| 69 6c 65 20 6c 6f 6f 6b | 69 6e 67 20 66 6f 72 20 |ile look|ing for |
|00004480| 68 6f 6c 69 64 61 79 73 | 20 69 6e 20 73 70 65 63 |holidays| in spec|
|00004490| 69 66 69 65 64 20 6d 6f | 6e 74 68 2f 79 65 61 72 |ified mo|nth/year|
|000044a0| 0a 20 2a 2f 0a 66 69 6e | 64 5f 68 6f 6c 69 64 61 |. */.fin|d_holida|
|000044b0| 79 73 28 6d 6f 6e 74 68 | 2c 20 79 65 61 72 29 0a |ys(month|, year).|
|000044c0| 09 69 6e 74 20 6d 6f 6e | 74 68 2c 20 79 65 61 72 |.int mon|th, year|
|000044d0| 3b 0a 7b 0a 09 72 65 67 | 69 73 74 65 72 20 69 6e |;.{..reg|ister in|
|000044e0| 74 20 64 61 79 3b 0a 09 | 75 6e 73 69 67 6e 65 64 |t day;..|unsigned|
|000044f0| 20 6c 6f 6e 67 20 68 6f | 6c 69 64 61 79 73 20 3d | long ho|lidays =|
|00004500| 20 30 3b 0a 0a 09 2f 2a | 20 67 65 74 20 75 6e 69 | 0;.../*| get uni|
|00004510| 71 75 65 2c 20 73 6f 72 | 74 65 64 20 6c 69 73 74 |que, sor|ted list|
|00004520| 20 6f 66 20 68 6f 6c 69 | 64 61 79 73 20 62 79 20 | of holi|days by |
|00004530| 73 65 74 74 69 6e 67 20 | 62 69 74 73 20 69 6e 20 |setting |bits in |
|00004540| 66 6c 61 67 20 77 6f 72 | 64 20 2a 2f 0a 0a 09 66 |flag wor|d */...f|
|00004550| 6f 72 20 28 64 61 79 20 | 3d 20 67 65 74 64 61 79 |or (day |= getday|
|00004560| 28 6d 6f 6e 74 68 2c 20 | 79 65 61 72 2c 20 54 52 |(month, |year, TR|
|00004570| 55 45 29 3b 0a 09 20 20 | 20 20 20 64 61 79 20 21 |UE);.. | day !|
|00004580| 3d 20 30 3b 0a 09 20 20 | 20 20 20 64 61 79 20 3d |= 0;.. | day =|
|00004590| 20 67 65 74 64 61 79 28 | 6d 6f 6e 74 68 2c 20 79 | getday(|month, y|
|000045a0| 65 61 72 2c 20 46 41 4c | 53 45 29 29 0a 09 09 69 |ear, FAL|SE))...i|
|000045b0| 66 20 28 64 61 79 20 26 | 20 48 4f 4c 49 44 41 59 |f (day &| HOLIDAY|
|000045c0| 29 0a 09 09 09 68 6f 6c | 69 64 61 79 73 20 7c 3d |)....hol|idays |=|
|000045d0| 20 31 20 3c 3c 20 28 64 | 61 79 20 26 20 7e 48 4f | 1 << (d|ay & ~HO|
|000045e0| 4c 49 44 41 59 29 3b 0a | 0a 09 50 52 54 28 22 2f |LIDAY);.|..PRT("/|
|000045f0| 68 6f 6c 69 64 61 79 73 | 20 5b 22 29 3b 09 2f 2a |holidays| [");./*|
|00004600| 20 73 74 61 72 74 20 64 | 65 66 69 6e 69 74 69 6f | start d|efinitio|
|00004610| 6e 20 6f 66 20 6c 69 73 | 74 20 2a 2f 0a 09 66 6f |n of lis|t */..fo|
|00004620| 72 20 28 64 61 79 20 3d | 20 31 3b 20 64 61 79 20 |r (day =| 1; day |
|00004630| 3c 3d 20 33 31 3b 20 64 | 61 79 2b 2b 29 0a 09 09 |<= 31; d|ay++)...|
|00004640| 69 66 20 28 68 6f 6c 69 | 64 61 79 73 20 26 20 28 |if (holi|days & (|
|00004650| 31 20 3c 3c 20 64 61 79 | 29 29 0a 09 09 09 50 52 |1 << day|))....PR|
|00004660| 54 28 22 20 25 64 22 2c | 20 64 61 79 29 3b 0a 09 |T(" %d",| day);..|
|00004670| 50 52 54 28 22 20 39 39 | 20 5d 20 64 65 66 5c 6e |PRT(" 99| ] def\n|
|00004680| 22 29 3b 09 2f 2a 20 74 | 65 72 6d 69 6e 61 74 65 |");./* t|erminate|
|00004690| 20 77 69 74 68 20 64 75 | 6d 6d 79 20 65 6e 74 72 | with du|mmy entr|
|000046a0| 79 20 2a 2f 0a 7d 0a 0a | 0c 0a 2f 2a 0a 20 2a 20 |y */.}..|../*. * |
|000046b0| 70 6d 6f 6e 74 68 20 2d | 20 67 65 6e 65 72 61 74 |pmonth -| generat|
|000046c0| 65 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 73 |e calend|ar for s|
|000046d0| 70 65 63 69 66 69 65 64 | 20 6d 6f 6e 74 68 2f 79 |pecified| month/y|
|000046e0| 65 61 72 0a 20 2a 2f 0a | 70 6d 6f 6e 74 68 28 6d |ear. */.|pmonth(m|
|000046f0| 6f 6e 74 68 2c 20 79 65 | 61 72 29 0a 09 69 6e 74 |onth, ye|ar)..int|
|00004700| 20 6d 6f 6e 74 68 2c 20 | 79 65 61 72 3b 0a 7b 0a | month, |year;.{.|
|00004710| 0a 09 50 52 54 28 22 2f | 79 65 61 72 20 25 64 20 |..PRT("/|year %d |
|00004720| 64 65 66 5c 6e 22 2c 20 | 79 65 61 72 29 3b 09 2f |def\n", |year);./|
|00004730| 2a 20 73 65 74 20 75 70 | 20 79 65 61 72 20 61 6e |* set up| year an|
|00004740| 64 20 6d 6f 6e 74 68 20 | 2a 2f 0a 09 50 52 54 28 |d month |*/..PRT(|
|00004750| 22 2f 6d 6f 6e 74 68 20 | 25 64 20 64 65 66 5c 6e |"/month |%d def\n|
|00004760| 22 2c 20 6d 6f 6e 74 68 | 29 3b 0a 09 66 69 6e 64 |", month|);..find|
|00004770| 5f 68 6f 6c 69 64 61 79 | 73 28 6d 6f 6e 74 68 2c |_holiday|s(month,|
|00004780| 20 79 65 61 72 29 3b 09 | 2f 2a 20 66 69 72 73 74 | year);.|/* first|
|00004790| 20 70 61 73 73 20 2d 20 | 6d 61 6b 65 20 6c 69 73 | pass - |make lis|
|000047a0| 74 20 6f 66 20 68 6f 6c | 69 64 61 79 73 20 2a 2f |t of hol|idays */|
|000047b0| 0a 09 50 52 54 28 22 70 | 72 69 6e 74 6d 6f 6e 74 |..PRT("p|rintmont|
|000047c0| 68 5c 6e 22 29 3b 0a 09 | 66 69 6e 64 5f 64 61 79 |h\n");..|find_day|
|000047d0| 74 65 78 74 28 6d 6f 6e | 74 68 2c 20 79 65 61 72 |text(mon|th, year|
|000047e0| 29 3b 09 2f 2a 20 73 65 | 63 6f 6e 64 20 70 61 73 |);./* se|cond pas|
|000047f0| 73 20 2d 20 61 64 64 20 | 74 65 78 74 20 74 6f 20 |s - add |text to |
|00004800| 62 6f 78 65 73 20 2a 2f | 0a 09 50 52 54 28 22 73 |boxes */|..PRT("s|
|00004810| 68 6f 77 70 61 67 65 5c | 6e 22 29 3b 0a 7d 0a 53 |howpage\|n");.}.S|
|00004820| 48 41 52 5f 45 4f 46 0a | 66 69 0a 69 66 20 74 65 |HAR_EOF.|fi.if te|
|00004830| 73 74 20 2d 66 20 27 63 | 61 6c 65 6e 64 61 72 27 |st -f 'c|alendar'|
|00004840| 0a 74 68 65 6e 0a 09 65 | 63 68 6f 20 73 68 61 72 |.then..e|cho shar|
|00004850| 3a 20 77 69 6c 6c 20 6e | 6f 74 20 6f 76 65 72 2d |: will n|ot over-|
|00004860| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 20 66 |write ex|isting f|
|00004870| 69 6c 65 20 27 63 61 6c | 65 6e 64 61 72 27 0a 65 |ile 'cal|endar'.e|
|00004880| 6c 73 65 0a 63 61 74 20 | 3c 3c 20 5c 53 48 41 52 |lse.cat |<< \SHAR|
|00004890| 5f 45 4f 46 20 3e 20 27 | 63 61 6c 65 6e 64 61 72 |_EOF > '|calendar|
|000048a0| 27 0a 23 20 53 61 6d 70 | 6c 65 20 63 61 6c 65 6e |'.# Samp|le calen|
|000048b0| 64 61 72 20 66 69 6c 65 | 20 66 6f 72 20 70 63 61 |dar file| for pca|
|000048c0| 6c 0a 23 0a 23 20 54 68 | 69 73 20 73 68 6f 75 6c |l.#.# Th|is shoul|
|000048d0| 64 20 62 65 20 7e 2f 63 | 61 6c 65 6e 64 61 72 20 |d be ~/c|alendar |
|000048e0| 6f 6e 20 55 6e 69 78 2c | 20 53 59 53 24 4c 4f 47 |on Unix,| SYS$LOG|
|000048f0| 49 4e 3a 43 41 4c 45 4e | 44 41 52 2e 44 41 54 20 |IN:CALEN|DAR.DAT |
|00004900| 6f 6e 20 56 4d 53 0a 23 | 0a 23 20 56 61 6c 69 64 |on VMS.#|.# Valid|
|00004910| 20 65 6e 74 72 69 65 73 | 20 61 72 65 20 6f 66 20 | entries| are of |
|00004920| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 66 6f |the foll|owing fo|
|00004930| 72 6d 73 3a 0a 23 0a 23 | 09 79 65 61 72 20 3c 79 |rms:.#.#|.year <y|
|00004940| 65 61 72 3e 0a 23 09 3c | 6d 6f 6e 74 68 5f 6e 61 |ear>.#.<|month_na|
|00004950| 6d 65 3e 20 3c 64 61 79 | 3e 7b 2a 7d 20 7b 3c 74 |me> <day|>{*} {<t|
|00004960| 65 78 74 3e 7d 0a 23 09 | 3c 6d 6f 6e 74 68 3e 3c |ext>}.#.|<month><|
|00004970| 73 65 70 3e 3c 64 61 79 | 3e 7b 3c 73 65 70 3e 3c |sep><day|>{<sep><|
|00004980| 79 65 61 72 3e 7d 7b 2a | 7d 20 7b 3c 74 65 78 74 |year>}{*|} {<text|
|00004990| 3e 7d 0a 23 0a 23 20 77 | 68 65 72 65 3a 0a 23 09 |>}.#.# w|here:.#.|
|000049a0| 3c 6d 6f 6e 74 68 5f 6e | 61 6d 65 3e 20 3a 3d 20 |<month_n|ame> := |
|000049b0| 66 69 72 73 74 20 33 2b | 20 63 68 61 72 61 63 74 |first 3+| charact|
|000049c0| 65 72 73 20 6f 66 20 6e | 61 6d 65 20 6f 66 20 6d |ers of n|ame of m|
|000049d0| 6f 6e 74 68 20 28 69 6e | 20 45 6e 67 6c 69 73 68 |onth (in| English|
|000049e0| 29 0a 23 09 3c 73 65 70 | 3e 20 3a 3d 20 6f 6e 65 |).#.<sep|> := one|
|000049f0| 20 6f 72 20 6d 6f 72 65 | 20 6e 6f 6e 2d 6e 75 6d | or more| non-num|
|00004a00| 65 72 69 63 2c 20 6e 6f | 6e 2d 73 70 61 63 65 2c |eric, no|n-space,|
|00004a10| 20 6e 6f 6e 2d 27 2a 27 | 20 63 68 61 72 61 63 74 | non-'*'| charact|
|00004a20| 65 72 73 0a 23 09 3c 74 | 65 78 74 3e 20 69 73 20 |ers.#.<t|ext> is |
|00004a30| 74 68 65 20 74 65 78 74 | 20 74 6f 20 62 65 20 70 |the text| to be p|
|00004a40| 72 69 6e 74 65 64 20 69 | 6e 20 74 68 65 20 63 61 |rinted i|n the ca|
|00004a50| 6c 65 6e 64 61 72 20 62 | 6f 78 0a 23 09 3c 64 61 |lendar b|ox.#.<da|
|00004a60| 79 3e 2c 20 3c 6d 6f 6e | 74 68 3e 2c 20 61 6e 64 |y>, <mon|th>, and|
|00004a70| 20 3c 79 65 61 72 3e 20 | 61 72 65 20 61 70 70 72 | <year> |are appr|
|00004a80| 6f 70 72 69 61 74 65 20 | 69 6e 74 65 67 65 72 73 |opriate |integers|
|00004a90| 0a 23 0a 23 09 77 68 69 | 74 65 73 70 61 63 65 20 |.#.#.whi|tespace |
|00004aa0| 69 73 20 74 6f 20 62 65 | 20 75 73 65 64 2f 61 76 |is to be| used/av|
|00004ab0| 6f 69 64 65 64 20 61 73 | 20 69 6d 70 6c 69 65 64 |oided as| implied|
|00004ac0| 20 62 79 20 74 68 65 20 | 61 62 6f 76 65 20 70 72 | by the |above pr|
|00004ad0| 6f 64 75 63 74 69 6f 6e | 73 0a 23 09 27 2a 27 20 |oduction|s.#.'*' |
|00004ae0| 66 6c 61 67 73 20 74 68 | 65 20 64 61 74 65 20 61 |flags th|e date a|
|00004af0| 73 20 61 20 68 6f 6c 69 | 64 61 79 20 28 74 6f 20 |s a holi|day (to |
|00004b00| 62 65 20 70 72 69 6e 74 | 65 64 20 69 6e 20 67 72 |be print|ed in gr|
|00004b10| 61 79 29 0a 23 09 63 6f | 6d 6d 65 6e 74 73 20 72 |ay).#.co|mments r|
|00004b20| 75 6e 20 66 72 6f 6d 20 | 27 23 27 20 74 68 72 6f |un from |'#' thro|
|00004b30| 75 67 68 20 65 6e 64 2d | 6f 66 2d 6c 69 6e 65 0a |ugh end-|of-line.|
|00004b40| 0a 79 65 61 72 20 31 39 | 39 30 09 09 09 09 23 20 |.year 19|90....# |
|00004b50| 73 65 74 20 79 65 61 72 | 20 65 78 70 6c 69 63 69 |set year| explici|
|00004b60| 74 6c 79 0a 0a 35 2f 32 | 38 2a 20 4d 65 6d 6f 72 |tly..5/2|8* Memor|
|00004b70| 69 61 6c 20 44 61 79 20 | 28 6f 62 73 65 72 76 65 |ial Day |(observe|
|00004b80| 64 29 09 09 23 20 27 2a | 27 20 70 72 69 6e 74 73 |d)..# '*|' prints|
|00004b90| 20 68 6f 6c 69 64 61 79 | 20 69 6e 20 67 72 61 79 | holiday| in gray|
|00004ba0| 0a 35 2f 33 31 20 4d 65 | 6d 6f 72 69 61 6c 20 44 |.5/31 Me|morial D|
|00004bb0| 61 79 0a 0a 37 2f 34 2f | 39 30 2a 20 49 6e 64 65 |ay..7/4/|90* Inde|
|00004bc0| 70 65 6e 64 65 6e 63 65 | 20 44 61 79 09 09 23 20 |pendence| Day..# |
|00004bd0| 66 75 6c 6c 20 64 61 74 | 65 20 66 6f 72 6d 61 74 |full dat|e format|
|00004be0| 0a 37 2f 31 35 20 46 69 | 72 73 74 20 6c 69 6e 65 |.7/15 Fi|rst line|
|00004bf0| 20 6f 66 20 74 65 78 74 | 0a 37 2f 31 35 20 53 65 | of text|.7/15 Se|
|00004c00| 63 6f 6e 64 20 6c 69 6e | 65 20 6f 66 20 74 65 78 |cond lin|e of tex|
|00004c10| 74 0a 0a 53 65 70 20 33 | 2a 20 4c 61 62 6f 72 20 |t..Sep 3|* Labor |
|00004c20| 44 61 79 09 09 09 23 20 | 6d 6f 6e 74 68 20 77 72 |Day...# |month wr|
|00004c30| 69 74 74 65 6e 20 6f 75 | 74 0a 0a 31 30 2f 38 2a |itten ou|t..10/8*|
|00004c40| 20 43 6f 6c 75 6d 62 75 | 73 20 44 61 79 20 28 6f | Columbu|s Day (o|
|00004c50| 62 73 65 72 76 65 64 29 | 0a 31 30 2f 31 32 20 43 |bserved)|.10/12 C|
|00004c60| 6f 6c 75 6d 62 75 73 20 | 44 61 79 0a 0a 31 31 2f |olumbus |Day..11/|
|00004c70| 32 32 2a 20 54 68 61 6e | 6b 73 67 69 76 69 6e 67 |22* Than|ksgiving|
|00004c80| 0a 31 31 2f 32 33 2a 09 | 09 09 09 09 23 20 68 6f |.11/23*.|....# ho|
|00004c90| 6c 69 64 61 79 20 77 69 | 74 68 6f 75 74 20 74 65 |liday wi|thout te|
|00004ca0| 78 74 0a 0a 31 32 2f 32 | 34 2a 20 43 68 72 69 73 |xt..12/2|4* Chris|
|00004cb0| 74 6d 61 73 0a 31 32 2f | 32 35 2a 0a 0a 31 2f 31 |tmas.12/|25*..1/1|
|00004cc0| 2f 39 31 2a 20 4e 65 77 | 20 59 65 61 72 27 73 20 |/91* New| Year's |
|00004cd0| 44 61 79 09 09 09 23 20 | 73 65 74 20 6e 65 77 20 |Day...# |set new |
|00004ce0| 79 65 61 72 20 69 6d 70 | 6c 69 63 69 74 6c 79 0a |year imp|licitly.|
|00004cf0| 53 48 41 52 5f 45 4f 46 | 0a 66 69 0a 65 78 69 74 |SHAR_EOF|.fi.exit|
|00004d00| 20 30 0a 23 09 45 6e 64 | 20 6f 66 20 73 68 65 6c | 0.#.End| of shel|
|00004d10| 6c 20 61 72 63 68 69 76 | 65 0a |l archiv|e. |
+--------+-------------------------+-------------------------+--------+--------+