home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: Tape Archive
(archive/tar).
You can browse this item here: calen.tar
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Tape Archive (archive/tar)
| magic
| Supported |
100%
| file
| tar archive
| default
| |
99%
| file
| tar archive (V7), file calen/, mode 755 , uid 243 , gid 13 , size 0 , seconds 4413473426
| default
| |
98%
| file
| data
| default
| |
100%
| TrID
| Sybase iAnywhere database files
| default (weak)
| |
100%
| siegfried
| x-fmt/265 Tape Archive Format
| default
| |
100%
| lsar
| Tar
| default
| |
100%
| gt2
| TAR Archiv gefunden (Auflistung ist deaktiviert)
| default
| |
100%
| disktype
| Pre-POSIX tar archive
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 63 61 6c 65 6e 2f 00 00 | 00 00 00 00 00 00 00 00 |calen/..|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 20 32 |.... 7|55 . 2|
|00000070| 34 33 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |43 . |13 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 34 34 31 33 34 37 33 | 0 | 4413473|
|00000090| 34 32 36 20 20 20 35 31 | 30 36 00 20 00 00 00 00 |426 51|06. ....|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 63 61 6c 65 6e 2f 53 68 | 61 72 46 69 6c 65 2e 48 |calen/Sh|arFile.H|
|00000210| 65 61 64 65 72 73 00 00 | 00 00 00 00 00 00 00 00 |eaders..|........|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000270| 34 33 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |43 . |13 . |
|00000280| 20 20 20 32 35 36 37 20 | 20 34 34 31 33 34 37 33 | 2567 | 4413473|
|00000290| 34 34 30 20 20 31 30 31 | 37 33 00 20 00 00 00 00 |440 101|73. ....|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 3d 3d 3d 20 63 61 6c 65 | 6e 2e 73 68 61 72 20 3d |=== cale|n.shar =|
|00000410| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000420| 3d 3d 3d 3d 3d 3d 3d 3d | 0a 46 72 6f 6d 20 72 69 |========|.From ri|
|00000430| 61 63 73 21 65 6f 73 21 | 61 6d 65 73 21 68 63 21 |acs!eos!|ames!hc!|
|00000440| 6c 6c 6c 2d 77 69 6e 6b | 65 6e 21 75 75 6e 65 74 |lll-wink|en!uunet|
|00000450| 21 61 6c 6c 62 65 72 79 | 20 4d 6f 6e 20 4d 61 72 |!allbery| Mon Mar|
|00000460| 20 32 37 20 30 39 3a 33 | 39 3a 32 33 20 50 53 54 | 27 09:3|9:23 PST|
|00000470| 20 31 39 38 39 0a 0a 50 | 6f 73 74 69 6e 67 2d 6e | 1989..P|osting-n|
|00000480| 75 6d 62 65 72 3a 20 56 | 6f 6c 75 6d 65 20 36 2c |umber: V|olume 6,|
|00000490| 20 49 73 73 75 65 20 38 | 31 0a 53 75 62 6d 69 74 | Issue 8|1.Submit|
|000004a0| 74 65 64 2d 62 79 3a 20 | 61 77 72 40 67 65 6e 72 |ted-by: |awr@genr|
|000004b0| 61 64 2e 43 4f 4d 20 28 | 41 6e 64 72 65 77 20 57 |ad.COM (|Andrew W|
|000004c0| 2e 20 52 6f 67 65 72 73 | 29 0a 41 72 63 68 69 76 |. Rogers|).Archiv|
|000004d0| 65 2d 6e 61 6d 65 3a 20 | 63 61 6c 65 6e 0a 0a 48 |e-name: |calen..H|
|000004e0| 65 72 65 27 73 20 61 6e | 6f 74 68 65 72 20 63 61 |ere's an|other ca|
|000004f0| 6c 65 6e 64 61 72 20 70 | 72 6f 67 72 61 6d 20 77 |lendar p|rogram w|
|00000500| 68 69 63 68 20 49 20 74 | 68 69 6e 6b 20 69 73 20 |hich I t|hink is |
|00000510| 63 6f 6e 73 69 64 65 72 | 61 62 6c 79 20 6d 6f 72 |consider|ably mor|
|00000520| 65 0a 75 73 65 66 75 6c | 20 74 68 61 6e 20 70 63 |e.useful| than pc|
|00000530| 61 6c 2e 20 20 46 6f 72 | 20 73 74 61 72 74 65 72 |al. For| starter|
|00000540| 73 2c 20 74 68 65 20 63 | 61 6c 65 6e 64 61 72 73 |s, the c|alendars|
|00000550| 20 72 65 61 6c 6c 79 20 | 64 6f 20 6f 63 63 75 70 | really |do occup|
|00000560| 79 20 61 20 66 75 6c 6c | 0a 6c 69 6e 65 2d 70 72 |y a full|.line-pr|
|00000570| 69 6e 74 65 72 20 70 61 | 67 65 3b 20 74 68 65 79 |inter pa|ge; they|
|00000580| 20 61 6c 73 6f 20 69 6e | 63 6c 75 64 65 20 73 6d | also in|clude sm|
|00000590| 61 6c 6c 20 63 61 6c 65 | 6e 64 61 72 73 20 66 6f |all cale|ndars fo|
|000005a0| 72 20 74 68 65 20 70 72 | 65 76 69 6f 75 73 0a 61 |r the pr|evious.a|
|000005b0| 6e 64 20 73 75 62 73 65 | 71 75 65 6e 74 20 6d 6f |nd subse|quent mo|
|000005c0| 6e 74 68 73 20 61 6c 6f | 6e 67 20 77 69 74 68 20 |nths alo|ng with |
|000005d0| 61 20 6d 6f 6e 74 68 2f | 79 65 61 72 20 68 65 61 |a month/|year hea|
|000005e0| 64 69 6e 67 20 69 6e 20 | 35 78 39 0a 64 6f 74 2d |ding in |5x9.dot-|
|000005f0| 6d 61 74 72 69 78 20 63 | 68 61 72 61 63 74 65 72 |matrix c|haracter|
|00000600| 73 2c 20 70 72 69 6e 74 | 65 64 20 77 69 74 68 20 |s, print|ed with |
|00000610| 6f 76 65 72 73 74 72 69 | 6b 65 73 20 28 6f 6e 20 |overstri|kes (on |
|00000620| 6c 69 6e 65 20 70 72 69 | 6e 74 65 72 73 0a 63 61 |line pri|nters.ca|
|00000630| 70 61 62 6c 65 20 6f 66 | 20 68 61 6e 64 6c 69 6e |pable of| handlin|
|00000640| 67 20 74 68 65 6d 29 2e | 20 20 4f 70 74 69 6f 6e |g them).| Option|
|00000650| 73 20 61 72 65 20 61 76 | 61 69 6c 61 62 6c 65 20 |s are av|ailable |
|00000660| 74 6f 20 73 65 6c 65 63 | 74 3a 0a 0a 09 31 29 20 |to selec|t:...1) |
|00000670| 72 69 67 68 74 2d 20 6f | 72 20 6c 65 66 74 2d 20 |right- o|r left- |
|00000680| 6a 75 73 74 69 66 69 63 | 61 74 69 6f 6e 20 6f 66 |justific|ation of|
|00000690| 20 74 68 65 20 64 61 74 | 65 73 20 77 69 74 68 69 | the dat|es withi|
|000006a0| 6e 20 74 68 65 20 62 6f | 78 65 73 0a 09 32 29 20 |n the bo|xes..2) |
|000006b0| 6d 69 78 65 64 2d 20 6f | 72 20 75 70 70 65 72 2d |mixed- o|r upper-|
|000006c0| 63 61 73 65 20 6e 61 6d | 65 73 20 6f 66 20 6d 6f |case nam|es of mo|
|000006d0| 6e 74 68 73 20 61 6e 64 | 20 64 61 79 73 0a 09 33 |nths and| days..3|
|000006e0| 29 20 6f 76 65 72 73 74 | 72 69 6b 65 20 73 65 71 |) overst|rike seq|
|000006f0| 75 65 6e 63 65 20 75 73 | 65 64 20 74 6f 20 70 72 |uence us|ed to pr|
|00000700| 69 6e 74 20 6d 6f 6e 74 | 68 2f 79 65 61 72 20 68 |int mont|h/year h|
|00000710| 65 61 64 69 6e 67 20 28 | 75 73 65 66 75 6c 20 66 |eading (|useful f|
|00000720| 6f 72 0a 09 20 20 20 70 | 72 69 6e 74 65 72 73 20 |or.. p|rinters |
|00000730| 77 68 69 63 68 20 64 6f | 20 6e 6f 74 20 73 75 70 |which do| not sup|
|00000740| 70 6f 72 74 20 6f 76 65 | 72 73 74 72 69 6b 65 73 |port ove|rstrikes|
|00000750| 2c 20 73 69 6e 63 65 20 | 61 20 73 69 6e 67 6c 65 |, since |a single|
|00000760| 20 63 68 61 72 61 63 74 | 65 72 0a 09 20 20 20 63 | charact|er.. c|
|00000770| 61 6e 20 62 65 20 73 70 | 65 63 69 66 69 65 64 20 |an be sp|ecified |
|00000780| 2d 20 74 72 79 20 22 2d | 6f 40 22 29 0a 09 34 29 |- try "-|o@")..4)|
|00000790| 20 6e 75 6d 62 65 72 20 | 6f 66 20 62 6c 61 6e 6b | number |of blank|
|000007a0| 20 6c 69 6e 65 73 20 61 | 74 20 74 6f 70 20 6f 66 | lines a|t top of|
|000007b0| 20 70 61 67 65 20 28 75 | 73 65 66 75 6c 20 74 6f | page (u|seful to|
|000007c0| 20 63 65 6e 74 65 72 20 | 63 61 6c 65 6e 64 61 72 | center |calendar|
|000007d0| 0a 09 20 20 20 76 65 72 | 74 69 63 61 6c 6c 79 20 |.. ver|tically |
|000007e0| 77 68 65 6e 20 6f 70 65 | 72 61 74 6f 72 73 20 61 |when ope|rators a|
|000007f0| 72 65 20 63 61 72 65 6c | 65 73 73 20 61 62 6f 75 |re carel|ess abou|
|00000800| 74 20 61 6c 69 67 6e 69 | 6e 67 20 70 61 70 65 72 |t aligni|ng paper|
|00000810| 29 0a 0a 49 20 77 72 6f | 74 65 20 74 68 69 73 20 |)..I wro|te this |
|00000820| 69 6e 20 47 45 20 54 69 | 6d 65 2d 53 68 61 72 69 |in GE Ti|me-Shari|
|00000830| 6e 67 20 46 4f 52 54 52 | 41 4e 20 77 68 65 6e 20 |ng FORTR|AN when |
|00000840| 49 20 77 61 73 20 61 20 | 74 65 65 6e 61 67 65 72 |I was a |teenager|
|00000850| 20 61 6e 64 20 68 61 76 | 65 0a 63 6f 6e 74 69 6e | and hav|e.contin|
|00000860| 75 65 64 20 74 6f 20 74 | 77 65 61 6b 20 69 74 20 |ued to t|weak it |
|00000870| 74 68 72 6f 75 67 68 20 | 74 68 65 20 79 65 61 72 |through |the year|
|00000880| 73 3b 20 66 6f 72 20 6d | 61 6e 79 20 79 65 61 72 |s; for m|any year|
|00000890| 73 20 49 20 75 73 65 64 | 20 69 74 20 61 73 0a 6d |s I used| it as.m|
|000008a0| 79 20 66 69 72 73 74 20 | 70 6f 73 74 2d 22 48 65 |y first |post-"He|
|000008b0| 6c 6c 6f 2c 20 77 6f 72 | 6c 64 21 22 20 70 72 6f |llo, wor|ld!" pro|
|000008c0| 67 72 61 6d 20 77 68 65 | 6e 20 6c 65 61 72 6e 69 |gram whe|n learni|
|000008d0| 6e 67 20 6e 65 77 20 6c | 61 6e 67 75 61 67 65 73 |ng new l|anguages|
|000008e0| 2c 20 61 6e 64 0a 6e 6f | 77 20 75 73 65 20 69 74 |, and.no|w use it|
|000008f0| 20 74 6f 20 74 65 73 74 | 20 74 68 65 20 63 6f 6d | to test| the com|
|00000900| 70 69 6c 65 72 73 20 49 | 20 77 72 69 74 65 2e 0a |pilers I| write..|
|00000910| 09 20 20 20 0a 48 61 76 | 65 20 66 75 6e 2e 2e 2e |. .Hav|e fun...|
|00000920| 0a 2d 2d 0a 41 6e 64 72 | 65 77 20 57 2e 20 52 6f |.--.Andr|ew W. Ro|
|00000930| 67 65 72 73 09 7b 64 65 | 63 76 61 78 2c 68 75 73 |gers.{de|cvax,hus|
|00000940| 63 36 2c 6d 69 74 2d 65 | 64 64 69 65 7d 21 67 65 |c6,mit-e|ddie}!ge|
|00000950| 6e 72 61 64 21 74 65 64 | 64 79 21 61 77 72 0a 09 |nrad!ted|dy!awr..|
|00000960| 09 09 61 77 72 40 74 65 | 64 64 79 2e 67 65 6e 72 |..awr@te|ddy.genr|
|00000970| 61 64 2e 63 6f 6d 0a 00 | 00 00 00 00 00 00 00 00 |ad.com..|........|
|00000980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a00| 63 61 6c 65 6e 2f 63 61 | 6c 65 6e 2e 63 00 00 00 |calen/ca|len.c...|
|00000a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000a70| 34 33 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |43 . |13 . |
|00000a80| 20 20 33 34 34 32 33 20 | 20 34 34 31 33 34 37 33 | 34423 | 4413473|
|00000a90| 34 33 33 20 20 20 36 34 | 34 35 00 20 00 00 00 00 |433 64|45. ....|
|00000aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c00| 2f 2a 0a 20 2a 09 43 61 | 6c 65 6e 64 61 72 20 70 |/*. *.Ca|lendar p|
|00000c10| 72 6f 67 72 61 6d 20 2d | 20 6f 6e 65 20 6d 6f 6e |rogram -| one mon|
|00000c20| 74 68 20 70 65 72 20 70 | 61 67 65 0a 20 2a 0a 20 |th per p|age. *. |
|00000c30| 2a 09 4f 72 69 67 69 6e | 61 6c 6c 79 20 77 72 69 |*.Origin|ally wri|
|00000c40| 74 74 65 6e 20 69 6e 20 | 46 4f 52 54 52 41 4e 2d |tten in |FORTRAN-|
|00000c50| 49 56 20 66 6f 72 20 47 | 45 20 54 69 6d 65 73 68 |IV for G|E Timesh|
|00000c60| 61 72 69 6e 67 2c 20 31 | 30 2f 36 35 0a 20 2a 09 |aring, 1|0/65. *.|
|00000c70| 52 65 2d 63 6f 64 65 64 | 20 69 6e 20 43 20 66 6f |Re-coded| in C fo|
|00000c80| 72 20 55 4e 49 58 2c 20 | 33 2f 38 33 0a 20 2a 0a |r UNIX, |3/83. *.|
|00000c90| 20 2a 09 41 75 74 68 6f | 72 3a 20 41 57 20 52 6f | *.Autho|r: AW Ro|
|00000ca0| 67 65 72 73 0a 20 2a 0a | 20 2a 09 50 61 72 61 6d |gers. *.| *.Param|
|00000cb0| 65 74 65 72 73 3a 0a 20 | 2a 0a 20 2a 09 09 63 61 |eters:. |*. *..ca|
|00000cc0| 6c 65 6e 20 79 79 09 09 | 67 65 6e 65 72 61 74 65 |len yy..|generate|
|00000cd0| 73 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 79 |s calend|ar for y|
|00000ce0| 65 61 72 20 79 79 0a 20 | 2a 0a 20 2a 09 09 63 61 |ear yy. |*. *..ca|
|00000cf0| 6c 65 6e 20 6d 6d 20 79 | 79 20 5b 6c 65 6e 5d 09 |len mm y|y [len].|
|00000d00| 67 65 6e 65 72 61 74 65 | 73 20 63 61 6c 65 6e 64 |generate|s calend|
|00000d10| 61 72 20 66 6f 72 20 6c | 65 6e 20 6d 6f 6e 74 68 |ar for l|en month|
|00000d20| 73 0a 20 2a 09 09 09 09 | 09 28 64 65 66 61 75 6c |s. *....|.(defaul|
|00000d30| 74 20 3d 20 31 29 20 73 | 74 61 72 74 69 6e 67 20 |t = 1) s|tarting |
|00000d40| 77 69 74 68 20 6d 6d 2f | 79 79 0a 20 2a 0a 20 2a |with mm/|yy. *. *|
|00000d50| 20 09 4f 70 74 69 6f 6e | 20 66 6c 61 67 73 20 28 | .Option| flags (|
|00000d60| 6d 75 73 74 20 70 72 65 | 63 65 64 65 20 70 61 72 |must pre|cede par|
|00000d70| 61 6d 73 29 3a 0a 20 2a | 0a 20 2a 09 09 2d 6c 09 |ams):. *|. *..-l.|
|00000d80| 09 09 6c 65 66 74 2d 6a | 75 73 74 69 66 79 20 64 |..left-j|ustify d|
|00000d90| 61 74 65 73 20 28 64 65 | 66 61 75 6c 74 29 0a 20 |ates (de|fault). |
|00000da0| 2a 09 09 2d 72 09 09 09 | 72 69 67 68 74 2d 6a 75 |*..-r...|right-ju|
|00000db0| 73 74 69 66 79 20 64 61 | 74 65 73 0a 20 2a 09 09 |stify da|tes. *..|
|00000dc0| 2d 6d 09 09 09 6d 69 78 | 65 64 2d 63 61 73 65 20 |-m...mix|ed-case |
|00000dd0| 6f 75 74 70 75 74 20 28 | 64 65 66 61 75 6c 74 29 |output (|default)|
|00000de0| 0a 20 2a 09 09 2d 75 09 | 09 09 75 70 70 65 72 2d |. *..-u.|..upper-|
|00000df0| 63 61 73 65 20 6f 75 74 | 70 75 74 0a 20 2a 09 09 |case out|put. *..|
|00000e00| 2d 6f 5b 73 65 71 5d 09 | 09 09 75 73 65 20 22 73 |-o[seq].|..use "s|
|00000e10| 65 71 22 20 61 73 20 6f | 76 65 72 73 74 72 69 6b |eq" as o|verstrik|
|00000e20| 65 20 73 65 71 75 65 6e | 63 65 0a 20 2a 09 09 09 |e sequen|ce. *...|
|00000e30| 09 09 20 66 6f 72 20 68 | 65 61 64 69 6e 67 20 28 |.. for h|eading (|
|00000e40| 64 65 66 61 75 6c 74 3a | 20 48 49 58 29 0a 20 2a |default:| HIX). *|
|00000e50| 09 09 2d 62 4e 09 09 09 | 61 64 64 20 4e 20 62 6c |..-bN...|add N bl|
|00000e60| 61 6e 6b 20 6c 69 6e 65 | 73 20 61 66 74 65 72 20 |ank line|s after |
|00000e70| 66 6f 72 6d 2d 66 65 65 | 64 0a 20 2a 0a 20 2a 09 |form-fee|d. *. *.|
|00000e80| 09 4f 75 74 70 75 74 20 | 69 73 20 74 6f 20 73 74 |.Output |is to st|
|00000e90| 61 6e 64 61 72 64 20 6f | 75 74 70 75 74 2e 0a 20 |andard o|utput.. |
|00000ea0| 2a 09 09 0a 20 2a 2f 0a | 20 0a 23 69 6e 63 6c 75 |*... */.| .#inclu|
|00000eb0| 64 65 20 3c 73 74 64 69 | 6f 2e 68 3e 0a 23 69 6e |de <stdi|o.h>.#in|
|00000ec0| 63 6c 75 64 65 20 3c 63 | 74 79 70 65 2e 68 3e 0a |clude <c|type.h>.|
|00000ed0| 0a 23 64 65 66 69 6e 65 | 20 46 41 4c 53 45 20 20 |.#define| FALSE |
|00000ee0| 20 30 0a 23 64 65 66 69 | 6e 65 20 54 52 55 45 20 | 0.#defi|ne TRUE |
|00000ef0| 20 20 20 31 0a 20 0a 23 | 64 65 66 69 6e 65 20 4a | 1. .#|define J|
|00000f00| 41 4e 20 09 31 09 09 09 | 2f 2a 20 73 69 67 6e 69 |AN .1...|/* signi|
|00000f10| 66 69 63 61 6e 74 20 6d | 6f 6e 74 68 73 2f 79 65 |ficant m|onths/ye|
|00000f20| 61 72 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 46 |ars */.#|define F|
|00000f30| 45 42 09 32 0a 23 64 65 | 66 69 6e 65 20 44 45 43 |EB.2.#de|fine DEC|
|00000f40| 09 31 32 0a 23 64 65 66 | 69 6e 65 20 4d 49 4e 59 |.12.#def|ine MINY|
|00000f50| 52 09 31 37 35 33 0a 23 | 64 65 66 69 6e 65 20 4d |R.1753.#|define M|
|00000f60| 41 58 59 52 09 39 39 39 | 39 0a 20 0a 23 64 65 66 |AXYR.999|9. .#def|
|00000f70| 69 6e 65 20 53 4f 4c 49 | 44 09 30 09 09 09 2f 2a |ine SOLI|D.0.../*|
|00000f80| 20 70 73 65 75 64 6f 2d | 65 6e 75 6d 65 72 61 74 | pseudo-|enumerat|
|00000f90| 69 6f 6e 20 66 6f 72 20 | 6c 69 6e 65 20 73 74 79 |ion for |line sty|
|00000fa0| 6c 65 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 4f |les */.#|define O|
|00000fb0| 50 45 4e 09 31 0a 0a 23 | 64 65 66 69 6e 65 20 4c |PEN.1..#|define L|
|00000fc0| 45 46 54 09 30 09 09 09 | 2f 2a 20 2e 2e 2e 20 61 |EFT.0...|/* ... a|
|00000fd0| 6e 64 20 6a 75 73 74 69 | 66 69 63 61 74 69 6f 6e |nd justi|fication|
|00000fe0| 20 6f 66 20 64 61 74 65 | 73 20 20 20 20 20 2a 2f | of date|s */|
|00000ff0| 0a 23 64 65 66 69 6e 65 | 20 52 49 47 48 54 09 31 |.#define| RIGHT.1|
|00001000| 0a 0a 23 64 65 66 69 6e | 65 20 4d 49 58 45 44 09 |..#defin|e MIXED.|
|00001010| 30 09 09 09 2f 2a 20 2e | 2e 2e 20 61 6e 64 20 63 |0.../* .|.. and c|
|00001020| 61 73 65 20 6f 66 20 6f | 75 74 70 75 74 20 74 65 |ase of o|utput te|
|00001030| 78 74 09 20 20 20 20 20 | 20 2a 2f 0a 0a 23 64 65 |xt. | */..#de|
|00001040| 66 69 6e 65 20 55 50 50 | 45 52 09 31 0a 0a 23 64 |fine UPP|ER.1..#d|
|00001050| 65 66 69 6e 65 09 4f 56 | 45 52 53 54 52 49 4b 45 |efine.OV|ERSTRIKE|
|00001060| 09 22 48 49 58 22 09 09 | 2f 2a 20 6f 76 65 72 73 |."HIX"..|/* overs|
|00001070| 74 72 69 6b 65 20 73 65 | 71 75 65 6e 63 65 20 66 |trike se|quence f|
|00001080| 6f 72 20 6d 6f 6e 74 68 | 2f 79 65 61 72 20 2a 2f |or month|/year */|
|00001090| 0a 23 64 65 66 69 6e 65 | 20 4d 41 58 5f 4f 56 45 |.#define| MAX_OVE|
|000010a0| 52 53 54 52 09 33 09 09 | 2f 2a 20 6d 61 78 69 6d |RSTR.3..|/* maxim|
|000010b0| 75 6d 20 6f 76 65 72 73 | 74 72 69 6b 65 73 20 70 |um overs|trikes p|
|000010c0| 65 72 6d 69 74 74 65 64 | 20 2a 2f 0a 0a 23 64 65 |ermitted| */..#de|
|000010d0| 66 69 6e 65 20 69 73 4c | 65 61 70 28 79 29 20 28 |fine isL|eap(y) (|
|000010e0| 28 79 29 20 25 20 34 20 | 3d 3d 20 30 20 26 26 20 |(y) % 4 |== 0 && |
|000010f0| 28 28 79 29 20 25 20 31 | 30 30 20 21 3d 20 30 20 |((y) % 1|00 != 0 |
|00001100| 7c 7c 20 28 79 29 20 25 | 20 34 30 30 20 3d 3d 20 ||| (y) %| 400 == |
|00001110| 30 29 29 09 2f 2a 20 6c | 65 61 70 20 79 65 61 72 |0))./* l|eap year|
|00001120| 20 6d 61 63 72 6f 20 2a | 2f 0a 20 0a 74 79 70 65 | macro *|/. .type|
|00001130| 64 65 66 20 73 74 72 75 | 63 74 09 09 09 09 2f 2a |def stru|ct..../*|
|00001140| 20 69 6e 66 6f 20 66 6f | 72 20 61 20 73 69 6e 67 | info fo|r a sing|
|00001150| 6c 65 20 6d 6f 6e 74 68 | 20 2a 2f 0a 20 20 20 20 |le month| */. |
|00001160| 7b 0a 20 20 20 20 69 6e | 74 20 09 6d 6d 3b 0a 20 |{. in|t .mm;. |
|00001170| 20 20 20 69 6e 74 09 09 | 79 79 3b 0a 20 20 20 20 | int..|yy;. |
|00001180| 63 68 61 72 20 09 6d 6d | 6e 61 6d 65 5b 31 30 5d |char .mm|name[10]|
|00001190| 3b 0a 20 20 20 20 63 68 | 61 72 09 64 61 74 65 73 |;. ch|ar.dates|
|000011a0| 5b 36 5d 5b 37 5d 5b 33 | 5d 3b 0a 20 20 20 20 7d |[6][7][3|];. }|
|000011b0| 20 6d 6f 6e 74 68 52 65 | 63 3b 0a 20 0a 74 79 70 | monthRe|c;. .typ|
|000011c0| 65 64 65 66 20 6d 6f 6e | 74 68 52 65 63 20 2a 6d |edef mon|thRec *m|
|000011d0| 70 74 72 3b 09 09 09 2f | 2a 20 70 6f 69 6e 74 65 |ptr;.../|* pointe|
|000011e0| 72 20 74 6f 20 61 62 6f | 76 65 20 73 74 72 75 63 |r to abo|ve struc|
|000011f0| 74 20 2a 2f 0a 0a 2f 2a | 20 67 6c 6f 62 61 6c 73 |t */../*| globals|
|00001200| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 74 | corresp|onding t|
|00001210| 6f 20 63 6f 6d 6d 61 6e | 64 2d 6c 69 6e 65 20 66 |o comman|d-line f|
|00001220| 6c 61 67 73 20 2a 2f 0a | 0a 69 6e 74 20 6a 75 73 |lags */.|.int jus|
|00001230| 74 20 3d 20 4c 45 46 54 | 3b 09 09 09 2f 2a 20 64 |t = LEFT|;.../* d|
|00001240| 65 66 61 75 6c 74 20 6a | 75 73 74 69 66 69 63 61 |efault j|ustifica|
|00001250| 74 69 6f 6e 20 6f 66 20 | 64 61 74 65 73 20 2a 2f |tion of |dates */|
|00001260| 0a 69 6e 74 20 6f 63 61 | 73 65 20 3d 20 4d 49 58 |.int oca|se = MIX|
|00001270| 45 44 3b 09 09 09 2f 2a | 20 64 65 66 61 75 6c 74 |ED;.../*| default|
|00001280| 20 63 61 73 65 20 66 6f | 72 20 6f 75 74 70 75 74 | case fo|r output|
|00001290| 20 2a 2f 0a 69 6e 74 20 | 6e 62 6c 61 6e 6b 20 3d | */.int |nblank =|
|000012a0| 20 30 3b 09 09 09 09 2f | 2a 20 64 65 66 61 75 6c | 0;..../|* defaul|
|000012b0| 74 20 62 6c 61 6e 6b 20 | 6c 69 6e 65 73 20 61 66 |t blank |lines af|
|000012c0| 74 65 72 20 46 46 20 2a | 2f 0a 63 68 61 72 20 2a |ter FF *|/.char *|
|000012d0| 73 65 71 20 3d 20 4f 56 | 45 52 53 54 52 49 4b 45 |seq = OV|ERSTRIKE|
|000012e0| 3b 09 09 09 2f 2a 20 64 | 65 66 61 75 6c 74 20 6f |;.../* d|efault o|
|000012f0| 76 65 72 73 74 72 69 6b | 65 20 73 65 71 75 65 6e |verstrik|e sequen|
|00001300| 63 65 20 2a 2f 0a 0a 0c | 0a 2f 2a 0a 20 2a 09 4d |ce */...|./*. *.M|
|00001310| 61 69 6e 20 2d 20 67 65 | 74 73 20 61 6e 64 20 76 |ain - ge|ts and v|
|00001320| 61 6c 69 64 61 74 65 73 | 20 70 61 72 61 6d 65 74 |alidates| paramet|
|00001330| 65 72 73 2c 20 6f 70 65 | 6e 73 20 6f 75 74 70 75 |ers, ope|ns outpu|
|00001340| 74 20 66 69 6c 65 2c 20 | 65 78 65 63 75 74 65 73 |t file, |executes|
|00001350| 0a 20 2a 09 6c 6f 6f 70 | 20 74 6f 20 66 69 6c 6c |. *.loop| to fill|
|00001360| 20 61 6e 64 20 70 72 69 | 6e 74 20 6d 6f 6e 74 68 | and pri|nt month|
|00001370| 73 20 6f 66 20 63 61 6c | 65 6e 64 61 72 2c 20 63 |s of cal|endar, c|
|00001380| 6c 6f 73 65 73 20 6f 75 | 74 70 75 74 20 66 69 6c |loses ou|tput fil|
|00001390| 65 0a 20 2a 2f 0a 6d 61 | 69 6e 28 61 72 67 63 2c |e. */.ma|in(argc,|
|000013a0| 20 61 72 67 76 29 0a 20 | 20 20 20 69 6e 74 20 61 | argv). | int a|
|000013b0| 72 67 63 3b 0a 20 20 20 | 20 63 68 61 72 20 2a 61 |rgc;. | char *a|
|000013c0| 72 67 76 5b 5d 3b 0a 20 | 20 20 20 7b 0a 20 20 20 |rgv[];. | {. |
|000013d0| 20 69 6e 74 20 6e 6d 6f | 6e 74 68 73 3b 09 09 09 | int nmo|nths;...|
|000013e0| 2f 2a 20 63 6f 6e 73 65 | 63 75 74 69 76 65 20 6d |/* conse|cutive m|
|000013f0| 6f 6e 74 68 73 20 74 6f | 20 70 72 69 6e 74 20 2a |onths to| print *|
|00001400| 2f 0a 20 20 20 20 69 6e | 74 20 62 61 64 6f 70 74 |/. in|t badopt|
|00001410| 20 3d 20 46 41 4c 53 45 | 3b 09 09 09 2f 2a 20 66 | = FALSE|;.../* f|
|00001420| 6c 61 67 20 73 65 74 20 | 69 66 20 62 61 64 20 6f |lag set |if bad o|
|00001430| 70 74 69 6f 6e 20 2a 2f | 0a 20 20 20 20 69 6e 74 |ption */|. int|
|00001440| 20 62 61 64 70 61 72 20 | 3d 20 46 41 4c 53 45 3b | badpar |= FALSE;|
|00001450| 09 09 09 2f 2a 20 66 6c | 61 67 20 73 65 74 20 69 |.../* fl|ag set i|
|00001460| 66 20 62 61 64 20 70 61 | 72 61 6d 20 20 2a 2f 0a |f bad pa|ram */.|
|00001470| 20 20 20 20 6d 6f 6e 74 | 68 52 65 63 20 6d 52 65 | mont|hRec mRe|
|00001480| 63 5b 33 5d 3b 09 09 09 | 2f 2a 20 73 70 61 63 65 |c[3];...|/* space|
|00001490| 20 66 6f 72 20 6d 61 69 | 6e 20 61 6e 64 20 73 6d | for mai|n and sm|
|000014a0| 61 6c 6c 20 63 61 6c 65 | 6e 64 61 72 73 20 2a 2f |all cale|ndars */|
|000014b0| 0a 20 20 20 20 6d 70 74 | 72 20 70 72 65 76 20 3d |. mpt|r prev =|
|000014c0| 20 26 6d 52 65 63 5b 30 | 5d 2c 20 09 09 2f 2a 20 | &mRec[0|], ../* |
|000014d0| 70 6f 69 6e 74 65 72 73 | 20 74 6f 20 63 61 6c 65 |pointers| to cale|
|000014e0| 6e 64 61 72 73 20 28 69 | 6e 69 74 69 61 6c 6c 79 |ndars (i|nitially|
|000014f0| 29 20 2a 2f 0a 09 20 63 | 75 72 72 20 3d 20 26 6d |) */.. c|urr = &m|
|00001500| 52 65 63 5b 31 5d 2c 0a | 09 20 6e 65 78 74 20 3d |Rec[1],.|. next =|
|00001510| 20 26 6d 52 65 63 5b 32 | 5d 2c 0a 09 20 74 65 6d | &mRec[2|],.. tem|
|00001520| 70 3b 0a 0a 20 20 20 20 | 2f 2a 20 47 65 74 20 63 |p;.. |/* Get c|
|00001530| 6f 6d 6d 61 6e 64 20 6c | 69 6e 65 20 66 6c 61 67 |ommand l|ine flag|
|00001540| 73 20 2a 2f 0a 0a 20 20 | 20 20 77 68 69 6c 65 20 |s */.. | while |
|00001550| 28 61 72 67 63 20 3e 20 | 31 20 26 26 20 61 72 67 |(argc > |1 && arg|
|00001560| 76 5b 31 5d 5b 30 5d 20 | 3d 3d 20 27 2d 27 29 0a |v[1][0] |== '-').|
|00001570| 20 20 20 20 20 20 20 20 | 7b 0a 20 20 20 20 20 20 | |{. |
|00001580| 20 20 73 77 69 74 63 68 | 20 28 61 72 67 76 5b 31 | switch| (argv[1|
|00001590| 5d 5b 31 5d 29 0a 09 20 | 20 20 20 7b 0a 09 20 20 |][1]).. | {.. |
|000015a0| 20 20 63 61 73 65 20 27 | 62 27 3a 0a 09 09 73 73 | case '|b':...ss|
|000015b0| 63 61 6e 66 28 26 61 72 | 67 76 5b 31 5d 5b 32 5d |canf(&ar|gv[1][2]|
|000015c0| 2c 20 22 25 64 22 2c 20 | 26 6e 62 6c 61 6e 6b 29 |, "%d", |&nblank)|
|000015d0| 3b 0a 09 09 62 72 65 61 | 6b 3b 0a 09 20 20 20 20 |;...brea|k;.. |
|000015e0| 63 61 73 65 20 27 6c 27 | 3a 0a 09 09 6a 75 73 74 |case 'l'|:...just|
|000015f0| 20 3d 20 4c 45 46 54 3b | 0a 09 09 62 72 65 61 6b | = LEFT;|...break|
|00001600| 3b 0a 09 20 20 20 20 63 | 61 73 65 20 27 72 27 3a |;.. c|ase 'r':|
|00001610| 0a 09 09 6a 75 73 74 20 | 3d 20 52 49 47 48 54 3b |...just |= RIGHT;|
|00001620| 0a 09 09 62 72 65 61 6b | 3b 0a 09 20 20 20 20 63 |...break|;.. c|
|00001630| 61 73 65 20 27 6d 27 3a | 0a 09 09 6f 63 61 73 65 |ase 'm':|...ocase|
|00001640| 20 3d 20 4d 49 58 45 44 | 3b 0a 09 09 62 72 65 61 | = MIXED|;...brea|
|00001650| 6b 3b 0a 09 20 20 20 20 | 63 61 73 65 20 27 75 27 |k;.. |case 'u'|
|00001660| 3a 0a 09 09 6f 63 61 73 | 65 20 3d 20 55 50 50 45 |:...ocas|e = UPPE|
|00001670| 52 3b 0a 09 09 62 72 65 | 61 6b 3b 0a 09 20 20 20 |R;...bre|ak;.. |
|00001680| 20 63 61 73 65 20 27 6f | 27 3a 0a 09 09 69 66 20 | case 'o|':...if |
|00001690| 28 61 72 67 76 5b 31 5d | 5b 32 5d 20 21 3d 20 27 |(argv[1]|[2] != '|
|000016a0| 5c 30 27 29 0a 09 09 20 | 20 20 20 73 65 71 20 3d |\0')... | seq =|
|000016b0| 20 26 61 72 67 76 5b 31 | 5d 5b 32 5d 3b 0a 09 09 | &argv[1|][2];...|
|000016c0| 62 72 65 61 6b 3b 0a 09 | 20 20 20 20 64 65 66 61 |break;..| defa|
|000016d0| 75 6c 74 3a 0a 09 09 66 | 70 72 69 6e 74 66 28 73 |ult:...f|printf(s|
|000016e0| 74 64 65 72 72 2c 20 22 | 49 6e 76 61 6c 69 64 20 |tderr, "|Invalid |
|000016f0| 66 6c 61 67 3a 20 25 73 | 5c 6e 22 2c 20 61 72 67 |flag: %s|\n", arg|
|00001700| 76 5b 31 5d 29 3b 0a 09 | 09 62 61 64 6f 70 74 20 |v[1]);..|.badopt |
|00001710| 3d 20 54 52 55 45 3b 0a | 09 09 62 72 65 61 6b 3b |= TRUE;.|..break;|
|00001720| 0a 09 20 20 20 20 7d 0a | 20 20 20 20 20 20 20 20 |.. }.| |
|00001730| 61 72 67 76 2b 2b 3b 0a | 09 61 72 67 63 2d 2d 3b |argv++;.|.argc--;|
|00001740| 0a 09 7d 0a 0a 20 20 20 | 20 69 66 20 28 62 61 64 |..}.. | if (bad|
|00001750| 6f 70 74 29 0a 09 66 70 | 72 69 6e 74 66 28 73 74 |opt)..fp|rintf(st|
|00001760| 64 65 72 72 2c 20 22 56 | 61 6c 69 64 20 66 6c 61 |derr, "V|alid fla|
|00001770| 67 73 20 61 72 65 20 2d | 62 20 2d 6c 20 2d 6d 20 |gs are -|b -l -m |
|00001780| 2d 6f 20 2d 72 20 2d 75 | 5c 6e 22 29 3b 0a 0a 20 |-o -r -u|\n");.. |
|00001790| 20 20 20 2f 2a 20 47 65 | 74 20 61 6e 64 20 76 61 | /* Ge|t and va|
|000017a0| 6c 69 64 61 74 65 20 70 | 61 72 61 6d 65 74 65 72 |lidate p|arameter|
|000017b0| 73 20 2a 2f 0a 20 20 20 | 20 0a 20 20 20 20 69 66 |s */. | . if|
|000017c0| 20 28 61 72 67 63 20 3d | 3d 20 32 29 09 09 2f 2a | (argc =|= 2)../*|
|000017d0| 20 6f 6e 6c 79 20 6f 6e | 65 20 61 72 67 20 2d 20 | only on|e arg - |
|000017e0| 74 72 65 61 74 20 61 73 | 20 79 79 20 2a 2f 0a 09 |treat as| yy */..|
|000017f0| 7b 0a 09 73 73 63 61 6e | 66 28 61 72 67 76 5b 31 |{..sscan|f(argv[1|
|00001800| 5d 2c 20 22 25 64 22 2c | 20 26 63 75 72 72 2d 3e |], "%d",| &curr->|
|00001810| 79 79 29 3b 0a 09 63 75 | 72 72 2d 3e 6d 6d 20 3d |yy);..cu|rr->mm =|
|00001820| 20 4a 41 4e 3b 0a 09 6e | 6d 6f 6e 74 68 73 20 3d | JAN;..n|months =|
|00001830| 20 31 32 3b 0a 09 7d 0a | 20 0a 20 20 20 20 65 6c | 12;..}.| . el|
|00001840| 73 65 20 69 66 20 28 61 | 72 67 63 20 3e 3d 20 33 |se if (a|rgc >= 3|
|00001850| 29 09 09 2f 2a 20 74 77 | 6f 20 6f 72 20 6d 6f 72 |)../* tw|o or mor|
|00001860| 65 20 2d 20 74 72 65 61 | 74 20 61 73 20 6d 6d 20 |e - trea|t as mm |
|00001870| 79 79 20 5b 6c 65 6e 5d | 20 2a 2f 0a 09 7b 0a 09 |yy [len]| */..{..|
|00001880| 73 73 63 61 6e 66 28 61 | 72 67 76 5b 31 5d 2c 20 |sscanf(a|rgv[1], |
|00001890| 22 25 64 22 2c 20 26 63 | 75 72 72 2d 3e 6d 6d 29 |"%d", &c|urr->mm)|
|000018a0| 3b 0a 09 73 73 63 61 6e | 66 28 61 72 67 76 5b 32 |;..sscan|f(argv[2|
|000018b0| 5d 2c 20 22 25 64 22 2c | 20 26 63 75 72 72 2d 3e |], "%d",| &curr->|
|000018c0| 79 79 29 3b 0a 09 69 66 | 20 28 61 72 67 63 20 3e |yy);..if| (argc >|
|000018d0| 3d 20 34 29 0a 09 20 20 | 20 20 73 73 63 61 6e 66 |= 4).. | sscanf|
|000018e0| 28 61 72 67 76 5b 33 5d | 2c 20 22 25 64 22 2c 20 |(argv[3]|, "%d", |
|000018f0| 26 6e 6d 6f 6e 74 68 73 | 29 3b 0a 09 7d 0a 20 0a |&nmonths|);..}. .|
|00001900| 20 20 20 20 65 6c 73 65 | 09 09 09 2f 2a 20 6e 6f | else|.../* no|
|00001910| 6e 65 20 73 70 65 63 69 | 66 69 65 64 20 2d 20 67 |ne speci|fied - g|
|00001920| 65 74 20 69 6e 74 65 72 | 61 63 74 69 76 65 6c 79 |et inter|actively|
|00001930| 20 2a 2f 0a 09 7b 0a 09 | 66 70 72 69 6e 74 66 28 | */..{..|fprintf(|
|00001940| 73 74 64 65 72 72 2c 20 | 22 45 6e 74 65 72 20 63 |stderr, |"Enter c|
|00001950| 61 6c 65 6e 64 61 72 20 | 73 70 65 63 73 20 28 6d |alendar |specs (m|
|00001960| 6f 6e 74 68 20 79 65 61 | 72 20 6c 65 6e 67 74 68 |onth yea|r length|
|00001970| 29 3a 20 22 29 3b 0a 09 | 73 63 61 6e 66 28 22 25 |): ");..|scanf("%|
|00001980| 64 20 25 64 20 25 64 22 | 2c 20 26 63 75 72 72 2d |d %d %d"|, &curr-|
|00001990| 3e 6d 6d 2c 20 26 63 75 | 72 72 2d 3e 79 79 2c 20 |>mm, &cu|rr->yy, |
|000019a0| 26 6e 6d 6f 6e 74 68 73 | 29 3b 0a 09 7d 0a 20 0a |&nmonths|);..}. .|
|000019b0| 20 20 20 20 69 66 20 28 | 63 75 72 72 2d 3e 79 79 | if (|curr->yy|
|000019c0| 20 3e 20 30 20 26 26 20 | 63 75 72 72 2d 3e 79 79 | > 0 && |curr->yy|
|000019d0| 20 3c 20 31 30 30 29 09 | 09 2f 2a 20 6e 6e 20 2d | < 100).|./* nn -|
|000019e0| 3e 20 31 39 6e 6e 20 2a | 2f 0a 09 63 75 72 72 2d |> 19nn *|/..curr-|
|000019f0| 3e 79 79 20 2b 3d 20 31 | 39 30 30 3b 0a 20 0a 20 |>yy += 1|900;. . |
|00001a00| 20 20 20 69 66 20 28 6e | 6d 6f 6e 74 68 73 20 3c | if (n|months <|
|00001a10| 20 31 29 09 09 09 09 2f | 2a 20 64 65 66 61 75 6c | 1)..../|* defaul|
|00001a20| 74 20 66 6f 72 20 6d 6f | 6e 74 68 20 63 6f 75 6e |t for mo|nth coun|
|00001a30| 74 20 2a 2f 0a 09 6e 6d | 6f 6e 74 68 73 20 3d 20 |t */..nm|onths = |
|00001a40| 31 3b 0a 20 0a 20 20 20 | 20 69 66 20 28 63 75 72 |1;. . | if (cur|
|00001a50| 72 2d 3e 6d 6d 20 3c 20 | 4a 41 4e 20 7c 7c 20 63 |r->mm < |JAN || c|
|00001a60| 75 72 72 2d 3e 6d 6d 20 | 3e 20 44 45 43 29 09 2f |urr->mm |> DEC)./|
|00001a70| 2a 20 76 61 6c 69 64 61 | 74 65 20 6d 6f 6e 74 68 |* valida|te month|
|00001a80| 2f 79 65 61 72 20 2a 2f | 0a 20 20 20 20 20 20 7b |/year */|. {|
|00001a90| 0a 20 20 20 20 20 20 66 | 70 72 69 6e 74 66 28 73 |. f|printf(s|
|00001aa0| 74 64 65 72 72 2c 20 22 | 4d 6f 6e 74 68 20 25 64 |tderr, "|Month %d|
|00001ab0| 20 6e 6f 74 20 69 6e 20 | 72 61 6e 67 65 20 25 64 | not in |range %d|
|00001ac0| 20 2e 2e 20 25 64 5c 6e | 22 2c 20 63 75 72 72 2d | .. %d\n|", curr-|
|00001ad0| 3e 6d 6d 2c 20 4a 41 4e | 2c 20 44 45 43 29 3b 0a |>mm, JAN|, DEC);.|
|00001ae0| 20 20 20 20 20 20 62 61 | 64 70 61 72 20 3d 20 54 | ba|dpar = T|
|00001af0| 52 55 45 3b 0a 20 20 20 | 20 20 20 7d 0a 0a 20 20 |RUE;. | }.. |
|00001b00| 20 20 69 66 20 28 63 75 | 72 72 2d 3e 79 79 20 3c | if (cu|rr->yy <|
|00001b10| 20 4d 49 4e 59 52 20 7c | 7c 20 63 75 72 72 2d 3e | MINYR ||| curr->|
|00001b20| 79 79 20 3e 20 4d 41 58 | 59 52 29 0a 20 20 20 20 |yy > MAX|YR). |
|00001b30| 20 20 7b 0a 20 20 20 20 | 20 20 66 70 72 69 6e 74 | {. | fprint|
|00001b40| 66 28 73 74 64 65 72 72 | 2c 20 22 59 65 61 72 20 |f(stderr|, "Year |
|00001b50| 25 64 20 6e 6f 74 20 69 | 6e 20 72 61 6e 67 65 20 |%d not i|n range |
|00001b60| 25 64 20 2e 2e 20 25 64 | 5c 6e 22 2c 20 63 75 72 |%d .. %d|\n", cur|
|00001b70| 72 2d 3e 79 79 2c 20 4d | 49 4e 59 52 2c 0a 09 20 |r->yy, M|INYR,.. |
|00001b80| 20 20 20 20 20 4d 41 58 | 59 52 29 3b 0a 20 20 20 | MAX|YR);. |
|00001b90| 20 20 20 62 61 64 70 61 | 72 20 3d 20 54 52 55 45 | badpa|r = TRUE|
|00001ba0| 3b 0a 20 20 20 20 20 20 | 7d 0a 0a 20 20 20 20 69 |;. |}.. i|
|00001bb0| 66 20 28 62 61 64 70 61 | 72 29 09 09 2f 2a 20 71 |f (badpa|r)../* q|
|00001bc0| 75 69 74 20 69 66 20 6d | 6f 6e 74 68 20 6f 72 20 |uit if m|onth or |
|00001bd0| 79 65 61 72 20 69 6e 76 | 61 6c 69 64 20 2a 2f 0a |year inv|alid */.|
|00001be0| 20 20 20 20 20 20 65 78 | 69 74 28 31 29 3b 0a 20 | ex|it(1);. |
|00001bf0| 0a 20 20 20 20 2f 2a 20 | 66 69 6c 6c 20 69 6e 20 |. /* |fill in |
|00001c00| 63 61 6c 65 6e 64 61 72 | 73 20 66 6f 72 20 70 72 |calendar|s for pr|
|00001c10| 65 76 69 6f 75 73 20 61 | 6e 64 20 63 75 72 72 65 |evious a|nd curre|
|00001c20| 6e 74 20 6d 6f 6e 74 68 | 20 2a 2f 0a 20 0a 20 20 |nt month| */. . |
|00001c30| 20 20 70 72 65 76 2d 3e | 6d 6d 20 3d 20 28 63 75 | prev->|mm = (cu|
|00001c40| 72 72 2d 3e 6d 6d 20 3d | 3d 20 4a 41 4e 29 20 3f |rr->mm =|= JAN) ?|
|00001c50| 20 44 45 43 20 3a 20 63 | 75 72 72 2d 3e 6d 6d 20 | DEC : c|urr->mm |
|00001c60| 2d 20 31 3b 0a 20 20 20 | 20 70 72 65 76 2d 3e 79 |- 1;. | prev->y|
|00001c70| 79 20 3d 20 28 63 75 72 | 72 2d 3e 6d 6d 20 3d 3d |y = (cur|r->mm ==|
|00001c80| 20 4a 41 4e 29 20 3f 20 | 63 75 72 72 2d 3e 79 79 | JAN) ? |curr->yy|
|00001c90| 20 2d 20 31 20 3a 20 63 | 75 72 72 2d 3e 79 79 3b | - 1 : c|urr->yy;|
|00001ca0| 0a 20 20 20 20 66 69 6c | 6c 43 61 6c 65 6e 64 61 |. fil|lCalenda|
|00001cb0| 72 28 70 72 65 76 29 3b | 0a 20 0a 20 20 20 20 66 |r(prev);|. . f|
|00001cc0| 69 6c 6c 43 61 6c 65 6e | 64 61 72 28 63 75 72 72 |illCalen|dar(curr|
|00001cd0| 29 3b 0a 20 0a 20 20 20 | 20 2f 2a 0a 20 20 20 20 |);. . | /*. |
|00001ce0| 20 2a 20 4d 61 69 6e 20 | 6c 6f 6f 70 3a 20 70 72 | * Main |loop: pr|
|00001cf0| 69 6e 74 20 65 61 63 68 | 20 6d 6f 6e 74 68 20 6f |int each| month o|
|00001d00| 66 20 74 68 65 20 63 61 | 6c 65 6e 64 61 72 20 28 |f the ca|lendar (|
|00001d10| 77 69 74 68 20 73 6d 61 | 6c 6c 20 63 61 6c 65 6e |with sma|ll calen|
|00001d20| 64 61 72 73 20 66 6f 72 | 0a 20 20 20 20 20 2a 20 |dars for|. * |
|00001d30| 74 68 65 20 70 72 65 63 | 65 64 69 6e 67 20 61 6e |the prec|eding an|
|00001d40| 64 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6d 6f 6e 74 |d follow|ing mont|
|00001d50| 68 73 20 69 6e 20 74 68 | 65 20 75 70 70 65 72 20 |hs in th|e upper |
|00001d60| 63 6f 72 6e 65 72 73 29 | 2e 20 20 54 68 65 20 63 |corners)|. The c|
|00001d70| 75 72 72 65 6e 74 0a 20 | 20 20 20 20 2a 20 61 6e |urrent. | * an|
|00001d80| 64 20 6e 65 78 74 20 6d | 6f 6e 74 68 73 27 20 63 |d next m|onths' c|
|00001d90| 61 6c 65 6e 64 61 72 73 | 20 63 61 6e 20 62 65 20 |alendars| can be |
|00001da0| 72 65 75 73 65 64 20 74 | 68 65 20 66 6f 6c 6c 6f |reused t|he follo|
|00001db0| 77 69 6e 67 20 6d 6f 6e | 74 68 3b 20 6f 6e 6c 79 |wing mon|th; only|
|00001dc0| 0a 20 20 20 20 20 2a 20 | 74 68 65 20 27 6e 65 78 |. * |the 'nex|
|00001dd0| 74 27 20 63 61 6c 65 6e | 64 61 72 20 6e 65 65 64 |t' calen|dar need|
|00001de0| 20 62 65 20 72 65 63 61 | 6c 63 75 6c 61 74 65 64 | be reca|lculated|
|00001df0| 20 65 61 63 68 20 74 69 | 6d 65 2e 0a 20 20 20 20 | each ti|me.. |
|00001e00| 20 2a 2f 0a 20 0a 20 20 | 20 20 66 6f 72 20 28 3b | */. . | for (;|
|00001e10| 20 6e 6d 6f 6e 74 68 73 | 20 3e 20 30 20 26 26 20 | nmonths| > 0 && |
|00001e20| 63 75 72 72 2d 3e 79 79 | 20 3c 3d 20 4d 41 58 59 |curr->yy| <= MAXY|
|00001e30| 52 3b 20 6e 6d 6f 6e 74 | 68 73 2d 2d 29 09 2f 2a |R; nmont|hs--)./*|
|00001e40| 20 6d 61 69 6e 20 6c 6f | 6f 70 20 2a 2f 0a 09 7b | main lo|op */..{|
|00001e50| 0a 09 6e 65 78 74 2d 3e | 6d 6d 20 3d 20 28 63 75 |..next->|mm = (cu|
|00001e60| 72 72 2d 3e 6d 6d 20 3d | 3d 20 44 45 43 29 20 3f |rr->mm =|= DEC) ?|
|00001e70| 20 4a 41 4e 20 3a 20 63 | 75 72 72 2d 3e 6d 6d 20 | JAN : c|urr->mm |
|00001e80| 2b 20 31 3b 0a 09 6e 65 | 78 74 2d 3e 79 79 20 3d |+ 1;..ne|xt->yy =|
|00001e90| 20 28 63 75 72 72 2d 3e | 6d 6d 20 3d 3d 20 44 45 | (curr->|mm == DE|
|00001ea0| 43 29 20 3f 20 63 75 72 | 72 2d 3e 79 79 20 2b 20 |C) ? cur|r->yy + |
|00001eb0| 31 20 3a 20 63 75 72 72 | 2d 3e 79 79 3b 0a 09 66 |1 : curr|->yy;..f|
|00001ec0| 69 6c 6c 43 61 6c 65 6e | 64 61 72 28 6e 65 78 74 |illCalen|dar(next|
|00001ed0| 29 3b 09 09 09 2f 2a 20 | 66 69 6c 6c 20 69 6e 20 |);.../* |fill in |
|00001ee0| 66 6f 6c 6c 6f 77 69 6e | 67 20 6d 6f 6e 74 68 20 |followin|g month |
|00001ef0| 2a 2f 0a 20 0a 09 70 72 | 69 6e 74 43 61 6c 65 6e |*/. ..pr|intCalen|
|00001f00| 64 61 72 28 70 72 65 76 | 2c 20 63 75 72 72 2c 20 |dar(prev|, curr, |
|00001f10| 6e 65 78 74 29 3b 0a 20 | 0a 09 74 65 6d 70 20 3d |next);. |..temp =|
|00001f20| 20 70 72 65 76 3b 09 09 | 09 09 2f 2a 20 73 77 61 | prev;..|../* swa|
|00001f30| 70 20 74 68 65 20 74 68 | 72 65 65 20 6d 6f 6e 74 |p the th|ree mont|
|00001f40| 68 73 20 2a 2f 0a 09 70 | 72 65 76 20 3d 20 63 75 |hs */..p|rev = cu|
|00001f50| 72 72 3b 0a 09 63 75 72 | 72 20 3d 20 6e 65 78 74 |rr;..cur|r = next|
|00001f60| 3b 0a 09 6e 65 78 74 20 | 3d 20 74 65 6d 70 3b 0a |;..next |= temp;.|
|00001f70| 09 7d 0a 20 0a 20 20 20 | 20 7d 0a 0c 0a 2f 2a 0a |.}. . | }.../*.|
|00001f80| 20 2a 09 50 72 69 6e 74 | 20 74 68 65 20 63 61 6c | *.Print| the cal|
|00001f90| 65 6e 64 61 72 20 66 6f | 72 20 74 68 65 20 63 75 |endar fo|r the cu|
|00001fa0| 72 72 65 6e 74 20 6d 6f | 6e 74 68 2c 20 67 65 6e |rrent mo|nth, gen|
|00001fb0| 65 72 61 74 69 6e 67 20 | 73 6d 61 6c 6c 20 63 61 |erating |small ca|
|00001fc0| 6c 65 6e 64 61 72 73 0a | 20 2a 09 66 6f 72 20 74 |lendars.| *.for t|
|00001fd0| 68 65 20 70 72 65 76 69 | 6f 75 73 20 61 6e 64 20 |he previ|ous and |
|00001fe0| 66 6f 6c 6c 6f 77 69 6e | 67 20 6d 6f 6e 74 68 73 |followin|g months|
|00001ff0| 20 69 6e 20 74 68 65 20 | 75 70 70 65 72 20 63 6f | in the |upper co|
|00002000| 72 6e 65 72 73 20 61 6e | 64 20 74 68 65 0a 20 2a |rners an|d the. *|
|00002010| 09 6d 6f 6e 74 68 2f 79 | 65 61 72 20 28 69 6e 20 |.month/y|ear (in |
|00002020| 6c 61 72 67 65 20 63 68 | 61 72 61 63 74 65 72 73 |large ch|aracters|
|00002030| 29 20 63 65 6e 74 65 72 | 65 64 20 61 74 20 74 68 |) center|ed at th|
|00002040| 65 20 74 6f 70 2e 0a 20 | 2a 2f 0a 70 72 69 6e 74 |e top.. |*/.print|
|00002050| 43 61 6c 65 6e 64 61 72 | 28 70 72 65 76 2c 20 63 |Calendar|(prev, c|
|00002060| 75 72 72 2c 20 6e 65 78 | 74 29 0a 20 20 20 20 6d |urr, nex|t). m|
|00002070| 70 74 72 20 70 72 65 76 | 3b 09 09 09 2f 2a 20 50 |ptr prev|;.../* P|
|00002080| 72 65 76 69 6f 75 73 20 | 6d 6f 6e 74 68 20 28 75 |revious |month (u|
|00002090| 70 70 65 72 2d 6c 65 66 | 74 20 63 6f 72 6e 65 72 |pper-lef|t corner|
|000020a0| 29 20 20 2a 2f 0a 20 20 | 20 20 6d 70 74 72 20 63 |) */. | mptr c|
|000020b0| 75 72 72 3b 09 09 09 2f | 2a 20 43 75 72 72 65 6e |urr;.../|* Curren|
|000020c0| 74 20 6d 6f 6e 74 68 20 | 28 6d 61 69 6e 20 63 61 |t month |(main ca|
|000020d0| 6c 65 6e 64 61 72 29 20 | 20 20 20 20 20 20 2a 2f |lendar) | */|
|000020e0| 0a 20 20 20 20 6d 70 74 | 72 20 6e 65 78 74 3b 09 |. mpt|r next;.|
|000020f0| 09 09 2f 2a 20 4e 65 78 | 74 20 6d 6f 6e 74 68 20 |../* Nex|t month |
|00002100| 28 75 70 70 65 72 2d 72 | 69 67 68 74 20 63 6f 72 |(upper-r|ight cor|
|00002110| 6e 65 72 29 20 20 20 20 | 20 2a 2f 0a 20 20 20 20 |ner) | */. |
|00002120| 7b 0a 20 20 20 20 69 6e | 74 20 6e 63 68 61 72 73 |{. in|t nchars|
|00002130| 2c 20 69 2c 20 6a 3b 0a | 20 20 20 20 73 74 61 74 |, i, j;.| stat|
|00002140| 69 63 20 63 68 61 72 20 | 2a 6d 63 5f 77 6b 64 61 |ic char |*mc_wkda|
|00002150| 79 5b 5d 20 3d 0a 09 7b | 0a 09 22 20 53 75 6e 64 |y[] =..{|.." Sund|
|00002160| 61 79 20 20 22 2c 20 22 | 20 4d 6f 6e 64 61 79 20 |ay ", "| Monday |
|00002170| 20 22 2c 20 22 20 54 75 | 65 73 64 61 79 20 22 2c | ", " Tu|esday ",|
|00002180| 20 22 57 65 64 6e 65 73 | 64 61 79 22 2c 20 22 54 | "Wednes|day", "T|
|00002190| 68 75 72 73 64 61 79 20 | 22 2c 0a 09 22 20 46 72 |hursday |",.." Fr|
|000021a0| 69 64 61 79 20 20 22 2c | 20 22 53 61 74 75 72 64 |iday ",| "Saturd|
|000021b0| 61 79 20 22 0a 09 7d 3b | 0a 20 20 20 20 73 74 61 |ay "..};|. sta|
|000021c0| 74 69 63 20 63 68 61 72 | 20 2a 75 63 5f 77 6b 64 |tic char| *uc_wkd|
|000021d0| 61 79 5b 5d 20 3d 0a 09 | 7b 0a 09 22 20 53 55 4e |ay[] =..|{.." SUN|
|000021e0| 44 41 59 20 20 22 2c 20 | 22 20 4d 4f 4e 44 41 59 |DAY ", |" MONDAY|
|000021f0| 20 20 22 2c 20 22 20 54 | 55 45 53 44 41 59 20 22 | ", " T|UESDAY "|
|00002200| 2c 20 22 57 45 44 4e 45 | 53 44 41 59 22 2c 20 22 |, "WEDNE|SDAY", "|
|00002210| 54 48 55 52 53 44 41 59 | 20 22 2c 0a 09 22 20 46 |THURSDAY| ",.." F|
|00002220| 52 49 44 41 59 20 20 22 | 2c 20 22 53 41 54 55 52 |RIDAY "|, "SATUR|
|00002230| 44 41 59 20 22 0a 09 7d | 3b 0a 0a 20 20 20 20 63 |DAY "..}|;.. c|
|00002240| 68 61 72 20 2a 2a 77 6b | 64 61 79 3b 09 09 09 09 |har **wk|day;....|
|00002250| 2f 2a 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 6f 6e |/* point|er to on|
|00002260| 65 20 6f 66 20 61 62 6f | 76 65 20 2a 2f 0a 20 20 |e of abo|ve */. |
|00002270| 20 20 63 68 61 72 20 2a | 62 6c 61 6e 6b 73 20 3d | char *|blanks =|
|00002280| 20 22 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | " | |
|00002290| 20 20 20 20 20 20 20 22 | 3b 20 09 2f 2a 20 32 31 | "|; ./* 21|
|000022a0| 20 62 6c 61 6e 6b 73 20 | 66 6f 72 20 63 65 6e 74 | blanks |for cent|
|000022b0| 65 72 69 6e 67 20 2a 2f | 0a 20 20 20 20 63 68 61 |ering */|. cha|
|000022c0| 72 20 2a 70 61 64 64 69 | 6e 67 3b 09 09 09 09 2f |r *paddi|ng;..../|
|000022d0| 2a 20 50 6f 69 6e 74 65 | 72 20 69 6e 74 6f 20 27 |* Pointe|r into '|
|000022e0| 62 6c 61 6e 6b 73 27 20 | 20 20 2a 2f 0a 20 20 20 |blanks' | */. |
|000022f0| 20 63 68 61 72 20 6d 6f | 6e 74 68 41 6e 64 59 65 | char mo|nthAndYe|
|00002300| 61 72 5b 32 30 5d 3b 09 | 09 09 2f 2a 20 57 6f 72 |ar[20];.|../* Wor|
|00002310| 6b 20 61 72 65 61 20 09 | 09 20 20 20 2a 2f 0a 20 |k area .|. */. |
|00002320| 20 20 20 63 68 61 72 20 | 2a 6f 76 72 3b 09 09 09 | char |*ovr;...|
|00002330| 09 09 2f 2a 20 6f 76 65 | 72 73 74 72 69 6b 65 20 |../* ove|rstrike |
|00002340| 73 65 71 75 65 6e 63 65 | 09 20 20 20 2a 2f 0a 20 |sequence|. */. |
|00002350| 0a 20 20 20 20 6e 63 68 | 61 72 73 20 3d 20 73 74 |. nch|ars = st|
|00002360| 72 6c 65 6e 28 63 75 72 | 72 2d 3e 6d 6d 6e 61 6d |rlen(cur|r->mmnam|
|00002370| 65 29 3b 09 09 2f 2a 20 | 73 65 74 20 75 70 20 6d |e);../* |set up m|
|00002380| 6f 6e 74 68 2f 79 65 61 | 72 20 68 65 61 64 69 6e |onth/yea|r headin|
|00002390| 67 20 2a 2f 0a 20 20 20 | 20 70 61 64 64 69 6e 67 |g */. | padding|
|000023a0| 20 3d 20 62 6c 61 6e 6b | 73 20 2b 20 28 33 20 2a | = blank|s + (3 *|
|000023b0| 20 28 6e 63 68 61 72 73 | 20 2d 20 33 29 29 3b 09 | (nchars| - 3));.|
|000023c0| 2f 2a 20 61 6e 64 20 63 | 65 6e 74 65 72 20 69 74 |/* and c|enter it|
|000023d0| 20 20 09 20 20 20 20 20 | 2a 2f 0a 20 20 20 20 73 | . |*/. s|
|000023e0| 70 72 69 6e 74 66 28 6d | 6f 6e 74 68 41 6e 64 59 |printf(m|onthAndY|
|000023f0| 65 61 72 2c 20 22 25 73 | 25 35 64 22 2c 20 63 75 |ear, "%s|%5d", cu|
|00002400| 72 72 2d 3e 6d 6d 6e 61 | 6d 65 2c 20 63 75 72 72 |rr->mmna|me, curr|
|00002410| 2d 3e 79 79 29 3b 0a 20 | 0a 20 20 20 20 70 72 69 |->yy);. |. pri|
|00002420| 6e 74 66 28 22 5c 66 5c | 6e 22 29 3b 09 09 09 2f |ntf("\f\|n");.../|
|00002430| 2a 20 70 72 69 6e 74 20 | 6d 6f 6e 74 68 2f 79 65 |* print |month/ye|
|00002440| 61 72 20 69 6e 20 6c 61 | 72 67 65 20 63 68 61 72 |ar in la|rge char|
|00002450| 73 20 2a 2f 0a 20 20 20 | 20 66 6f 72 20 28 69 20 |s */. | for (i |
|00002460| 3d 20 30 3b 20 69 20 3c | 20 6e 62 6c 61 6e 6b 3b |= 0; i <| nblank;|
|00002470| 20 69 2b 2b 29 0a 09 70 | 72 69 6e 74 66 28 22 5c | i++)..p|rintf("\|
|00002480| 6e 22 29 3b 0a 0a 20 20 | 20 20 66 6f 72 20 28 69 |n");.. | for (i|
|00002490| 20 3d 20 30 3b 20 69 20 | 3c 20 39 3b 20 69 2b 2b | = 0; i |< 9; i++|
|000024a0| 29 09 09 2f 2a 20 73 75 | 72 72 6f 75 6e 64 65 64 |)../* su|rrounded|
|000024b0| 20 62 79 20 73 6d 61 6c | 6c 20 63 61 6c 65 6e 64 | by smal|l calend|
|000024c0| 61 72 73 20 20 20 2a 2f | 0a 20 20 20 20 20 20 20 |ars */|. |
|000024d0| 20 7b 0a 09 66 6f 72 20 | 28 6f 76 72 20 3d 20 73 | {..for |(ovr = s|
|000024e0| 65 71 3b 09 09 09 2f 2a | 20 6f 76 65 72 73 74 72 |eq;.../*| overstr|
|000024f0| 75 63 6b 20 6c 69 6e 65 | 73 20 66 69 72 73 74 20 |uck line|s first |
|00002500| 2a 2f 0a 09 20 20 20 20 | 20 6f 76 72 20 3c 20 73 |*/.. | ovr < s|
|00002510| 65 71 20 2b 20 4d 41 58 | 5f 4f 56 45 52 53 54 52 |eq + MAX|_OVERSTR|
|00002520| 20 2d 20 31 20 26 26 20 | 2a 28 6f 76 72 2b 31 29 | - 1 && |*(ovr+1)|
|00002530| 3b 0a 09 20 20 20 20 20 | 6f 76 72 2b 2b 29 20 0a |;.. |ovr++) .|
|00002540| 09 20 20 20 20 7b 0a 09 | 20 20 20 20 70 72 69 6e |. {..| prin|
|00002550| 74 66 28 22 25 32 30 73 | 25 73 22 2c 20 22 20 22 |tf("%20s|%s", " "|
|00002560| 2c 20 70 61 64 64 69 6e | 67 29 3b 0a 09 20 20 20 |, paddin|g);.. |
|00002570| 20 70 72 69 6e 74 48 64 | 72 28 6d 6f 6e 74 68 41 | printHd|r(monthA|
|00002580| 6e 64 59 65 61 72 2c 20 | 69 2c 20 2a 6f 76 72 29 |ndYear, |i, *ovr)|
|00002590| 3b 0a 09 20 20 20 20 70 | 72 69 6e 74 66 28 22 5c |;.. p|rintf("\|
|000025a0| 72 22 29 3b 0a 09 20 20 | 20 20 7d 0a 09 70 72 69 |r");.. | }..pri|
|000025b0| 6e 74 53 6d 61 6c 6c 43 | 61 6c 28 70 72 65 76 2c |ntSmallC|al(prev,|
|000025c0| 20 69 29 3b 09 09 2f 2a | 20 74 68 65 6e 20 73 6d | i);../*| then sm|
|000025d0| 61 6c 6c 20 63 61 6c 65 | 6e 64 61 72 73 2c 20 65 |all cale|ndars, e|
|000025e0| 74 63 2e 20 2a 2f 0a 09 | 70 72 69 6e 74 66 28 22 |tc. */..|printf("|
|000025f0| 25 73 22 2c 20 70 61 64 | 64 69 6e 67 29 3b 0a 09 |%s", pad|ding);..|
|00002600| 70 72 69 6e 74 48 64 72 | 28 6d 6f 6e 74 68 41 6e |printHdr|(monthAn|
|00002610| 64 59 65 61 72 2c 20 69 | 2c 20 2a 6f 76 72 29 3b |dYear, i|, *ovr);|
|00002620| 0a 09 70 72 69 6e 74 66 | 28 22 20 25 73 22 2c 20 |..printf|(" %s", |
|00002630| 70 61 64 64 69 6e 67 29 | 3b 0a 20 20 20 20 20 20 |padding)|;. |
|00002640| 20 20 70 72 69 6e 74 53 | 6d 61 6c 6c 43 61 6c 28 | printS|mallCal(|
|00002650| 6e 65 78 74 2c 20 69 29 | 3b 0a 20 20 20 20 20 20 |next, i)|;. |
|00002660| 20 20 70 72 69 6e 74 66 | 28 22 5c 6e 22 29 3b 0a | printf|("\n");.|
|00002670| 20 20 20 20 20 20 20 20 | 7d 0a 20 0a 20 20 20 20 | |}. . |
|00002680| 70 72 69 6e 74 66 28 22 | 5c 6e 22 29 3b 09 09 09 |printf("|\n");...|
|00002690| 2f 2a 20 70 72 69 6e 74 | 20 74 68 65 20 77 65 65 |/* print| the wee|
|000026a0| 6b 64 61 79 20 6e 61 6d | 65 73 20 2a 2f 0a 20 20 |kday nam|es */. |
|000026b0| 20 20 70 72 69 6e 74 5f | 6c 69 6e 65 28 31 2c 20 | print_|line(1, |
|000026c0| 53 4f 4c 49 44 29 3b 0a | 20 20 20 20 70 72 69 6e |SOLID);.| prin|
|000026d0| 74 5f 6c 69 6e 65 28 31 | 2c 20 4f 50 45 4e 29 3b |t_line(1|, OPEN);|
|000026e0| 0a 20 20 20 20 70 72 69 | 6e 74 66 28 22 20 20 22 |. pri|ntf(" "|
|000026f0| 29 3b 0a 20 20 20 20 77 | 6b 64 61 79 20 3d 20 6f |);. w|kday = o|
|00002700| 63 61 73 65 20 3d 3d 20 | 55 50 50 45 52 20 3f 20 |case == |UPPER ? |
|00002710| 75 63 5f 77 6b 64 61 79 | 20 3a 20 6d 63 5f 77 6b |uc_wkday| : mc_wk|
|00002720| 64 61 79 3b 0a 20 20 20 | 20 66 6f 72 20 28 6a 20 |day;. | for (j |
|00002730| 3d 20 30 3b 20 6a 20 3c | 20 37 3b 20 6a 2b 2b 29 |= 0; j <| 7; j++)|
|00002740| 0a 20 20 20 20 20 20 20 | 20 70 72 69 6e 74 66 28 |. | printf(|
|00002750| 22 7c 25 31 33 2e 39 73 | 20 20 20 20 22 2c 20 77 |"|%13.9s| ", w|
|00002760| 6b 64 61 79 5b 6a 5d 29 | 3b 0a 20 20 20 20 70 72 |kday[j])|;. pr|
|00002770| 69 6e 74 66 28 22 7c 5c | 6e 22 29 3b 0a 20 20 20 |intf("|\|n");. |
|00002780| 20 70 72 69 6e 74 5f 6c | 69 6e 65 28 31 2c 20 4f | print_l|ine(1, O|
|00002790| 50 45 4e 29 3b 0a 20 20 | 20 20 0a 20 20 20 20 66 |PEN);. | . f|
|000027a0| 6f 72 20 28 69 20 3d 20 | 30 3b 20 69 20 3c 20 34 |or (i = |0; i < 4|
|000027b0| 3b 20 69 2b 2b 29 09 09 | 2f 2a 20 70 72 69 6e 74 |; i++)..|/* print|
|000027c0| 20 66 69 72 73 74 20 66 | 6f 75 72 20 72 6f 77 73 | first f|our rows|
|000027d0| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 7b 0a 20 20 | */. | {. |
|000027e0| 20 20 20 20 20 20 70 72 | 69 6e 74 5f 6c 69 6e 65 | pr|int_line|
|000027f0| 28 31 2c 20 53 4f 4c 49 | 44 29 3b 0a 20 20 20 20 |(1, SOLI|D);. |
|00002800| 20 20 20 20 70 72 69 6e | 74 5f 64 61 74 65 73 28 | prin|t_dates(|
|00002810| 63 75 72 72 2c 20 69 2c | 20 6a 75 73 74 29 3b 0a |curr, i,| just);.|
|00002820| 20 20 20 20 20 20 20 20 | 70 72 69 6e 74 5f 6c 69 | |print_li|
|00002830| 6e 65 28 37 2c 20 4f 50 | 45 4e 29 3b 0a 20 20 20 |ne(7, OP|EN);. |
|00002840| 20 20 20 20 20 7d 0a 20 | 0a 20 20 20 20 70 72 69 | }. |. pri|
|00002850| 6e 74 5f 6c 69 6e 65 28 | 31 2c 20 53 4f 4c 49 44 |nt_line(|1, SOLID|
|00002860| 29 3b 09 09 2f 2a 20 70 | 72 69 6e 74 20 62 6f 74 |);../* p|rint bot|
|00002870| 74 6f 6d 20 72 6f 77 20 | 2a 2f 0a 20 20 20 20 70 |tom row |*/. p|
|00002880| 72 69 6e 74 5f 64 61 74 | 65 73 28 63 75 72 72 2c |rint_dat|es(curr,|
|00002890| 20 34 2c 20 6a 75 73 74 | 29 3b 0a 20 20 20 20 70 | 4, just|);. p|
|000028a0| 72 69 6e 74 5f 6c 69 6e | 65 28 32 2c 20 4f 50 45 |rint_lin|e(2, OPE|
|000028b0| 4e 29 3b 0a 20 20 20 20 | 70 72 69 6e 74 5f 64 69 |N);. |print_di|
|000028c0| 76 69 64 65 72 28 63 75 | 72 72 2d 3e 64 61 74 65 |vider(cu|rr->date|
|000028d0| 73 5b 35 5d 29 3b 09 2f | 2a 20 64 69 76 69 64 65 |s[5]);./|* divide|
|000028e0| 72 20 66 6f 72 20 32 33 | 2f 33 30 2c 20 32 34 2f |r for 23|/30, 24/|
|000028f0| 33 31 20 2a 2f 0a 0a 20 | 20 20 20 70 72 69 6e 74 |31 */.. | print|
|00002900| 5f 6c 69 6e 65 28 33 2c | 20 4f 50 45 4e 29 3b 0a |_line(3,| OPEN);.|
|00002910| 20 20 20 20 70 72 69 6e | 74 5f 64 61 74 65 73 28 | prin|t_dates(|
|00002920| 63 75 72 72 2c 20 35 2c | 20 21 6a 75 73 74 29 3b |curr, 5,| !just);|
|00002930| 09 2f 2a 20 70 72 69 6e | 74 20 36 74 68 20 6c 69 |./* prin|t 6th li|
|00002940| 6e 65 20 28 33 30 2f 33 | 31 29 20 61 74 20 62 6f |ne (30/3|1) at bo|
|00002950| 74 74 6f 6d 20 2a 2f 0a | 20 20 20 20 70 72 69 6e |ttom */.| prin|
|00002960| 74 5f 6c 69 6e 65 28 31 | 2c 20 53 4f 4c 49 44 29 |t_line(1|, SOLID)|
|00002970| 3b 0a 20 20 20 20 7d 0a | 0c 0a 2f 2a 0a 20 2a 09 |;. }.|../*. *.|
|00002980| 46 69 6c 6c 20 69 6e 20 | 74 68 65 20 6d 6f 6e 74 |Fill in |the mont|
|00002990| 68 20 6e 61 6d 65 20 61 | 6e 64 20 64 61 74 65 20 |h name a|nd date |
|000029a0| 66 69 65 6c 64 73 20 6f | 66 20 61 20 73 70 65 63 |fields o|f a spec|
|000029b0| 69 66 69 65 64 20 63 61 | 6c 65 6e 64 61 72 20 72 |ified ca|lendar r|
|000029c0| 65 63 6f 72 64 0a 20 2a | 09 28 61 73 73 75 6d 65 |ecord. *|.(assume|
|000029d0| 73 20 6d 6d 2c 20 79 79 | 20 66 69 65 6c 64 73 20 |s mm, yy| fields |
|000029e0| 61 6c 72 65 61 64 79 20 | 66 69 6c 6c 65 64 20 69 |already |filled i|
|000029f0| 6e 29 0a 20 2a 2f 0a 66 | 69 6c 6c 43 61 6c 65 6e |n). */.f|illCalen|
|00002a00| 64 61 72 28 6d 6f 6e 74 | 68 29 0a 20 20 20 20 6d |dar(mont|h). m|
|00002a10| 70 74 72 20 6d 6f 6e 74 | 68 3b 09 09 09 2f 2a 20 |ptr mont|h;.../* |
|00002a20| 50 6f 69 6e 74 65 72 20 | 74 6f 20 6d 6f 6e 74 68 |Pointer |to month|
|00002a30| 20 69 6e 66 6f 20 72 65 | 63 6f 72 64 20 2a 2f 0a | info re|cord */.|
|00002a40| 20 20 20 20 7b 0a 20 20 | 20 20 74 79 70 65 64 65 | {. | typede|
|00002a50| 66 20 73 74 72 75 63 74 | 09 09 2f 2a 20 4c 6f 63 |f struct|../* Loc|
|00002a60| 61 6c 20 69 6e 66 6f 20 | 61 62 6f 75 74 20 6d 6f |al info |about mo|
|00002a70| 6e 74 68 73 20 2a 2f 0a | 09 7b 0a 09 63 68 61 72 |nths */.|.{..char|
|00002a80| 20 2a 6e 61 6d 65 5b 32 | 5d 3b 09 09 2f 2a 20 4e | *name[2|];../* N|
|00002a90| 61 6d 65 20 6f 66 20 6d | 6f 6e 74 68 20 28 6d 69 |ame of m|onth (mi|
|00002aa0| 78 65 64 2f 75 70 70 65 | 72 2d 63 61 73 65 29 09 |xed/uppe|r-case).|
|00002ab0| 2a 2f 0a 09 69 6e 74 20 | 6f 66 66 73 65 74 5b 32 |*/..int |offset[2|
|00002ac0| 5d 3b 09 09 2f 2a 20 4f | 66 66 73 65 74 20 6f 66 |];../* O|ffset of|
|00002ad0| 20 6d 2f 31 20 66 72 6f | 6d 20 31 2f 31 20 28 6e | m/1 fro|m 1/1 (n|
|00002ae0| 6f 6e 2d 6c 65 61 70 2f | 6c 65 61 70 29 20 2a 2f |on-leap/|leap) */|
|00002af0| 0a 09 69 6e 74 20 6c 65 | 6e 67 74 68 5b 32 5d 3b |..int le|ngth[2];|
|00002b00| 09 09 2f 2a 20 4c 65 6e | 67 74 68 20 28 6e 6f 6e |../* Len|gth (non|
|00002b10| 2d 6c 65 61 70 2f 6c 65 | 61 70 29 09 09 2a 2f 0a |-leap/le|ap)..*/.|
|00002b20| 09 7d 20 6d 6f 6e 74 68 | 49 6e 66 6f 3b 0a 20 0a |.} month|Info;. .|
|00002b30| 20 20 20 20 73 74 61 74 | 69 63 20 6d 6f 6e 74 68 | stat|ic month|
|00002b40| 49 6e 66 6f 20 69 6e 66 | 6f 5b 31 32 5d 20 3d 20 |Info inf|o[12] = |
|00002b50| 7b 0a 09 7b 20 7b 22 4a | 61 6e 75 61 72 79 22 2c |{..{ {"J|anuary",|
|00002b60| 09 22 4a 41 4e 55 41 52 | 59 22 7d 2c 09 7b 30 2c |."JANUAR|Y"},.{0,|
|00002b70| 20 30 7d 2c 09 7b 33 31 | 2c 20 33 31 7d 20 7d 2c | 0},.{31|, 31} },|
|00002b80| 0a 09 7b 20 7b 22 46 65 | 62 72 75 61 72 79 22 2c |..{ {"Fe|bruary",|
|00002b90| 09 22 46 45 42 52 55 41 | 52 59 22 7d 2c 09 7b 33 |."FEBRUA|RY"},.{3|
|00002ba0| 2c 20 33 7d 2c 09 7b 32 | 38 2c 20 32 39 7d 20 7d |, 3},.{2|8, 29} }|
|00002bb0| 2c 0a 09 7b 20 7b 22 4d | 61 72 63 68 22 2c 09 22 |,..{ {"M|arch",."|
|00002bc0| 4d 41 52 43 48 22 7d 2c | 09 7b 33 2c 20 34 7d 2c |MARCH"},|.{3, 4},|
|00002bd0| 09 7b 33 31 2c 20 33 31 | 7d 20 7d 2c 0a 09 7b 20 |.{31, 31|} },..{ |
|00002be0| 7b 22 41 70 72 69 6c 22 | 2c 09 22 41 50 52 49 4c |{"April"|,."APRIL|
|00002bf0| 22 7d 2c 09 7b 36 2c 20 | 30 7d 2c 09 7b 33 30 2c |"},.{6, |0},.{30,|
|00002c00| 20 33 30 7d 20 7d 2c 0a | 09 7b 20 7b 22 4d 61 79 | 30} },.|.{ {"May|
|00002c10| 22 2c 09 22 4d 41 59 22 | 7d 2c 09 09 7b 31 2c 20 |",."MAY"|},..{1, |
|00002c20| 32 7d 2c 09 7b 33 31 2c | 20 33 31 7d 20 7d 2c 0a |2},.{31,| 31} },.|
|00002c30| 09 7b 20 7b 22 4a 75 6e | 65 22 2c 09 22 4a 55 4e |.{ {"Jun|e",."JUN|
|00002c40| 45 22 7d 2c 09 7b 34 2c | 20 35 7d 2c 09 7b 33 30 |E"},.{4,| 5},.{30|
|00002c50| 2c 20 33 30 7d 20 7d 2c | 0a 09 7b 20 7b 22 4a 75 |, 30} },|..{ {"Ju|
|00002c60| 6c 79 22 2c 09 22 4a 55 | 4c 59 22 7d 2c 09 7b 36 |ly",."JU|LY"},.{6|
|00002c70| 2c 20 30 7d 2c 09 7b 33 | 31 2c 20 33 31 7d 20 7d |, 0},.{3|1, 31} }|
|00002c80| 2c 0a 09 7b 20 7b 22 41 | 75 67 75 73 74 22 2c 09 |,..{ {"A|ugust",.|
|00002c90| 22 41 55 47 55 53 54 22 | 7d 2c 09 7b 32 2c 20 33 |"AUGUST"|},.{2, 3|
|00002ca0| 7d 2c 09 7b 33 31 2c 20 | 33 31 7d 20 7d 2c 0a 09 |},.{31, |31} },..|
|00002cb0| 7b 20 7b 22 53 65 70 74 | 65 6d 62 65 72 22 2c 09 |{ {"Sept|ember",.|
|00002cc0| 22 53 45 50 54 45 4d 42 | 45 52 22 7d 2c 09 7b 35 |"SEPTEMB|ER"},.{5|
|00002cd0| 2c 20 36 7d 2c 09 7b 33 | 30 2c 20 33 30 7d 20 7d |, 6},.{3|0, 30} }|
|00002ce0| 2c 0a 09 7b 20 7b 22 4f | 63 74 6f 62 65 72 22 2c |,..{ {"O|ctober",|
|00002cf0| 09 22 4f 43 54 4f 42 45 | 52 22 7d 2c 09 7b 30 2c |."OCTOBE|R"},.{0,|
|00002d00| 20 31 7d 2c 09 7b 33 31 | 2c 20 33 31 7d 20 7d 2c | 1},.{31|, 31} },|
|00002d10| 0a 09 7b 20 7b 22 4e 6f | 76 65 6d 62 65 72 22 2c |..{ {"No|vember",|
|00002d20| 09 22 4e 4f 56 45 4d 42 | 45 52 22 7d 2c 09 7b 33 |."NOVEMB|ER"},.{3|
|00002d30| 2c 20 34 7d 2c 09 7b 33 | 30 2c 20 33 30 7d 20 7d |, 4},.{3|0, 30} }|
|00002d40| 2c 0a 09 7b 20 7b 22 44 | 65 63 65 6d 62 65 72 22 |,..{ {"D|ecember"|
|00002d50| 2c 09 22 44 45 43 45 4d | 42 45 52 22 7d 2c 09 7b |,."DECEM|BER"},.{|
|00002d60| 35 2c 20 36 7d 2c 09 7b | 33 31 2c 20 33 31 7d 20 |5, 6},.{|31, 31} |
|00002d70| 7d 0a 20 20 20 20 7d 3b | 0a 20 0a 20 20 20 20 69 |}. };|. . i|
|00002d80| 6e 74 20 69 2c 20 66 69 | 72 73 74 2c 20 6c 61 73 |nt i, fi|rst, las|
|00002d90| 74 2c 20 64 61 74 65 20 | 3d 20 30 2c 20 79 20 3d |t, date |= 0, y =|
|00002da0| 20 6d 6f 6e 74 68 2d 3e | 79 79 2c 20 6d 20 3d 20 | month->|yy, m = |
|00002db0| 6d 6f 6e 74 68 2d 3e 6d | 6d 2d 31 3b 0a 20 20 20 |month->m|m-1;. |
|00002dc0| 20 69 6e 74 20 6c 65 61 | 70 20 3d 20 69 73 4c 65 | int lea|p = isLe|
|00002dd0| 61 70 28 79 29 3b 0a 20 | 0a 20 20 20 20 66 69 72 |ap(y);. |. fir|
|00002de0| 73 74 20 3d 20 28 79 20 | 2b 20 28 79 2d 31 29 2f |st = (y |+ (y-1)/|
|00002df0| 34 20 2d 20 28 79 2d 31 | 29 2f 31 30 30 20 2b 20 |4 - (y-1|)/100 + |
|00002e00| 28 79 2d 31 29 2f 34 30 | 30 20 2b 20 69 6e 66 6f |(y-1)/40|0 + info|
|00002e10| 5b 6d 5d 2e 6f 66 66 73 | 65 74 5b 6c 65 61 70 5d |[m].offs|et[leap]|
|00002e20| 29 20 25 20 37 3b 0a 20 | 20 20 20 6c 61 73 74 20 |) % 7;. | last |
|00002e30| 3d 20 66 69 72 73 74 20 | 2b 20 69 6e 66 6f 5b 6d |= first |+ info[m|
|00002e40| 5d 2e 6c 65 6e 67 74 68 | 5b 6c 65 61 70 5d 20 2d |].length|[leap] -|
|00002e50| 20 31 3b 0a 20 0a 20 20 | 20 20 66 6f 72 20 28 69 | 1;. . | for (i|
|00002e60| 20 3d 20 30 3b 20 69 20 | 3c 20 34 32 3b 20 69 2b | = 0; i |< 42; i+|
|00002e70| 2b 29 09 09 09 2f 2a 20 | 66 69 6c 6c 20 69 6e 20 |+).../* |fill in |
|00002e80| 74 68 65 20 64 61 74 65 | 73 20 2a 2f 0a 09 69 66 |the date|s */..if|
|00002e90| 20 28 69 20 3c 20 66 69 | 72 73 74 20 7c 7c 20 69 | (i < fi|rst || i|
|00002ea0| 20 3e 20 6c 61 73 74 29 | 0a 09 20 20 20 20 73 74 | > last)|.. st|
|00002eb0| 72 63 70 79 28 6d 6f 6e | 74 68 2d 3e 64 61 74 65 |rcpy(mon|th->date|
|00002ec0| 73 5b 69 2f 37 5d 5b 69 | 25 37 5d 2c 20 22 20 20 |s[i/7][i|%7], " |
|00002ed0| 22 29 3b 0a 09 65 6c 73 | 65 0a 09 20 20 20 20 73 |");..els|e.. s|
|00002ee0| 70 72 69 6e 74 66 28 6d | 6f 6e 74 68 2d 3e 64 61 |printf(m|onth->da|
|00002ef0| 74 65 73 5b 69 2f 37 5d | 5b 69 25 37 5d 2c 20 22 |tes[i/7]|[i%7], "|
|00002f00| 25 32 64 22 2c 20 2b 2b | 64 61 74 65 29 3b 0a 20 |%2d", ++|date);. |
|00002f10| 0a 20 20 20 20 73 74 72 | 63 70 79 28 6d 6f 6e 74 |. str|cpy(mont|
|00002f20| 68 2d 3e 6d 6d 6e 61 6d | 65 2c 20 69 6e 66 6f 5b |h->mmnam|e, info[|
|00002f30| 6d 5d 2e 6e 61 6d 65 5b | 6f 63 61 73 65 5d 29 3b |m].name[|ocase]);|
|00002f40| 09 2f 2a 20 63 6f 70 79 | 20 6e 61 6d 65 20 6f 66 |./* copy| name of|
|00002f50| 20 6d 6f 6e 74 68 20 2a | 2f 0a 20 20 20 20 7d 20 | month *|/. } |
|00002f60| 0a 0c 0a 2f 2a 0a 20 2a | 09 50 72 69 6e 74 20 6f |.../*. *|.Print o|
|00002f70| 6e 65 20 6c 69 6e 65 20 | 6f 66 20 61 20 73 6d 61 |ne line |of a sma|
|00002f80| 6c 6c 20 63 61 6c 65 6e | 64 61 72 20 28 70 72 65 |ll calen|dar (pre|
|00002f90| 76 69 6f 75 73 20 61 6e | 64 20 6e 65 78 74 20 6d |vious an|d next m|
|00002fa0| 6f 6e 74 68 73 20 69 6e | 0a 20 2a 09 75 70 70 65 |onths in|. *.uppe|
|00002fb0| 72 20 6c 65 66 74 20 61 | 6e 64 20 72 69 67 68 74 |r left a|nd right|
|00002fc0| 20 63 6f 72 6e 65 72 73 | 20 6f 66 20 6f 75 74 70 | corners| of outp|
|00002fd0| 75 74 29 0a 20 2a 2f 0a | 70 72 69 6e 74 53 6d 61 |ut). */.|printSma|
|00002fe0| 6c 6c 43 61 6c 28 6d 6f | 6e 74 68 2c 20 6c 69 6e |llCal(mo|nth, lin|
|00002ff0| 65 29 0a 20 20 20 20 6d | 70 74 72 20 6d 6f 6e 74 |e). m|ptr mont|
|00003000| 68 3b 09 09 09 2f 2a 20 | 4d 6f 6e 74 68 20 69 6e |h;.../* |Month in|
|00003010| 66 6f 20 72 65 63 6f 72 | 64 20 70 6f 69 6e 74 65 |fo recor|d pointe|
|00003020| 72 09 2a 2f 0a 20 20 20 | 20 69 6e 74 20 6c 69 6e |r.*/. | int lin|
|00003030| 65 3b 09 09 09 2f 2a 20 | 4c 69 6e 65 20 74 6f 20 |e;.../* |Line to |
|00003040| 70 72 69 6e 74 20 28 73 | 65 65 20 62 65 6c 6f 77 |print (s|ee below|
|00003050| 29 09 2a 2f 0a 20 20 20 | 20 7b 0a 20 20 20 20 69 |).*/. | {. i|
|00003060| 6e 74 20 69 3b 0a 20 20 | 0a 20 20 20 20 73 77 69 |nt i;. |. swi|
|00003070| 74 63 68 20 28 6c 69 6e | 65 29 0a 09 7b 0a 09 63 |tch (lin|e)..{..c|
|00003080| 61 73 65 20 30 3a 09 09 | 2f 2a 20 6d 6f 6e 74 68 |ase 0:..|/* month|
|00003090| 2f 79 65 61 72 20 61 74 | 20 74 6f 70 20 2a 2f 0a |/year at| top */.|
|000030a0| 09 20 20 20 20 70 72 69 | 6e 74 66 28 22 20 20 20 |. pri|ntf(" |
|000030b0| 25 2d 31 30 73 25 34 64 | 20 20 20 22 2c 20 6d 6f |%-10s%4d| ", mo|
|000030c0| 6e 74 68 2d 3e 6d 6d 6e | 61 6d 65 2c 20 6d 6f 6e |nth->mmn|ame, mon|
|000030d0| 74 68 2d 3e 79 79 29 3b | 0a 09 20 20 20 20 62 72 |th->yy);|.. br|
|000030e0| 65 61 6b 3b 0a 09 63 61 | 73 65 20 31 3a 09 09 2f |eak;..ca|se 1:../|
|000030f0| 2a 20 62 6c 61 6e 6b 20 | 6c 69 6e 65 20 2a 2f 0a |* blank |line */.|
|00003100| 09 20 20 20 20 70 72 69 | 6e 74 66 28 22 25 32 30 |. pri|ntf("%20|
|00003110| 73 22 2c 20 22 20 22 29 | 3b 0a 09 20 20 20 20 62 |s", " ")|;.. b|
|00003120| 72 65 61 6b 3b 0a 09 63 | 61 73 65 20 32 3a 09 09 |reak;..c|ase 2:..|
|00003130| 2f 2a 20 77 65 65 6b 64 | 61 79 73 20 2a 2f 0a 09 |/* weekd|ays */..|
|00003140| 20 20 20 20 70 72 69 6e | 74 66 28 6f 63 61 73 65 | prin|tf(ocase|
|00003150| 20 3d 3d 20 55 50 50 45 | 52 20 3f 20 22 53 55 20 | == UPPE|R ? "SU |
|00003160| 4d 4f 20 54 55 20 57 45 | 20 54 48 20 46 52 20 53 |MO TU WE| TH FR S|
|00003170| 41 22 20 3a 0a 09 09 09 | 09 20 20 20 20 22 53 75 |A" :....|. "Su|
|00003180| 20 4d 6f 20 54 75 20 57 | 65 20 54 68 20 46 72 20 | Mo Tu W|e Th Fr |
|00003190| 53 61 22 29 3b 0a 09 20 | 20 20 20 62 72 65 61 6b |Sa");.. | break|
|000031a0| 3b 0a 09 64 65 66 61 75 | 6c 74 3a 09 2f 2a 20 6c |;..defau|lt:./* l|
|000031b0| 69 6e 65 20 6f 66 20 63 | 61 6c 65 6e 64 61 72 20 |ine of c|alendar |
|000031c0| 2a 2f 0a 09 20 20 20 20 | 66 6f 72 20 28 69 20 3d |*/.. |for (i =|
|000031d0| 20 30 3b 20 69 20 3c 3d | 20 35 3b 20 69 2b 2b 29 | 0; i <=| 5; i++)|
|000031e0| 0a 20 20 20 20 09 09 70 | 72 69 6e 74 66 28 22 25 |. ..p|rintf("%|
|000031f0| 73 20 22 2c 20 6d 6f 6e | 74 68 2d 3e 64 61 74 65 |s ", mon|th->date|
|00003200| 73 5b 6c 69 6e 65 2d 33 | 5d 5b 69 5d 29 3b 0a 09 |s[line-3|][i]);..|
|00003210| 20 20 20 20 70 72 69 6e | 74 66 28 22 25 73 22 2c | prin|tf("%s",|
|00003220| 20 6d 6f 6e 74 68 2d 3e | 64 61 74 65 73 5b 6c 69 | month->|dates[li|
|00003230| 6e 65 2d 33 5d 5b 36 5d | 29 3b 0a 09 20 20 20 20 |ne-3][6]|);.. |
|00003240| 62 72 65 61 6b 3b 0a 09 | 7d 0a 20 20 20 20 7d 0a |break;..|}. }.|
|00003250| 0c 0a 2f 2a 0a 20 2a 09 | 50 72 69 6e 74 20 6e 20 |../*. *.|Print n |
|00003260| 6c 69 6e 65 73 20 69 6e | 20 73 65 6c 65 63 74 65 |lines in| selecte|
|00003270| 64 20 73 74 79 6c 65 0a | 20 2a 2f 0a 70 72 69 6e |d style.| */.prin|
|00003280| 74 5f 6c 69 6e 65 28 6e | 2c 20 73 74 79 6c 65 29 |t_line(n|, style)|
|00003290| 0a 20 20 20 20 69 6e 74 | 20 6e 3b 09 09 09 2f 2a |. int| n;.../*|
|000032a0| 20 4e 75 6d 62 65 72 20 | 6f 66 20 6c 69 6e 65 73 | Number |of lines|
|000032b0| 20 74 6f 20 70 72 69 6e | 74 20 28 3e 20 30 29 20 | to prin|t (> 0) |
|000032c0| 20 20 2a 2f 0a 20 20 20 | 20 69 6e 74 20 73 74 79 | */. | int sty|
|000032d0| 6c 65 3b 09 09 09 2f 2a | 20 53 4f 4c 49 44 20 6f |le;.../*| SOLID o|
|000032e0| 72 20 4f 50 45 4e 20 09 | 09 20 20 20 20 2a 2f 0a |r OPEN .|. */.|
|000032f0| 20 20 20 20 7b 0a 20 20 | 20 20 69 6e 74 20 69 3b | {. | int i;|
|00003300| 0a 20 20 20 20 63 68 61 | 72 20 2a 66 6d 74 31 20 |. cha|r *fmt1 |
|00003310| 3d 20 28 73 74 79 6c 65 | 20 3d 3d 20 53 4f 4c 49 |= (style| == SOLI|
|00003320| 44 29 20 3f 20 22 2b 2d | 2d 2d 2d 2d 2d 2d 2d 2d |D) ? "+-|--------|
|00003330| 2d 2d 2d 2d 2d 2d 2d 2d | 22 20 3a 0a 09 09 09 09 |--------|" :.....|
|00003340| 20 20 20 20 22 7c 20 20 | 20 20 20 20 20 20 20 20 | "| | |
|00003350| 20 20 20 20 20 20 20 22 | 20 3b 0a 20 20 20 20 63 | "| ;. c|
|00003360| 68 61 72 20 2a 66 6d 74 | 32 20 3d 20 28 73 74 79 |har *fmt|2 = (sty|
|00003370| 6c 65 20 3d 3d 20 53 4f | 4c 49 44 29 20 3f 20 22 |le == SO|LID) ? "|
|00003380| 2b 5c 6e 22 20 3a 20 22 | 7c 5c 6e 22 20 3b 0a 0a |+\n" : "||\n" ;..|
|00003390| 20 20 20 20 66 6f 72 20 | 28 3b 20 6e 20 3e 20 30 | for |(; n > 0|
|000033a0| 3b 20 6e 2d 2d 29 0a 09 | 7b 0a 09 70 72 69 6e 74 |; n--)..|{..print|
|000033b0| 66 28 22 20 20 22 29 3b | 0a 09 66 6f 72 20 28 69 |f(" ");|..for (i|
|000033c0| 20 3d 20 30 3b 20 69 20 | 3c 20 37 3b 20 69 2b 2b | = 0; i |< 7; i++|
|000033d0| 29 0a 09 20 20 20 20 70 | 72 69 6e 74 66 28 66 6d |).. p|rintf(fm|
|000033e0| 74 31 29 3b 0a 09 70 72 | 69 6e 74 66 28 66 6d 74 |t1);..pr|intf(fmt|
|000033f0| 32 29 3b 0a 09 7d 0a 20 | 20 20 20 7d 0a 0a 0a 0a |2);..}. | }....|
|00003400| 2f 2a 0a 20 2a 09 50 72 | 69 6e 74 20 6c 69 6e 65 |/*. *.Pr|int line|
|00003410| 20 6f 66 20 6c 61 72 67 | 65 20 63 61 6c 65 6e 64 | of larg|e calend|
|00003420| 61 72 20 28 6f 70 65 6e | 20 77 2f 6c 65 66 74 2d |ar (open| w/left-|
|00003430| 20 6f 72 20 72 69 67 68 | 74 2d 6a 75 73 74 69 66 | or righ|t-justif|
|00003440| 69 65 64 20 64 61 74 65 | 73 29 0a 20 2a 2f 0a 70 |ied date|s). */.p|
|00003450| 72 69 6e 74 5f 64 61 74 | 65 73 28 6d 6f 6e 74 68 |rint_dat|es(month|
|00003460| 2c 20 6c 69 6e 65 2c 20 | 6a 75 73 74 29 0a 20 20 |, line, |just). |
|00003470| 20 20 6d 70 74 72 20 6d | 6f 6e 74 68 3b 09 09 09 | mptr m|onth;...|
|00003480| 2f 2a 20 4d 6f 6e 74 68 | 20 69 6e 66 6f 20 72 65 |/* Month| info re|
|00003490| 63 6f 72 64 20 70 6f 69 | 6e 74 65 72 09 2a 2f 0a |cord poi|nter.*/.|
|000034a0| 20 20 20 20 69 6e 74 20 | 6c 69 6e 65 3b 09 09 09 | int |line;...|
|000034b0| 2f 2a 20 4c 69 6e 65 20 | 74 6f 20 70 72 69 6e 74 |/* Line |to print|
|000034c0| 20 28 30 2d 35 29 09 09 | 2a 2f 0a 20 20 20 20 69 | (0-5)..|*/. i|
|000034d0| 6e 74 20 6a 75 73 74 3b | 09 09 09 2f 2a 20 6a 75 |nt just;|.../* ju|
|000034e0| 73 74 69 66 69 63 61 74 | 69 6f 6e 20 28 4c 45 46 |stificat|ion (LEF|
|000034f0| 54 20 2f 20 52 49 47 48 | 54 29 09 2a 2f 0a 20 20 |T / RIGH|T).*/. |
|00003500| 20 20 7b 0a 20 20 20 20 | 69 6e 74 20 69 3b 0a 20 | {. |int i;. |
|00003510| 20 20 20 63 68 61 72 20 | 2a 66 6d 74 20 3d 20 28 | char |*fmt = (|
|00003520| 6a 75 73 74 20 3d 3d 20 | 4c 45 46 54 29 20 3f 20 |just == |LEFT) ? |
|00003530| 22 7c 20 25 2d 31 36 73 | 22 20 3a 20 22 7c 25 31 |"| %-16s|" : "|%1|
|00003540| 36 73 20 22 20 3b 0a 0a | 20 20 20 20 70 72 69 6e |6s " ;..| prin|
|00003550| 74 66 28 22 20 20 22 29 | 3b 0a 20 20 20 20 66 6f |tf(" ")|;. fo|
|00003560| 72 20 28 69 20 3d 20 30 | 3b 20 69 20 3c 20 37 3b |r (i = 0|; i < 7;|
|00003570| 20 69 2b 2b 29 0a 09 70 | 72 69 6e 74 66 28 66 6d | i++)..p|rintf(fm|
|00003580| 74 2c 20 6d 6f 6e 74 68 | 2d 3e 64 61 74 65 73 5b |t, month|->dates[|
|00003590| 6c 69 6e 65 5d 5b 69 5d | 29 3b 0a 20 20 20 20 70 |line][i]|);. p|
|000035a0| 72 69 6e 74 66 28 22 7c | 5c 6e 22 29 3b 0a 20 20 |rintf("||\n");. |
|000035b0| 20 20 7d 0a 0a 2f 2a 0a | 20 2a 09 50 72 69 6e 74 | }../*.| *.Print|
|000035c0| 20 64 69 76 69 64 65 72 | 20 62 65 74 77 65 65 6e | divider| between|
|000035d0| 20 32 33 2f 33 30 20 61 | 6e 64 20 32 34 2f 33 31 | 23/30 a|nd 24/31|
|000035e0| 0a 20 2a 2f 0a 70 72 69 | 6e 74 5f 64 69 76 69 64 |. */.pri|nt_divid|
|000035f0| 65 72 28 64 61 74 65 73 | 29 0a 20 20 20 20 63 68 |er(dates|). ch|
|00003600| 61 72 20 64 61 74 65 73 | 5b 37 5d 5b 33 5d 3b 0a |ar dates|[7][3];.|
|00003610| 20 20 20 20 7b 0a 20 20 | 20 20 69 6e 74 20 6a 3b | {. | int j;|
|00003620| 0a 0a 20 20 20 20 70 72 | 69 6e 74 66 28 22 20 20 |.. pr|intf(" |
|00003630| 22 29 3b 0a 20 20 20 20 | 66 6f 72 20 28 6a 20 3d |");. |for (j =|
|00003640| 20 30 3b 20 6a 20 3c 20 | 37 3b 20 6a 2b 2b 29 0a | 0; j < |7; j++).|
|00003650| 20 20 20 20 20 20 20 20 | 69 66 20 28 73 74 72 63 | |if (strc|
|00003660| 6d 70 28 64 61 74 65 73 | 5b 6a 5d 2c 20 22 20 20 |mp(dates|[j], " |
|00003670| 22 29 20 3d 3d 20 30 29 | 0a 20 20 20 20 09 20 20 |") == 0)|. . |
|00003680| 20 20 70 72 69 6e 74 66 | 28 22 7c 20 20 20 20 20 | printf|("| |
|00003690| 20 20 20 20 20 20 20 20 | 20 20 20 20 22 29 3b 0a | | ");.|
|000036a0| 20 20 20 20 20 20 20 20 | 65 6c 73 65 0a 20 20 20 | |else. |
|000036b0| 20 09 20 20 20 20 70 72 | 69 6e 74 66 28 22 7c 5f | . pr|intf("|_|
|000036c0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000036d0| 22 29 3b 0a 20 20 20 20 | 70 72 69 6e 74 66 28 22 |");. |printf("|
|000036e0| 7c 5c 6e 22 29 3b 0a 20 | 20 20 20 7d 0a 0a 0c 20 ||\n");. | }... |
|000036f0| 0a 2f 2a 0a 20 2a 09 50 | 72 69 6e 74 20 4c 53 20 |./*. *.P|rint LS |
|00003700| 36 20 62 69 74 73 20 6f | 66 20 6e 20 28 30 20 3d |6 bits o|f n (0 =|
|00003710| 20 27 20 27 3b 20 31 20 | 3d 20 73 65 6c 65 63 74 | ' '; 1 |= select|
|00003720| 65 64 20 6e 6f 6e 2d 62 | 6c 61 6e 6b 29 0a 20 2a |ed non-b|lank). *|
|00003730| 2f 0a 64 65 63 6f 64 65 | 28 6e 2c 20 63 29 0a 20 |/.decode|(n, c). |
|00003740| 20 20 20 69 6e 74 20 6e | 3b 09 09 09 09 2f 2a 20 | int n|;..../* |
|00003750| 4e 75 6d 62 65 72 20 74 | 6f 20 70 72 69 6e 74 20 |Number t|o print |
|00003760| 28 30 2d 33 31 29 20 2a | 2f 0a 20 20 20 20 63 68 |(0-31) *|/. ch|
|00003770| 61 72 20 63 3b 0a 20 20 | 20 20 7b 0a 20 20 20 20 |ar c;. | {. |
|00003780| 69 6e 74 20 6d 73 6b 20 | 3d 20 31 20 3c 3c 20 35 |int msk |= 1 << 5|
|00003790| 3b 0a 20 0a 20 20 20 20 | 66 6f 72 20 28 3b 20 6d |;. . |for (; m|
|000037a0| 73 6b 3b 20 6d 73 6b 20 | 2f 3d 20 32 29 20 0a 09 |sk; msk |/= 2) ..|
|000037b0| 70 72 69 6e 74 66 28 22 | 25 63 22 2c 20 28 6e 20 |printf("|%c", (n |
|000037c0| 26 20 6d 73 6b 29 20 3f | 20 63 20 3a 20 27 20 27 |& msk) ?| c : ' '|
|000037d0| 29 3b 0a 20 20 20 20 7d | 0a 20 0a 20 0a 2f 2a 0a |);. }|. . ./*.|
|000037e0| 20 2a 09 50 72 69 6e 74 | 20 6f 6e 65 20 6c 69 6e | *.Print| one lin|
|000037f0| 65 20 6f 66 20 73 74 72 | 69 6e 67 20 69 6e 20 6c |e of str|ing in l|
|00003800| 61 72 67 65 20 63 68 61 | 72 61 63 74 65 72 73 0a |arge cha|racters.|
|00003810| 20 2a 2f 0a 70 72 69 6e | 74 48 64 72 28 73 74 72 | */.prin|tHdr(str|
|00003820| 2c 20 6c 69 6e 65 2c 20 | 63 29 0a 20 20 20 20 63 |, line, |c). c|
|00003830| 68 61 72 20 2a 73 74 72 | 3b 09 09 09 09 2f 2a 20 |har *str|;..../* |
|00003840| 73 74 72 69 6e 67 20 74 | 6f 20 70 72 69 6e 74 09 |string t|o print.|
|00003850| 09 20 20 20 20 2a 2f 0a | 20 20 20 20 69 6e 74 20 |. */.| int |
|00003860| 6c 69 6e 65 3b 09 09 09 | 09 2f 2a 20 6c 69 6e 65 |line;...|./* line|
|00003870| 20 74 6f 20 70 72 69 6e | 74 20 28 30 2d 38 3b 20 | to prin|t (0-8; |
|00003880| 65 6c 73 65 20 62 6c 61 | 6e 6b 73 29 20 2a 2f 0a |else bla|nks) */.|
|00003890| 20 20 20 20 63 68 61 72 | 20 63 3b 09 09 09 09 2f | char| c;..../|
|000038a0| 2a 20 6f 75 74 70 75 74 | 20 63 68 61 72 61 63 74 |* output| charact|
|000038b0| 65 72 20 74 6f 20 75 73 | 65 09 20 20 20 20 2a 2f |er to us|e. */|
|000038c0| 0a 20 20 20 20 7b 0a 20 | 0a 20 20 20 20 2f 2a 20 |. {. |. /* |
|000038d0| 35 78 39 20 64 6f 74 2d | 6d 61 74 72 69 78 20 72 |5x9 dot-|matrix r|
|000038e0| 65 70 72 65 73 65 6e 74 | 61 74 69 6f 6e 73 20 6f |epresent|ations o|
|000038f0| 66 20 41 2d 5a 2c 20 61 | 2d 7a 2c 20 30 2d 39 20 |f A-Z, a|-z, 0-9 |
|00003900| 2a 2f 0a 20 0a 20 20 20 | 20 73 74 61 74 69 63 20 |*/. . | static |
|00003910| 63 68 61 72 20 75 70 70 | 65 72 73 5b 32 36 5d 5b |char upp|ers[26][|
|00003920| 39 5d 20 3d 0a 09 7b 0a | 09 7b 31 34 2c 20 31 37 |9] =..{.|.{14, 17|
|00003930| 2c 20 31 37 2c 20 33 31 | 2c 20 31 37 2c 20 31 37 |, 17, 31|, 17, 17|
|00003940| 2c 20 31 37 2c 20 20 30 | 2c 20 20 30 7d 2c 09 7b |, 17, 0|, 0},.{|
|00003950| 33 30 2c 20 31 37 2c 20 | 31 37 2c 20 33 30 2c 20 |30, 17, |17, 30, |
|00003960| 31 37 2c 20 31 37 2c 20 | 33 30 2c 20 20 30 2c 20 |17, 17, |30, 0, |
|00003970| 20 30 7d 2c 09 2f 2a 20 | 41 42 20 2a 2f 0a 09 7b | 0},./* |AB */..{|
|00003980| 31 34 2c 20 31 37 2c 20 | 31 36 2c 20 31 36 2c 20 |14, 17, |16, 16, |
|00003990| 31 36 2c 20 31 37 2c 20 | 31 34 2c 20 20 30 2c 20 |16, 17, |14, 0, |
|000039a0| 20 30 7d 2c 09 7b 33 30 | 2c 20 31 37 2c 20 31 37 | 0},.{30|, 17, 17|
|000039b0| 2c 20 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 33 30 |, 17, 17|, 17, 30|
|000039c0| 2c 20 20 30 2c 20 20 30 | 7d 2c 09 2f 2a 20 43 44 |, 0, 0|},./* CD|
|000039d0| 20 2a 2f 0a 09 7b 33 31 | 2c 20 31 36 2c 20 31 36 | */..{31|, 16, 16|
|000039e0| 2c 20 33 30 2c 20 31 36 | 2c 20 31 36 2c 20 33 31 |, 30, 16|, 16, 31|
|000039f0| 2c 20 20 30 2c 20 20 30 | 7d 2c 09 7b 33 31 2c 20 |, 0, 0|},.{31, |
|00003a00| 31 36 2c 20 31 36 2c 20 | 33 30 2c 20 31 36 2c 20 |16, 16, |30, 16, |
|00003a10| 31 36 2c 20 31 36 2c 20 | 20 30 2c 20 20 30 7d 2c |16, 16, | 0, 0},|
|00003a20| 09 2f 2a 20 45 46 20 2a | 2f 0a 09 7b 31 34 2c 20 |./* EF *|/..{14, |
|00003a30| 31 37 2c 20 31 36 2c 20 | 32 33 2c 20 31 37 2c 20 |17, 16, |23, 17, |
|00003a40| 31 37 2c 20 31 34 2c 20 | 20 30 2c 20 20 30 7d 2c |17, 14, | 0, 0},|
|00003a50| 09 7b 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 33 31 |.{17, 17|, 17, 31|
|00003a60| 2c 20 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 20 30 |, 17, 17|, 17, 0|
|00003a70| 2c 20 20 30 7d 2c 09 2f | 2a 20 47 48 20 2a 2f 0a |, 0},./|* GH */.|
|00003a80| 09 7b 33 31 2c 20 20 34 | 2c 20 20 34 2c 20 20 34 |.{31, 4|, 4, 4|
|00003a90| 2c 20 20 34 2c 20 20 34 | 2c 20 33 31 2c 20 20 30 |, 4, 4|, 31, 0|
|00003aa0| 2c 20 20 30 7d 2c 09 7b | 20 31 2c 20 20 31 2c 20 |, 0},.{| 1, 1, |
|00003ab0| 20 31 2c 20 20 31 2c 20 | 20 31 2c 20 31 37 2c 20 | 1, 1, | 1, 17, |
|00003ac0| 31 34 2c 20 20 30 2c 20 | 20 30 7d 2c 09 2f 2a 20 |14, 0, | 0},./* |
|00003ad0| 49 4a 20 2a 2f 0a 09 7b | 31 37 2c 20 31 38 2c 20 |IJ */..{|17, 18, |
|00003ae0| 32 30 2c 20 32 34 2c 20 | 32 30 2c 20 31 38 2c 20 |20, 24, |20, 18, |
|00003af0| 31 37 2c 20 20 30 2c 20 | 20 30 7d 2c 09 7b 31 36 |17, 0, | 0},.{16|
|00003b00| 2c 20 31 36 2c 20 31 36 | 2c 20 31 36 2c 20 31 36 |, 16, 16|, 16, 16|
|00003b10| 2c 20 31 36 2c 20 33 31 | 2c 20 20 30 2c 20 20 30 |, 16, 31|, 0, 0|
|00003b20| 7d 2c 09 2f 2a 20 4b 4c | 20 2a 2f 0a 09 7b 31 37 |},./* KL| */..{17|
|00003b30| 2c 20 32 37 2c 20 32 31 | 2c 20 32 31 2c 20 31 37 |, 27, 21|, 21, 17|
|00003b40| 2c 20 31 37 2c 20 31 37 | 2c 20 20 30 2c 20 20 30 |, 17, 17|, 0, 0|
|00003b50| 7d 2c 09 7b 31 37 2c 20 | 31 37 2c 20 32 35 2c 20 |},.{17, |17, 25, |
|00003b60| 32 31 2c 20 31 39 2c 20 | 31 37 2c 20 31 37 2c 20 |21, 19, |17, 17, |
|00003b70| 20 30 2c 20 20 30 7d 2c | 09 2f 2a 20 4d 4e 20 2a | 0, 0},|./* MN *|
|00003b80| 2f 0a 09 7b 31 34 2c 20 | 31 37 2c 20 31 37 2c 20 |/..{14, |17, 17, |
|00003b90| 31 37 2c 20 31 37 2c 20 | 31 37 2c 20 31 34 2c 20 |17, 17, |17, 14, |
|00003ba0| 20 30 2c 20 20 30 7d 2c | 09 7b 33 30 2c 20 31 37 | 0, 0},|.{30, 17|
|00003bb0| 2c 20 31 37 2c 20 33 30 | 2c 20 31 36 2c 20 31 36 |, 17, 30|, 16, 16|
|00003bc0| 2c 20 31 36 2c 20 20 30 | 2c 20 20 30 7d 2c 09 2f |, 16, 0|, 0},./|
|00003bd0| 2a 20 4f 50 20 2a 2f 0a | 09 7b 31 34 2c 20 31 37 |* OP */.|.{14, 17|
|00003be0| 2c 20 31 37 2c 20 31 37 | 2c 20 32 31 2c 20 31 38 |, 17, 17|, 21, 18|
|00003bf0| 2c 20 31 33 2c 20 20 30 | 2c 20 20 30 7d 2c 09 7b |, 13, 0|, 0},.{|
|00003c00| 33 30 2c 20 31 37 2c 20 | 31 37 2c 20 33 30 2c 20 |30, 17, |17, 30, |
|00003c10| 32 30 2c 20 31 38 2c 20 | 31 37 2c 20 20 30 2c 20 |20, 18, |17, 0, |
|00003c20| 20 30 7d 2c 09 2f 2a 20 | 51 52 20 2a 2f 0a 09 7b | 0},./* |QR */..{|
|00003c30| 31 34 2c 20 31 37 2c 20 | 31 36 2c 20 31 34 2c 20 |14, 17, |16, 14, |
|00003c40| 20 31 2c 20 31 37 2c 20 | 31 34 2c 20 20 30 2c 20 | 1, 17, |14, 0, |
|00003c50| 20 30 7d 2c 09 7b 33 31 | 2c 20 20 34 2c 20 20 34 | 0},.{31|, 4, 4|
|00003c60| 2c 20 20 34 2c 20 20 34 | 2c 20 20 34 2c 20 20 34 |, 4, 4|, 4, 4|
|00003c70| 2c 20 20 30 2c 20 20 30 | 7d 2c 09 2f 2a 20 53 54 |, 0, 0|},./* ST|
|00003c80| 20 2a 2f 0a 09 7b 31 37 | 2c 20 31 37 2c 20 31 37 | */..{17|, 17, 17|
|00003c90| 2c 20 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 31 34 |, 17, 17|, 17, 14|
|00003ca0| 2c 20 20 30 2c 20 20 30 | 7d 2c 09 7b 31 37 2c 20 |, 0, 0|},.{17, |
|00003cb0| 31 37 2c 20 31 37 2c 20 | 31 37 2c 20 31 37 2c 20 |17, 17, |17, 17, |
|00003cc0| 31 30 2c 20 20 34 2c 20 | 20 30 2c 20 20 30 7d 2c |10, 4, | 0, 0},|
|00003cd0| 09 2f 2a 20 55 56 20 2a | 2f 0a 09 7b 31 37 2c 20 |./* UV *|/..{17, |
|00003ce0| 31 37 2c 20 31 37 2c 20 | 32 31 2c 20 32 31 2c 20 |17, 17, |21, 21, |
|00003cf0| 32 31 2c 20 31 30 2c 20 | 20 30 2c 20 20 30 7d 2c |21, 10, | 0, 0},|
|00003d00| 09 7b 31 37 2c 20 31 37 | 2c 20 31 30 2c 20 20 34 |.{17, 17|, 10, 4|
|00003d10| 2c 20 31 30 2c 20 31 37 | 2c 20 31 37 2c 20 20 30 |, 10, 17|, 17, 0|
|00003d20| 2c 20 20 30 7d 2c 09 2f | 2a 20 57 58 20 2a 2f 0a |, 0},./|* WX */.|
|00003d30| 09 7b 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 31 34 |.{17, 17|, 17, 14|
|00003d40| 2c 20 20 34 2c 20 20 34 | 2c 20 20 34 2c 20 20 30 |, 4, 4|, 4, 0|
|00003d50| 2c 20 20 30 7d 2c 09 7b | 33 31 2c 20 20 31 2c 20 |, 0},.{|31, 1, |
|00003d60| 20 32 2c 20 20 34 2c 20 | 20 38 2c 20 31 36 2c 20 | 2, 4, | 8, 16, |
|00003d70| 33 31 2c 20 20 30 2c 20 | 20 30 7d 09 2f 2a 20 59 |31, 0, | 0}./* Y|
|00003d80| 5a 20 2a 2f 0a 09 7d 3b | 20 0a 20 0a 20 20 20 20 |Z */..};| . . |
|00003d90| 73 74 61 74 69 63 20 63 | 68 61 72 20 6c 6f 77 65 |static c|har lowe|
|00003da0| 72 73 5b 32 36 5d 5b 39 | 5d 20 3d 0a 09 7b 0a 09 |rs[26][9|] =..{..|
|00003db0| 7b 20 30 2c 20 20 30 2c | 20 31 34 2c 20 20 31 2c |{ 0, 0,| 14, 1,|
|00003dc0| 20 31 35 2c 20 31 37 2c | 20 31 35 2c 20 20 30 2c | 15, 17,| 15, 0,|
|00003dd0| 20 20 30 7d 2c 09 7b 31 | 36 2c 20 31 36 2c 20 33 | 0},.{1|6, 16, 3|
|00003de0| 30 2c 20 31 37 2c 20 31 | 37 2c 20 31 37 2c 20 33 |0, 17, 1|7, 17, 3|
|00003df0| 30 2c 20 20 30 2c 20 20 | 30 7d 2c 09 2f 2a 20 61 |0, 0, |0},./* a|
|00003e00| 62 20 2a 2f 0a 09 7b 20 | 30 2c 20 20 30 2c 20 31 |b */..{ |0, 0, 1|
|00003e10| 35 2c 20 31 36 2c 20 31 | 36 2c 20 31 36 2c 20 31 |5, 16, 1|6, 16, 1|
|00003e20| 35 2c 20 20 30 2c 20 20 | 30 7d 2c 09 7b 20 31 2c |5, 0, |0},.{ 1,|
|00003e30| 20 20 31 2c 20 31 35 2c | 20 31 37 2c 20 31 37 2c | 1, 15,| 17, 17,|
|00003e40| 20 31 37 2c 20 31 35 2c | 20 20 30 2c 20 20 30 7d | 17, 15,| 0, 0}|
|00003e50| 2c 09 2f 2a 20 63 64 20 | 2a 2f 0a 09 7b 20 30 2c |,./* cd |*/..{ 0,|
|00003e60| 20 20 30 2c 20 31 34 2c | 20 31 37 2c 20 33 31 2c | 0, 14,| 17, 31,|
|00003e70| 20 31 36 2c 20 31 34 2c | 20 20 30 2c 20 20 30 7d | 16, 14,| 0, 0}|
|00003e80| 2c 09 7b 20 36 2c 20 20 | 39 2c 20 32 38 2c 20 20 |,.{ 6, |9, 28, |
|00003e90| 38 2c 20 20 38 2c 20 20 | 38 2c 20 20 38 2c 20 20 |8, 8, |8, 8, |
|00003ea0| 30 2c 20 20 30 7d 2c 09 | 2f 2a 20 65 66 20 2a 2f |0, 0},.|/* ef */|
|00003eb0| 0a 09 7b 20 30 2c 20 20 | 30 2c 20 31 34 2c 20 31 |..{ 0, |0, 14, 1|
|00003ec0| 37 2c 20 31 37 2c 20 31 | 37 2c 20 31 35 2c 20 20 |7, 17, 1|7, 15, |
|00003ed0| 31 2c 20 31 34 7d 2c 09 | 7b 31 36 2c 20 31 36 2c |1, 14},.|{16, 16,|
|00003ee0| 20 33 30 2c 20 31 37 2c | 20 31 37 2c 20 31 37 2c | 30, 17,| 17, 17,|
|00003ef0| 20 31 37 2c 20 20 30 2c | 20 20 30 7d 2c 09 2f 2a | 17, 0,| 0},./*|
|00003f00| 20 67 68 20 2a 2f 0a 09 | 7b 20 34 2c 20 20 30 2c | gh */..|{ 4, 0,|
|00003f10| 20 31 32 2c 20 20 34 2c | 20 20 34 2c 20 20 34 2c | 12, 4,| 4, 4,|
|00003f20| 20 33 31 2c 20 20 30 2c | 20 20 30 7d 2c 09 7b 20 | 31, 0,| 0},.{ |
|00003f30| 31 2c 20 20 30 2c 20 20 | 33 2c 20 20 31 2c 20 20 |1, 0, |3, 1, |
|00003f40| 31 2c 20 20 31 2c 20 20 | 31 2c 20 31 37 2c 20 31 |1, 1, |1, 17, 1|
|00003f50| 34 7d 2c 09 2f 2a 20 69 | 6a 20 2a 2f 0a 09 7b 31 |4},./* i|j */..{1|
|00003f60| 36 2c 20 31 36 2c 20 31 | 37 2c 20 31 38 2c 20 32 |6, 16, 1|7, 18, 2|
|00003f70| 38 2c 20 31 38 2c 20 31 | 37 2c 20 20 30 2c 20 20 |8, 18, 1|7, 0, |
|00003f80| 30 7d 2c 09 7b 31 32 2c | 20 20 34 2c 20 20 34 2c |0},.{12,| 4, 4,|
|00003f90| 20 20 34 2c 20 20 34 2c | 20 20 34 2c 20 33 31 2c | 4, 4,| 4, 31,|
|00003fa0| 20 20 30 2c 20 20 30 7d | 2c 09 2f 2a 20 6b 6c 20 | 0, 0}|,./* kl |
|00003fb0| 2a 2f 0a 09 7b 20 30 2c | 20 20 30 2c 20 33 30 2c |*/..{ 0,| 0, 30,|
|00003fc0| 20 32 31 2c 20 32 31 2c | 20 32 31 2c 20 32 31 2c | 21, 21,| 21, 21,|
|00003fd0| 20 20 30 2c 20 20 30 7d | 2c 09 7b 20 30 2c 20 20 | 0, 0}|,.{ 0, |
|00003fe0| 30 2c 20 33 30 2c 20 31 | 37 2c 20 31 37 2c 20 31 |0, 30, 1|7, 17, 1|
|00003ff0| 37 2c 20 31 37 2c 20 20 | 30 2c 20 20 30 7d 2c 09 |7, 17, |0, 0},.|
|00004000| 2f 2a 20 6d 6e 20 2a 2f | 0a 09 7b 20 30 2c 20 20 |/* mn */|..{ 0, |
|00004010| 30 2c 20 31 34 2c 20 31 | 37 2c 20 31 37 2c 20 31 |0, 14, 1|7, 17, 1|
|00004020| 37 2c 20 31 34 2c 20 20 | 30 2c 20 20 30 7d 2c 09 |7, 14, |0, 0},.|
|00004030| 7b 20 30 2c 20 20 30 2c | 20 33 30 2c 20 31 37 2c |{ 0, 0,| 30, 17,|
|00004040| 20 31 37 2c 20 31 37 2c | 20 33 30 2c 20 31 36 2c | 17, 17,| 30, 16,|
|00004050| 20 31 36 7d 2c 09 2f 2a | 20 6f 70 20 2a 2f 0a 09 | 16},./*| op */..|
|00004060| 7b 20 30 2c 20 20 30 2c | 20 31 35 2c 20 31 37 2c |{ 0, 0,| 15, 17,|
|00004070| 20 31 37 2c 20 31 37 2c | 20 31 35 2c 20 20 31 2c | 17, 17,| 15, 1,|
|00004080| 20 20 31 7d 2c 09 7b 20 | 30 2c 20 20 30 2c 20 33 | 1},.{ |0, 0, 3|
|00004090| 30 2c 20 31 37 2c 20 31 | 36 2c 20 31 36 2c 20 31 |0, 17, 1|6, 16, 1|
|000040a0| 36 2c 20 20 30 2c 20 20 | 30 7d 2c 09 2f 2a 20 71 |6, 0, |0},./* q|
|000040b0| 72 20 2a 2f 0a 09 7b 20 | 30 2c 20 20 30 2c 20 31 |r */..{ |0, 0, 1|
|000040c0| 35 2c 20 31 36 2c 20 31 | 34 2c 20 20 31 2c 20 33 |5, 16, 1|4, 1, 3|
|000040d0| 30 2c 20 20 30 2c 20 20 | 30 7d 2c 09 7b 20 38 2c |0, 0, |0},.{ 8,|
|000040e0| 20 20 38 2c 20 33 30 2c | 20 20 38 2c 20 20 38 2c | 8, 30,| 8, 8,|
|000040f0| 20 20 39 2c 20 20 36 2c | 20 20 30 2c 20 20 30 7d | 9, 6,| 0, 0}|
|00004100| 2c 09 2f 2a 20 73 74 20 | 2a 2f 0a 09 7b 20 30 2c |,./* st |*/..{ 0,|
|00004110| 20 20 30 2c 20 31 37 2c | 20 31 37 2c 20 31 37 2c | 0, 17,| 17, 17,|
|00004120| 20 31 37 2c 20 31 34 2c | 20 20 30 2c 20 20 30 7d | 17, 14,| 0, 0}|
|00004130| 2c 09 7b 20 30 2c 20 20 | 30 2c 20 31 37 2c 20 31 |,.{ 0, |0, 17, 1|
|00004140| 37 2c 20 31 37 2c 20 31 | 30 2c 20 20 34 2c 20 20 |7, 17, 1|0, 4, |
|00004150| 30 2c 20 20 30 7d 2c 09 | 2f 2a 20 75 76 20 2a 2f |0, 0},.|/* uv */|
|00004160| 0a 09 7b 20 30 2c 20 20 | 30 2c 20 31 37 2c 20 32 |..{ 0, |0, 17, 2|
|00004170| 31 2c 20 32 31 2c 20 32 | 31 2c 20 31 30 2c 20 20 |1, 21, 2|1, 10, |
|00004180| 30 2c 20 20 30 7d 2c 09 | 7b 20 30 2c 20 20 30 2c |0, 0},.|{ 0, 0,|
|00004190| 20 31 37 2c 20 31 30 2c | 20 20 34 2c 20 31 30 2c | 17, 10,| 4, 10,|
|000041a0| 20 31 37 2c 20 20 30 2c | 20 20 30 7d 2c 09 2f 2a | 17, 0,| 0},./*|
|000041b0| 20 77 78 20 2a 2f 0a 09 | 7b 20 30 2c 20 20 30 2c | wx */..|{ 0, 0,|
|000041c0| 20 31 37 2c 20 31 37 2c | 20 31 37 2c 20 31 37 2c | 17, 17,| 17, 17,|
|000041d0| 20 31 35 2c 20 20 31 2c | 20 31 34 7d 2c 09 7b 20 | 15, 1,| 14},.{ |
|000041e0| 30 2c 20 20 30 2c 20 33 | 31 2c 20 20 32 2c 20 20 |0, 0, 3|1, 2, |
|000041f0| 34 2c 20 20 38 2c 20 33 | 31 2c 20 20 30 2c 20 20 |4, 8, 3|1, 0, |
|00004200| 30 7d 09 2f 2a 20 79 7a | 20 2a 2f 0a 09 7d 3b 0a |0}./* yz| */..};.|
|00004210| 0a 20 20 20 20 73 74 61 | 74 69 63 20 63 68 61 72 |. sta|tic char|
|00004220| 20 64 69 67 69 74 73 5b | 31 30 5d 5b 39 5d 20 3d | digits[|10][9] =|
|00004230| 0a 09 7b 0a 09 7b 31 34 | 2c 20 31 37 2c 20 31 37 |..{..{14|, 17, 17|
|00004240| 2c 20 31 37 2c 20 31 37 | 2c 20 31 37 2c 20 31 34 |, 17, 17|, 17, 14|
|00004250| 2c 20 20 30 2c 20 20 30 | 7d 2c 09 7b 20 32 2c 20 |, 0, 0|},.{ 2, |
|00004260| 20 36 2c 20 31 30 2c 20 | 20 32 2c 20 20 32 2c 20 | 6, 10, | 2, 2, |
|00004270| 20 32 2c 20 33 31 2c 20 | 20 30 2c 20 20 30 7d 2c | 2, 31, | 0, 0},|
|00004280| 09 2f 2a 20 30 31 20 2a | 2f 0a 09 7b 31 34 2c 20 |./* 01 *|/..{14, |
|00004290| 31 37 2c 20 20 32 2c 20 | 20 34 2c 20 20 38 2c 20 |17, 2, | 4, 8, |
|000042a0| 31 36 2c 20 33 31 2c 20 | 20 30 2c 20 20 30 7d 2c |16, 31, | 0, 0},|
|000042b0| 09 7b 31 34 2c 20 31 37 | 2c 20 20 31 2c 20 31 34 |.{14, 17|, 1, 14|
|000042c0| 2c 20 20 31 2c 20 31 37 | 2c 20 31 34 2c 20 20 30 |, 1, 17|, 14, 0|
|000042d0| 2c 20 20 30 7d 2c 09 2f | 2a 20 32 33 20 2a 2f 0a |, 0},./|* 23 */.|
|000042e0| 09 7b 20 32 2c 20 20 36 | 2c 20 31 30 2c 20 33 31 |.{ 2, 6|, 10, 31|
|000042f0| 2c 20 20 32 2c 20 20 32 | 2c 20 20 32 2c 20 20 30 |, 2, 2|, 2, 0|
|00004300| 2c 20 20 30 7d 2c 09 7b | 33 31 2c 20 31 36 2c 20 |, 0},.{|31, 16, |
|00004310| 31 36 2c 20 33 30 2c 20 | 20 31 2c 20 31 37 2c 20 |16, 30, | 1, 17, |
|00004320| 31 34 2c 20 20 30 2c 20 | 20 30 7d 2c 09 2f 2a 20 |14, 0, | 0},./* |
|00004330| 34 35 20 2a 2f 0a 09 7b | 31 34 2c 20 31 37 2c 20 |45 */..{|14, 17, |
|00004340| 31 36 2c 20 33 30 2c 20 | 31 37 2c 20 31 37 2c 20 |16, 30, |17, 17, |
|00004350| 31 34 2c 20 20 30 2c 20 | 20 30 7d 2c 09 7b 33 31 |14, 0, | 0},.{31|
|00004360| 2c 20 20 31 2c 20 20 32 | 2c 20 20 34 2c 20 20 38 |, 1, 2|, 4, 8|
|00004370| 2c 20 31 36 2c 20 31 36 | 2c 20 20 30 2c 20 20 30 |, 16, 16|, 0, 0|
|00004380| 7d 2c 09 2f 2a 20 36 37 | 20 2a 2f 0a 09 7b 31 34 |},./* 67| */..{14|
|00004390| 2c 20 31 37 2c 20 31 37 | 2c 20 31 34 2c 20 31 37 |, 17, 17|, 14, 17|
|000043a0| 2c 20 31 37 2c 20 31 34 | 2c 20 20 30 2c 20 20 30 |, 17, 14|, 0, 0|
|000043b0| 7d 2c 09 7b 31 34 2c 20 | 31 37 2c 20 31 37 2c 20 |},.{14, |17, 17, |
|000043c0| 31 35 2c 20 20 31 2c 20 | 31 37 2c 20 31 34 2c 20 |15, 1, |17, 14, |
|000043d0| 20 30 2c 20 20 30 7d 09 | 2f 2a 20 38 39 20 2a 2f | 0, 0}.|/* 89 */|
|000043e0| 0a 09 7d 3b 0a 20 0a 20 | 20 20 20 63 68 61 72 20 |..};. . | char |
|000043f0| 63 68 3b 0a 20 0a 20 20 | 20 20 66 6f 72 20 28 20 |ch;. . | for ( |
|00004400| 3b 20 2a 73 74 72 3b 20 | 73 74 72 2b 2b 29 0a 09 |; *str; |str++)..|
|00004410| 7b 0a 09 63 68 20 3d 20 | 28 6c 69 6e 65 20 3e 3d |{..ch = |(line >=|
|00004420| 20 30 20 26 26 20 6c 69 | 6e 65 20 3c 3d 20 38 29 | 0 && li|ne <= 8)|
|00004430| 20 3f 20 2a 73 74 72 20 | 3a 20 27 20 27 3b 0a 09 | ? *str |: ' ';..|
|00004440| 69 66 20 28 69 73 75 70 | 70 65 72 28 63 68 29 29 |if (isup|per(ch))|
|00004450| 0a 09 20 20 20 20 64 65 | 63 6f 64 65 28 75 70 70 |.. de|code(upp|
|00004460| 65 72 73 5b 63 68 2d 27 | 41 27 5d 5b 6c 69 6e 65 |ers[ch-'|A'][line|
|00004470| 5d 2c 20 63 29 3b 0a 09 | 65 6c 73 65 20 69 66 20 |], c);..|else if |
|00004480| 28 69 73 6c 6f 77 65 72 | 28 63 68 29 29 0a 09 20 |(islower|(ch)).. |
|00004490| 20 20 20 64 65 63 6f 64 | 65 28 6c 6f 77 65 72 73 | decod|e(lowers|
|000044a0| 5b 63 68 2d 27 61 27 5d | 5b 6c 69 6e 65 5d 2c 20 |[ch-'a']|[line], |
|000044b0| 63 29 3b 0a 09 65 6c 73 | 65 20 69 66 20 28 69 73 |c);..els|e if (is|
|000044c0| 64 69 67 69 74 28 63 68 | 29 29 0a 09 20 20 20 20 |digit(ch|)).. |
|000044d0| 64 65 63 6f 64 65 28 64 | 69 67 69 74 73 5b 63 68 |decode(d|igits[ch|
|000044e0| 2d 27 30 27 5d 5b 6c 69 | 6e 65 5d 2c 20 63 29 3b |-'0'][li|ne], c);|
|000044f0| 0a 09 65 6c 73 65 0a 09 | 20 20 20 20 64 65 63 6f |..else..| deco|
|00004500| 64 65 28 30 2c 20 63 29 | 3b 0a 09 7d 0a 20 20 20 |de(0, c)|;..}. |
|00004510| 20 7d 0a 2b 20 4d 41 58 | 5f 4f 56 45 52 53 54 52 | }.+ MAX|_OVERSTR|
|00004520| 20 2d 20 31 20 26 26 20 | 2a 28 6f 76 72 2b 31 29 | - 1 && |*(ovr+1)|
|00004530| 3b 0a 09 20 20 20 20 20 | 6f 76 72 2b 2b 29 20 0a |;.. |ovr++) .|
|00004540| 09 20 20 20 20 7b 0a 09 | 20 20 20 20 70 72 69 6e |. {..| prin|
|00004550| 74 66 28 22 25 32 30 73 | 25 73 22 2c 20 22 20 22 |tf("%20s|%s", " "|
|00004560| 2c 20 70 61 64 64 69 6e | 67 29 3b 0a 09 20 20 20 |, paddin|g);.. |
|00004570| 20 70 72 69 6e 74 48 64 | 72 28 6d 6f 6e 74 68 41 | printHd|r(monthA|
|00004580| 6e 64 59 65 61 72 2c 20 | 69 2c 20 2a 6f 76 72 29 |ndYear, |i, *ovr)|
|00004590| 3b 0a 09 20 20 20 20 70 | 72 69 6e 74 66 28 22 5c |;.. p|rintf("\|
|000045a0| 72 22 29 3b 0a 09 20 20 | 20 20 7d 0a 09 70 72 69 |r");.. | }..pri|
|000045b0| 6e 74 53 6d 61 6c 6c 43 | 61 6c 28 70 72 65 76 2c |ntSmallC|al(prev,|
|000045c0| 20 69 29 3b 09 09 2f 2a | 20 74 68 65 6e 20 73 6d | i);../*| then sm|
|000045d0| 61 6c 6c 20 63 61 6c 65 | 6e 64 61 72 73 2c 20 65 |all cale|ndars, e|
|000045e0| 74 63 2e 20 2a 2f 0a 09 | 70 72 69 6e 74 66 28 22 |tc. */..|printf("|
|000045f0| 25 73 22 2c 20 70 61 64 | 64 69 6e 67 29 3b 0a 09 |%s", pad|ding);..|
|00004600| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004680| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004690| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000046f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000047f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004800| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004880| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004890| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000048f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000049f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a00| 63 61 6c 65 6e 2f 63 61 | 6c 65 6e 2e 63 00 00 00 |calen/ca|len.c...|
|00004a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004a60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00004a70| 34 33 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |43 . |13 . |
|00004a80| 20 20 33 34 34 32 33 20 | 20 34 34 31 33 34 37 33 | 34423 | 4413473|
|00004a90| 34 33 33 20 20 20 36 34 | 34 35 00 20 00 00 00 00 |433 64|45. ....|
|00004aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004c00| 2f 2a 0a 20 2a 09 43 61 | 6c 65 6e 64 61 72 20 70 |/*. *.Ca|lendar p|
|00004c10| 72 6f 67 72 61 6d 20 2d | 20 6f 6e 65 20 6d 6f 6e |rogram -| one mon|
|00004c20| 74 68 20 70 65 72 20 70 | 61 67 65 0a 20 2a 0a 20 |th per p|age. *. |
|00004c30| 2a 09 4f 72 69 67 69 6e | 61 6c 6c 79 20 77 72 69 |*.Origin|ally wri|
|00004c40| 74 74 65 6e 20 69 6e 20 | 46 4f 52 54 52 41 4e 2d |tten in |FORTRAN-|
|00004c50| 49 56 20 66 6f 72 20 47 | 45 20 54 69 6d 65 73 68 |IV for G|E Timesh|
|00004c60| 61 72 69 6e 67 2c 20 31 | 30 2f 36 35 0a 20 2a 09 |aring, 1|0/65. *.|
|00004c70| 52 65 2d 63 6f 64 65 64 | 20 69 6e 20 43 20 66 6f |Re-coded| in C fo|
|00004c80| 72 20 55 4e 49 58 2c 20 | 33 2f 38 33 0a 20 2a 0a |r UNIX, |3/83. *.|
|00004c90| 20 2a 09 41 75 74 68 6f | 72 3a 20 41 57 20 52 6f | *.Autho|r: AW Ro|
|00004ca0| 67 65 72 73 0a 20 2a 0a | 20 2a 09 50 61 72 61 6d |gers. *.| *.Param|
|00004cb0| 65 74 65 72 73 3a 0a 20 | 2a 0a 20 2a 09 09 63 61 |eters:. |*. *..ca|
|00004cc0| 6c 65 6e 20 79 79 09 09 | 67 65 6e 65 72 61 74 65 |len yy..|generate|
|00004cd0| 73 20 63 61 6c 65 6e 64 | 61 72 20 66 6f 72 20 79 |s calend|ar for y|
|00004ce0| 65 61 72 20 79 79 0a 20 | 2a 0a 20 2a 09 09 63 61 |ear yy. |*. *..ca|
|00004cf0| 6c 65 6e 20 6d 6d 20 79 | 79 20 5b 6c 65 6e 5d 09 |len mm y|y [len].|
|00004d00| 67 65 6e 65 72 61 74 65 | 73 20 63 61 6c 65 6e 64 |generate|s calend|
|00004d10| 61 72 20 66 6f 72 20 6c | 65 6e 20 6d 6f 6e 74 68 |ar for l|en month|
|00004d20| 73 0a 20 2a 09 09 09 09 | 09 28 64 65 66 61 75 6c |s. *....|.(defaul|
|00004d30| 74 20 3d 20 31 29 20 73 | 74 61 72 74 69 6e 67 20 |t = 1) s|tarting |
|00004d40| 77 69 74 68 20 6d 6d 2f | 79 79 0a 20 2a 0a 20 2a |with mm/|yy. *. *|
|00004d50| 20 09 4f 70 74 69 6f 6e | 20 66 6c 61 67 73 20 28 | .Option| flags (|
|00004d60| 6d 75 73 74 20 70 72 65 | 63 65 64 65 20 70 61 72 |must pre|cede par|
|00004d70| 61 6d 73 29 3a 0a 20 2a | 0a 20 2a 09 09 2d 6c 09 |ams):. *|. *..-l.|
|00004d80| 09 09 6c 65 66 74 2d 6a | 75 73 74 69 66 79 20 64 |..left-j|ustify d|
|00004d90| 61 74 65 73 20 28 64 65 | 66 61 75 6c 74 29 0a 20 |ates (de|fault). |
|00004da0| 2a 09 09 2d 72 09 09 09 | 72 69 67 68 74 2d 6a 75 |*..-r...|right-ju|
|00004db0| 73 74 69 66 79 20 64 61 | 74 65 73 0a 20 2a 09 09 |stify da|tes. *..|
|00004dc0| 2d 6d 09 09 09 6d 69 78 | 65 64 2d 63 61 73 65 20 |-m...mix|ed-case |
|00004dd0| 6f 75 74 70 75 74 20 28 | 64 65 66 61 75 6c 74 29 |output (|default)|
|00004de0| 0a 20 2a 09 09 2d 75 09 | 09 09 75 70 70 65 72 2d |. *..-u.|..upper-|
|00004df0| 63 61 73 65 20 6f 75 74 | 70 75 74 0a 20 2a 09 09 |case out|put. *..|
|00004e00| 2d 6f 5b 73 65 71 5d 09 | 09 09 75 73 65 20 22 73 |-o[seq].|..use "s|
|00004e10| 65 71 22 20 61 73 20 6f | 76 65 72 73 74 72 69 6b |eq" as o|verstrik|
|00004e20| 65 20 73 65 71 75 65 6e | 63 65 0a 20 2a 09 09 09 |e sequen|ce. *...|
|00004e30| 09 09 20 66 6f 72 20 68 | 65 61 64 69 6e 67 20 28 |.. for h|eading (|
|00004e40| 64 65 66 61 75 6c 74 3a | 20 48 49 58 29 0a 20 2a |default:| HIX). *|
|00004e50| 09 09 2d 62 4e 09 09 09 | 61 64 64 20 4e 20 62 6c |..-bN...|add N bl|
|00004e60| 61 6e 6b 20 6c 69 6e 65 | 73 20 61 66 74 65 72 20 |ank line|s after |
|00004e70| 66 6f 72 6d 2d 66 65 65 | 64 0a 20 2a 0a 20 2a 09 |form-fee|d. *. *.|
|00004e80| 09 4f 75 74 70 75 74 20 | 69 73 20 74 6f 20 73 74 |.Output |is to st|
|00004e90| 61 6e 64 61 72 64 20 6f | 75 74 70 75 74 2e 0a 20 |andard o|utput.. |
|00004ea0| 2a 09 09 0a 20 2a 2f 0a | 20 0a 23 69 6e 63 6c 75 |*... */.| .#inclu|
|00004eb0| 64 65 20 3c 73 74 64 69 | 6f 2e 68 3e 0a 23 69 6e |de <stdi|o.h>.#in|
|00004ec0| 63 6c 75 64 65 20 3c 63 | 74 79 70 65 2e 68 3e 0a |clude <c|type.h>.|
|00004ed0| 0a 23 64 65 66 69 6e 65 | 20 46 41 4c 53 45 20 20 |.#define| FALSE |
|00004ee0| 20 30 0a 23 64 65 66 69 | 6e 65 20 54 52 55 45 20 | 0.#defi|ne TRUE |
|00004ef0| 20 20 20 31 0a 20 0a 23 | 64 65 66 69 6e 65 20 4a | 1. .#|define J|
|00004f00| 41 4e 20 09 31 09 09 09 | 2f 2a 20 73 69 67 6e 69 |AN .1...|/* signi|
|00004f10| 66 69 63 61 6e 74 20 6d | 6f 6e 74 68 73 2f 79 65 |ficant m|onths/ye|
|00004f20| 61 72 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 46 |ars */.#|define F|
|00004f30| 45 42 09 32 0a 23 64 65 | 66 69 6e 65 20 44 45 43 |EB.2.#de|fine DEC|
|00004f40| 09 31 32 0a 23 64 65 66 | 69 6e 65 20 4d 49 4e 59 |.12.#def|ine MINY|
|00004f50| 52 09 31 37 35 33 0a 23 | 64 65 66 69 6e 65 20 4d |R.1753.#|define M|
|00004f60| 41 58 59 52 09 39 39 39 | 39 0a 20 0a 23 64 65 66 |AXYR.999|9. .#def|
|00004f70| 69 6e 65 20 53 4f 4c 49 | 44 09 30 09 09 09 2f 2a |ine SOLI|D.0.../*|
|00004f80| 20 70 73 65 75 64 6f 2d | 65 6e 75 6d 65 72 61 74 | pseudo-|enumerat|
|00004f90| 69 6f 6e 20 66 6f 72 20 | 6c 69 6e 65 20 73 74 79 |ion for |line sty|
|00004fa0| 6c 65 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 4f |les */.#|define O|
|00004fb0| 50 45 4e 09 31 0a 0a 23 | 64 65 66 69 6e 65 20 4c |PEN.1..#|define L|
|00004fc0| 45 46 54 09 30 09 09 09 | 2f 2a 20 2e 2e 2e 20 61 |EFT.0...|/* ... a|
|00004fd0| 6e 64 20 6a 75 73 74 69 | 66 69 63 61 74 69 6f 6e |nd justi|fication|
|00004fe0| 20 6f 66 20 64 61 74 65 | 73 20 20 20 20 20 2a 2f | of date|s */|
|00004ff0| 0a 23 64 65 66 69 6e 65 | 20 52 49 47 48 54 09 31 |.#define| RIGHT.1|
|00005000| 0a 0a 23 64 65 66 69 6e | 65 20 4d 49 58 45 44 09 |..#defin|e MIXED.|
|00005010| 30 09 09 09 2f 2a 20 2e | 2e 2e 20 61 6e 64 20 63 |0.../* .|.. and c|
|00005020| 61 73 65 20 6f 66 20 6f | 75 74 70 75 74 20 74 65 |ase of o|utput te|
|00005030| 78 74 09 20 20 20 20 20 | 20 2a 2f 0a 0a 23 64 65 |xt. | */..#de|
|00005040| 66 69 6e 65 20 55 50 50 | 45 52 09 31 0a 0a 23 64 |fine UPP|ER.1..#d|
|00005050| 65 66 69 6e 65 09 4f 56 | 45 52 53 54 52 49 4b 45 |efine.OV|ERSTRIKE|
|00005060| 09 22 48 49 58 22 09 09 | 2f 2a 20 6f 76 65 72 73 |."HIX"..|/* overs|
|00005070| 74 72 69 6b 65 20 73 65 | 71 75 65 6e 63 65 20 66 |trike se|quence f|
|00005080| 6f 72 20 6d 6f 6e 74 68 | 2f 79 65 61 72 20 2a 2f |or month|/year */|
|00005090| 0a 23 64 65 66 69 6e 65 | 20 4d 41 58 5f 4f 56 45 |.#define| MAX_OVE|
|000050a0| 52 53 54 52 09 33 09 09 | 2f 2a 20 6d 61 78 69 6d |RSTR.3..|/* maxim|
|000050b0| 75 6d 20 6f 76 65 72 73 | 74 72 69 6b 65 73 20 70 |um overs|trikes p|
|000050c0| 65 72 6d 69 74 74 65 64 | 20 2a 2f 0a 0a 23 64 65 |ermitted| */..#de|
|000050d0| 66 69 6e 65 20 69 73 4c | 65 61 70 28 79 29 20 28 |fine isL|eap(y) (|
|000050e0| 28 79 29 20 25 20 34 20 | 3d 3d 20 30 20 26 26 20 |(y) % 4 |== 0 && |
|000050f0| 28 28 79 29 20 25 20 31 | 30 30 20 21 3d 20 30 20 |((y) % 1|00 != 0 |
|00005100| 7c 7c 20 28 79 29 20 25 | 20 34 30 30 20 3d 3d 20 ||| (y) %| 400 == |
|00005110| 30 29 29 09 2f 2a 20 6c | 65 61 70 20 79 65 61 72 |0))./* l|eap year|
|00005120| 20 6d 61 63 72 6f 20 2a | 2f 0a 20 0a 74 79 70 65 | macro *|/. .type|
|00005130| 64 65 66 20 73 74 72 75 | 63 74 09 09 09 09 2f 2a |def stru|ct..../*|
|00005140| 20 69 6e 66 6f 20 66 6f | 72 20 61 20 73 69 6e 67 | info fo|r a sing|
|00005150| 6c 65 20 6d 6f 6e 74 68 | 20 2a 2f 0a 20 20 20 20 |le month| */. |
|00005160| 7b 0a 20 20 20 20 69 6e | 74 20 09 6d 6d 3b 0a 20 |{. in|t .mm;. |
|00005170| 20 20 20 69 6e 74 09 09 | 79 79 3b 0a 20 20 20 20 | int..|yy;. |
|00005180| 63 68 61 72 20 09 6d 6d | 6e 61 6d 65 5b 31 30 5d |char .mm|name[10]|
|00005190| 3b 0a 20 20 20 20 63 68 | 61 72 09 64 61 74 65 73 |;. ch|ar.dates|
|000051a0| 5b 36 5d 5b 37 5d 5b 33 | 5d 3b 0a 20 20 20 20 7d |[6][7][3|];. }|
|000051b0| 20 6d 6f 6e 74 68 52 65 | 63 3b 0a 20 0a 74 79 70 | monthRe|c;. .typ|
|000051c0| 65 64 65 66 20 6d 6f 6e | 74 68 52 65 63 20 2a 6d |edef mon|thRec *m|
|000051d0| 70 74 72 3b 09 09 09 2f | 2a 20 70 6f 69 6e 74 65 |ptr;.../|* pointe|
|000051e0| 72 20 74 6f 20 61 62 6f | 76 65 20 73 74 72 75 63 |r to abo|ve struc|
|000051f0| 74 20 2a 2f 0a 0a 2f 2a | 20 67 6c 6f 62 61 6c 73 |t */../*| globals|
|00005200| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 74 | corresp|onding t|
|00005210| 6f 20 63 6f 6d 6d 61 6e | 64 2d 6c 69 6e 65 20 66 |o comman|d-line f|
|00005220| 6c 61 67 73 20 2a 2f 0a | 0a 69 6e 74 20 6a 75 73 |lags */.|.int jus|
|00005230| 74 20 3d 20 4c 45 46 54 | 3b 09 09 09 2f 2a 20 64 |t = LEFT|;.../* d|
|00005240| 65 66 61 75 6c 74 20 6a | 75 73 74 69 66 69 63 61 |efault j|ustifica|
|00005250| 74 69 6f 6e 20 6f 66 20 | 64 61 74 65 73 20 2a 2f |tion of |dates */|
|00005260| 0a 69 6e 74 20 6f 63 61 | 73 65 20 3d 20 4d 49 58 |.int oca|se = MIX|
|00005270| 45 44 3b 09 09 09 2f 2a | 20 64 65 66 61 75 6c 74 |ED;.../*| default|
|00005280| 20 63 61 73 65 20 66 6f | 72 20 6f 75 74 70 75 74 | case fo|r output|
|00005290| 20 2a 2f 0a 69 6e 74 20 | 6e 62 6c 61 6e 6b 20 3d | */.int |nblank =|
|000052a0| 20 30 3b 09 09 09 09 2f | 2a 20 64 65 66 61 75 6c | 0;..../|* defaul|
|000052b0| 74 20 62 6c 61 6e 6b 20 | 6c 69 6e 65 73 20 61 66 |t blank |lines af|
|000052c0| 74 65 72 20 46 46 20 2a | 2f 0a 63 68 61 72 20 2a |ter FF *|/.char *|
|000052d0| 73 65 71 20 3d 20 4f 56 | 45 52 53 54 52 49 4b 45 |seq = OV|ERSTRIKE|
|000052e0| 3b 09 09 09 2f 2a 20 64 | 65 66 61 75 6c 74 20 6f |;.../* d|efault o|
|000052f0| 76 65 72 73 74 72 69 6b | 65 20 73 65 71 75 65 6e |verstrik|e sequen|
|00005300| 63 65 20 2a 2f 0a 0a 0c | 0a 2f 2a 0a 20 2a 09 4d |ce */...|./*. *.M|
|00005310| 61 69 6e 20 2d 20 67 65 | 74 73 20 61 6e 64 20 76 |ain - ge|ts and v|
|00005320| 61 6c 69 64 61 74 65 73 | 20 70 61 72 61 6d 65 74 |alidates| paramet|
|00005330| 65 72 73 2c 20 6f 70 65 | 6e 73 20 6f 75 74 70 75 |ers, ope|ns outpu|
|00005340| 74 20 66 69 6c 65 2c 20 | 65 78 65 63 75 74 65 73 |t file, |executes|
|00005350| 0a 20 2a 09 6c 6f 6f 70 | 20 74 6f 20 66 69 6c 6c |. *.loop| to fill|
|00005360| 20 61 6e 64 20 70 72 69 | 6e 74 20 6d 6f 6e 74 68 | and pri|nt month|
|00005370| 73 20 6f 66 20 63 61 6c | 65 6e 64 61 72 2c 20 63 |s of cal|endar, c|
|00005380| 6c 6f 73 65 73 20 6f 75 | 74 70 75 74 20 66 69 6c |loses ou|tput fil|
|00005390| 65 0a 20 2a 2f 0a 6d 61 | 69 6e 28 61 72 67 63 2c |e. */.ma|in(argc,|
|000053a0| 20 61 72 67 76 29 0a 20 | 20 20 20 69 6e 74 20 61 | argv). | int a|
|000053b0| 72 67 63 3b 0a 20 20 20 | 20 63 68 61 72 20 2a 61 |rgc;. | char *a|
|000053c0| 72 67 76 5b 5d 3b 0a 20 | 20 20 20 7b 0a 20 20 20 |rgv[];. | {. |
|000053d0| 20 69 6e 74 20 6e 6d 6f | 6e 74 68 73 3b 09 09 09 | int nmo|nths;...|
|000053e0| 2f 2a 20 63 6f 6e 73 65 | 63 75 74 69 76 65 20 6d |/* conse|cutive m|
|000053f0| 6f 6e 74 68 73 20 74 6f | 20 70 72 69 6e 74 20 2a |onths to| print *|
|00005400| 2f 0a 20 20 20 20 69 6e | 74 20 62 61 64 6f 70 74 |/. in|t badopt|
|00005410| 20 3d 20 46 41 4c 53 45 | 3b 09 09 09 2f 2a 20 66 | = FALSE|;.../* f|
|00005420| 6c 61 67 20 73 65 74 20 | 69 66 20 62 61 64 20 6f |lag set |if bad o|
|00005430| 70 74 69 6f 6e 20 2a 2f | 0a 20 20 20 20 69 6e 74 |ption */|. int|
|00005440| 20 62 61 64 70 61 72 20 | 3d 20 46 41 4c 53 45 3b | badpar |= FALSE;|
|00005450| 09 09 09 2f 2a 20 66 6c | 61 67 20 73 65 74 20 69 |.../* fl|ag set i|
|00005460| 66 20 62 61 64 20 70 61 | 72 61 6d 20 20 2a 2f 0a |f bad pa|ram */.|
|00005470| 20 20 20 20 6d 6f 6e 74 | 68 52 65 63 20 6d 52 65 | mont|hRec mRe|
|00005480| 63 5b 33 5d 3b 09 09 09 | 2f 2a 20 73 70 61 63 65 |c[3];...|/* space|
|00005490| 20 66 6f 72 20 6d 61 69 | 6e 20 61 6e 64 20 73 6d | for mai|n and sm|
|000054a0| 61 6c 6c 20 63 61 6c 65 | 6e 64 61 72 73 20 2a 2f |all cale|ndars */|
|000054b0| 0a 20 20 20 20 6d 70 74 | 72 20 70 72 65 76 20 3d |. mpt|r prev =|
|000054c0| 20 26 6d 52 65 63 5b 30 | 5d 2c 20 09 09 2f 2a 20 | &mRec[0|], ../* |
|000054d0| 70 6f 69 6e 74 65 72 73 | 20 74 6f 20 63 61 6c 65 |pointers| to cale|
|000054e0| 6e 64 61 72 73 20 28 69 | 6e 69 74 69 61 6c 6c 79 |ndars (i|nitially|
|000054f0| 29 20 2a 2f 0a 09 20 63 | 75 72 72 20 3d 20 26 6d |) */.. c|urr = &m|
|00005500| 52 65 63 5b 31 5d 2c 0a | 09 20 6e 65 78 74 20 3d |Rec[1],.|. next =|
|00005510| 20 26 6d 52 65 63 5b 32 | 5d 2c 0a 09 20 74 65 6d | &mRec[2|],.. tem|
|00005520| 70 3b 0a 0a 20 20 20 20 | 2f 2a 20 47 65 74 20 63 |p;.. |/* Get c|
|00005530| 6f 6d 6d 61 6e 64 20 6c | 69 6e 65 20 66 6c 61 67 |ommand l|ine flag|
|00005540| 73 20 2a 2f 0a 0a 20 20 | 20 20 77 68 69 6c 65 20 |s */.. | while |
|00005550| 28 61 72 67 63 20 3e 20 | 31 20 26 26 20 61 72 67 |(argc > |1 && arg|
|00005560| 76 5b 31 5d 5b 30 5d 20 | 3d 3d 20 27 2d 27 29 0a |v[1][0] |== '-').|
|00005570| 20 20 20 20 20 20 20 20 | 7b 0a 20 20 20 20 20 20 | |{. |
|00005580| 20 20 73 77 69 74 63 68 | 20 28 61 72 67 76 5b 31 | switch| (argv[1|
|00005590| 5d 5b 31 5d 29 0a 09 20 | 20 20 20 7b 0a 09 20 20 |][1]).. | {.. |
|000055a0| 20 20 63 61 73 65 20 27 | 62 27 3a 0a 09 09 73 73 | case '|b':...ss|
|000055b0| 63 61 6e 66 28 26 61 72 | 67 76 5b 31 5d 5b 32 5d |canf(&ar|gv[1][2]|
|000055c0| 2c 20 22 25 64 22 2c 20 | 26 6e 62 6c 61 6e 6b 29 |, "%d", |&nblank)|
|000055d0| 3b 0a 09 09 62 72 65 61 | 6b 3b 0a 09 20 20 20 20 |;...brea|k;.. |
|000055e0| 63 61 73 65 20 27 6c 27 | 3a 0a 09 09 6a 75 73 74 |case 'l'|:...just|
|000055f0| 20 3d 20 4c 45 46 54 3b | 0a 09 09 62 72 65 61 6b | = LEFT;|...break|
|00005600| 3b 0a 09 20 20 20 20 63 | 61 73 65 20 27 72 27 3a |;.. c|ase 'r':|
|00005610| 0a 09 09 6a 75 73 74 20 | 3d 20 52 49 47 48 54 3b |...just |= RIGHT;|
|00005620| 0a 09 09 62 72 65 61 6b | 3b 0a 09 20 20 20 20 63 |...break|;.. c|
|00005630| 61 73 65 20 27 6d 27 3a | 0a 09 09 6f 63 61 73 65 |ase 'm':|...ocase|
|00005640| 20 3d 20 4d 49 58 45 44 | 3b 0a 09 09 62 72 65 61 | = MIXED|;...brea|
|00005650| 6b 3b 0a 09 20 20 20 20 | 63 61 73 65 20 27 75 27 |k;.. |case 'u'|
|00005660| 3a 0a 09 09 6f 63 61 73 | 65 20 3d 20 55 50 50 45 |:...ocas|e = UPPE|
|00005670| 52 3b 0a 09 09 62 72 65 | 61 6b 3b 0a 09 20 20 20 |R;...bre|ak;.. |
|00005680| 20 63 61 73 65 20 27 6f | 27 3a 0a 09 09 69 66 20 | case 'o|':...if |
|00005690| 28 61 72 67 76 5b 31 5d | 5b 32 5d 20 21 3d 20 27 |(argv[1]|[2] != '|
|000056a0| 5c 30 27 29 0a 09 09 20 | 20 20 20 73 65 71 20 3d |\0')... | seq =|
|000056b0| 20 26 61 72 67 76 5b 31 | 5d 5b 32 5d 3b 0a 09 09 | &argv[1|][2];...|
|000056c0| 62 72 65 61 6b 3b 0a 09 | 20 20 20 20 64 65 66 61 |break;..| defa|
|000056d0| 75 6c 74 3a 0a 09 09 66 | 70 72 69 6e 74 66 28 73 |ult:...f|printf(s|
|000056e0| 74 64 65 72 72 2c 20 22 | 49 6e 76 61 6c 69 64 20 |tderr, "|Invalid |
|000056f0| 66 6c 61 67 3a 20 25 73 | 5c 6e 22 2c 20 61 72 67 |flag: %s|\n", arg|
|00005700| 76 5b 31 5d 29 3b 0a 09 | 09 62 61 64 6f 70 74 20 |v[1]);..|.badopt |
|00005710| 3d 20 54 52 55 45 3b 0a | 09 09 62 72 65 61 6b 3b |= TRUE;.|..break;|
|00005720| 0a 09 20 20 20 20 7d 0a | 20 20 20 20 20 20 20 20 |.. }.| |
|00005730| 61 72 67 76 2b 2b 3b 0a | 09 61 72 67 63 2d 2d 3b |argv++;.|.argc--;|
|00005740| 0a 09 7d 0a 0a 20 20 20 | 20 69 66 20 28 62 61 64 |..}.. | if (bad|
|00005750| 6f 70 74 29 0a 09 66 70 | 72 69 6e 74 66 28 73 74 |opt)..fp|rintf(st|
|00005760| 64 65 72 72 2c 20 22 56 | 61 6c 69 64 20 66 6c 61 |derr, "V|alid fla|
|00005770| 67 73 20 61 72 65 20 2d | 62 20 2d 6c 20 2d 6d 20 |gs are -|b -l -m |
|00005780| 2d 6f 20 2d 72 20 2d 75 | 5c 6e 22 29 3b 0a 0a 20 |-o -r -u|\n");.. |
|00005790| 20 20 20 2f 2a 20 47 65 | 74 20 61 6e 64 20 76 61 | /* Ge|t and va|
|000057a0| 6c 69 64 61 74 65 20 70 | 61 72 61 6d 65 74 65 72 |lidate p|arameter|
|000057b0| 73 20 2a 2f 0a 20 20 20 | 20 0a 20 20 20 20 69 66 |s */. | . if|
|000057c0| 20 28 61 72 67 63 20 3d | 3d 20 32 29 09 09 2f 2a | (argc =|= 2)../*|
|000057d0| 20 6f 6e 6c 79 20 6f 6e | 65 20 61 72 67 20 2d 20 | only on|e arg - |
|000057e0| 74 72 65 61 74 20 61 73 | 20 79 79 20 2a 2f 0a 09 |treat as| yy */..|
|000057f0| 7b 0a 09 73 73 63 61 6e | 66 28 61 72 67 76 5b 31 |{..sscan|f(argv[1|
|00005800| 5d 2c 20 22 25 64 22 2c | 20 26 63 75 72 72 2d 3e |], "%d",| &curr->|
|00005810| 79 79 29 3b 0a 09 63 75 | 72 72 2d 3e 6d 6d 20 3d |yy);..cu|rr->mm =|
|00005820| 20 4a 41 4e 3b 0a 09 6e | 6d 6f 6e 74 68 73 20 3d | JAN;..n|months =|
|00005830| 20 31 32 3b 0a 09 7d 0a | 20 0a 20 20 20 20 65 6c | 12;..}.| . el|
|00005840| 73 65 20 69 66 20 28 61 | 72 67 63 20 3e 3d 20 33 |se if (a|rgc >= 3|
|00005850| 29 09 09 2f 2a 20 74 77 | 6f 20 6f 72 20 6d 6f 72 |)../* tw|o or mor|
|00005860| 65 20 2d 20 74 72 65 61 | 74 20 61 73 20 6d 6d 20 |e - trea|t as mm |
|00005870| 79 79 20 5b 6c 65 6e 5d | 20 2a 2f 0a 09 7b 0a 09 |yy [len]| */..{..|
|00005880| 73 73 63 61 6e 66 28 61 | 72 67 76 5b 31 5d 2c 20 |sscanf(a|rgv[1], |
|00005890| 22 25 64 22 2c 20 26 63 | 75 72 72 2d 3e 6d 6d 29 |"%d", &c|urr->mm)|
|000058a0| 3b 0a 09 73 73 63 61 6e | 66 28 61 72 67 76 5b 32 |;..sscan|f(argv[2|
|000058b0| 5d 2c 20 22 25 64 22 2c | 20 26 63 75 72 72 2d 3e |], "%d",| &curr->|
|000058c0| 79 79 29 3b 0a 09 69 66 | 20 28 61 72 67 63 20 3e |yy);..if| (argc >|
|000058d0| 3d 20 34 29 0a 09 20 20 | 20 20 73 73 63 61 6e 66 |= 4).. | sscanf|
|000058e0| 28 61 72 67 76 5b 33 5d | 2c 20 22 25 64 22 2c 20 |(argv[3]|, "%d", |
|000058f0| 26 6e 6d 6f 6e 74 68 73 | 29 3b 0a 09 7d 0a 20 0a |&nmonths|);..}. .|
|00005900| 20 20 20 20 65 6c 73 65 | 09 09 09 2f 2a 20 6e 6f | else|.../* no|
|00005910| 6e 65 20 73 70 65 63 69 | 66 69 65 64 20 2d 20 67 |ne speci|fied - g|
|00005920| 65 74 20 69 6e 74 65 72 | 61 63 74 69 76 65 6c 79 |et inter|actively|
|00005930| 20 2a 2f 0a 09 7b 0a 09 | 66 70 72 69 6e 74 66 28 | */..{..|fprintf(|
|00005940| 73 74 64 65 72 72 2c 20 | 22 45 6e 74 65 72 20 63 |stderr, |"Enter c|
|00005950| 61 6c 65 6e 64 61 72 20 | 73 70 65 63 73 20 28 6d |alendar |specs (m|
|00005960| 6f 6e 74 68 20 79 65 61 | 72 20 6c 65 6e 67 74 68 |onth yea|r length|
|00005970| 29 3a 20 22 29 3b 0a 09 | 73 63 61 6e 66 28 22 25 |): ");..|scanf("%|
|00005980| 64 20 25 64 20 25 64 22 | 2c 20 26 63 75 72 72 2d |d %d %d"|, &curr-|
|00005990| 3e 6d 6d 2c 20 26 63 75 | 72 72 2d 3e 79 79 2c 20 |>mm, &cu|rr->yy, |
|000059a0| 26 6e 6d 6f 6e 74 68 73 | 29 3b 0a 09 7d 0a 20 0a |&nmonths|);..}. .|
|000059b0| 20 20 20 20 69 66 20 28 | 63 75 72 72 2d 3e 79 79 | if (|curr->yy|
|000059c0| 20 3e 20 30 20 26 26 20 | 63 75 72 72 2d 3e 79 79 | > 0 && |curr->yy|
|000059d0| 20 3c 20 31 30 30 29 09 | 09 2f 2a 20 6e 6e 20 2d | < 100).|./* nn -|
|000059e0| 3e 20 31 39 6e 6e 20 2a | 2f 0a 09 63 75 72 72 2d |> 19nn *|/..curr-|
|000059f0| 3e 79 79 20 2b 3d 20 31 | 39 30 30 3b 0a 20 0a 20 |>yy += 1|900;. . |
|00005a00| 20 20 20 69 66 20 28 6e | 6d 6f 6e 74 68 73 20 3c | if (n|months <|
|00005a10| 20 31 29 09 09 09 09 2f | 2a 20 64 65 66 61 75 6c | 1)..../|* defaul|
|00005a20| 74 20 66 6f 72 20 6d 6f | 6e 74 68 20 63 6f 75 6e |t for mo|nth coun|
|00005a30| 74 20 2a 2f 0a 09 6e 6d | 6f 6e 74 68 73 20 3d 20 |t */..nm|onths = |
|00005a40| 31 3b 0a 20 0a 20 20 20 | 20 69 66 20 28 63 75 72 |1;. . | if (cur|
|00005a50| 72 2d 3e 6d 6d 20 3c 20 | 4a 41 4e 20 7c 7c 20 63 |r->mm < |JAN || c|
|00005a60| 75 72 72 2d 3e 6d 6d 20 | 3e 20 44 45 43 29 09 2f |urr->mm |> DEC)./|
|00005a70| 2a 20 76 61 6c 69 64 61 | 74 65 20 6d 6f 6e 74 68 |* valida|te month|
|00005a80| 2f 79 65 61 72 20 2a 2f | 0a 20 20 20 20 20 20 7b |/year */|. {|
|00005a90| 0a 20 20 20 20 20 20 66 | 70 72 69 6e 74 66 28 73 |. f|printf(s|
|00005aa0| 74 64 65 72 72 2c 20 22 | 4d 6f 6e 74 68 20 25 64 |tderr, "|Month %d|
|00005ab0| 20 6e 6f 74 20 69 6e 20 | 72 61 6e 67 65 20 25 64 | not in |range %d|
|00005ac0| 20 2e 2e 20 25 64 5c 6e | 22 2c 20 63 75 72 72 2d | .. %d\n|", curr-|
|00005ad0| 3e 6d 6d 2c 20 4a 41 4e | 2c 20 44 45 43 29 3b 0a |>mm, JAN|, DEC);.|
|00005ae0| 20 20 20 20 20 20 62 61 | 64 70 61 72 20 3d 20 54 | ba|dpar = T|
|00005af0| 52 55 45 3b 0a 20 20 20 | 20 20 20 7d 0a 0a 20 20 |RUE;. | }.. |
|00005b00| 20 20 69 66 20 28 63 75 | 72 72 2d 3e 79 79 20 3c | if (cu|rr->yy <|
|00005b10| 20 4d 49 4e 59 52 20 7c | 7c 20 63 75 72 72 2d 3e | MINYR ||| curr->|
|00005b20| 79 79 20 3e 20 4d 41 58 | 59 52 29 0a 20 20 20 20 |yy > MAX|YR). |
|00005b30| 20 20 7b 0a 20 20 20 20 | 20 20 66 70 72 69 6e 74 | {. | fprint|
|00005b40| 66 28 73 74 64 65 72 72 | 2c 20 22 59 65 61 72 20 |f(stderr|, "Year |
|00005b50| 25 64 20 6e 6f 74 20 69 | 6e 20 72 61 6e 67 65 20 |%d not i|n range |
|00005b60| 25 64 20 2e 2e 20 25 64 | 5c 6e 22 2c 20 63 75 72 |%d .. %d|\n", cur|
|00005b70| 72 2d 3e 79 79 2c 20 4d | 49 4e 59 52 2c 0a 09 20 |r->yy, M|INYR,.. |
|00005b80| 20 20 20 20 20 4d 41 58 | 59 52 29 3b 0a 20 20 20 | MAX|YR);. |
|00005b90| 20 20 20 62 61 64 70 61 | 72 20 3d 20 54 52 55 45 | badpa|r = TRUE|
|00005ba0| 3b 0a 20 20 20 20 20 20 | 7d 0a 0a 20 20 20 20 69 |;. |}.. i|
|00005bb0| 66 20 28 62 61 64 70 61 | 72 29 09 09 2f 2a 20 71 |f (badpa|r)../* q|
|00005bc0| 75 69 74 20 69 66 20 6d | 6f 6e 74 68 20 6f 72 20 |uit if m|onth or |
|00005bd0| 79 65 61 72 20 69 6e 76 | 61 6c 69 64 20 2a 2f 0a |year inv|alid */.|
|00005be0| 20 20 20 20 20 20 65 78 | 69 74 28 31 29 3b 0a 20 | ex|it(1);. |
|00005bf0| 0a 20 20 20 20 2f 2a 20 | 66 69 6c 6c 20 69 6e 20 |. /* |fill in |
|00005c00| 63 61 6c 65 6e 64 61 72 | 73 20 66 6f 72 20 70 72 |calendar|s for pr|
|00005c10| 65 76 69 6f 75 73 20 61 | 6e 64 20 63 75 72 72 65 |evious a|nd curre|
|00005c20| 6e 74 20 6d 6f 6e 74 68 | 20 2a 2f 0a 20 0a 20 20 |nt month| */. . |
|00005c30| 20 20 70 72 65 76 2d 3e | 6d 6d 20 3d 20 28 63 75 | prev->|mm = (cu|
|00005c40| 72 72 2d 3e 6d 6d 20 3d | 3d 20 4a 41 4e 29 20 3f |rr->mm =|= JAN) ?|
|00005c50| 20 44 45 43 20 3a 20 63 | 75 72 72 2d 3e 6d 6d 20 | DEC : c|urr->mm |
|00005c60| 2d 20 31 3b 0a 20 20 20 | 20 70 72 65 76 2d 3e 79 |- 1;. | prev->y|
|00005c70| 79 20 3d 20 28 63 75 72 | 72 2d 3e 6d 6d 20 3d 3d |y = (cur|r->mm ==|
|00005c80| 20 4a 41 4e 29 20 3f 20 | 63 75 72 72 2d 3e 79 79 | JAN) ? |curr->yy|
|00005c90| 20 2d 20 31 20 3a 20 63 | 75 72 72 2d 3e 79 79 3b | - 1 : c|urr->yy;|
|00005ca0| 0a 20 20 20 20 66 69 6c | 6c 43 61 6c 65 6e 64 61 |. fil|lCalenda|
|00005cb0| 72 28 70 72 65 76 29 3b | 0a 20 0a 20 20 20 20 66 |r(prev);|. . f|
|00005cc0| 69 6c 6c 43 61 6c 65 6e | 64 61 72 28 63 75 72 72 |illCalen|dar(curr|
|00005cd0| 29 3b 0a 20 0a 20 20 20 | 20 2f 2a 0a 20 20 20 20 |);. . | /*. |
|00005ce0| 20 2a 20 4d 61 69 6e 20 | 6c 6f 6f 70 3a 20 70 72 | * Main |loop: pr|
|00005cf0| 69 6e 74 20 65 61 63 68 | 20 6d 6f 6e 74 68 20 6f |int each| month o|
|00005d00| 66 20 74 68 65 20 63 61 | 6c 65 6e 64 61 72 20 28 |f the ca|lendar (|
|00005d10| 77 69 74 68 20 73 6d 61 | 6c 6c 20 63 61 6c 65 6e |with sma|ll calen|
|00005d20| 64 61 72 73 20 66 6f 72 | 0a 20 20 20 20 20 2a 20 |dars for|. * |
|00005d30| 74 68 65 20 70 72 65 63 | 65 64 69 6e 67 20 61 6e |the prec|eding an|
|00005d40| 64 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6d 6f 6e 74 |d follow|ing mont|
|00005d50| 68 73 20 69 6e 20 74 68 | 65 20 75 70 70 65 72 20 |hs in th|e upper |
|00005d60| 63 6f 72 6e 65 72 73 29 | 2e 20 20 54 68 65 20 63 |corners)|. The c|
|00005d70| 75 72 72 65 6e 74 0a 20 | 20 20 20 20 2a 20 61 6e |urrent. | * an|
|00005d80| 64 20 6e 65 78 74 20 6d | 6f 6e 74 68 73 27 20 63 |d next m|onths' c|
|00005d90| 61 6c 65 6e 64 61 72 73 | 20 63 61 6e 20 62 65 20 |alendars| can be |
|00005da0| 72 65 75 73 65 64 20 74 | 68 65 20 66 6f 6c 6c 6f |reused t|he follo|
|00005db0| 77 69 6e 67 20 6d 6f 6e | 74 68 3b 20 6f 6e 6c 79 |wing mon|th; only|
|00005dc0| 0a 20 20 20 20 20 2a 20 | 74 68 65 20 27 6e 65 78 |. * |the 'nex|
|00005dd0| 74 27 20 63 61 6c 65 6e | 64 61 72 20 6e 65 65 64 |t' calen|dar need|
|00005de0| 20 62 65 20 72 65 63 61 | 6c 63 75 6c 61 74 65 64 | be reca|lculated|
|00005df0| 20 65 61 63 68 20 74 69 | 6d 65 2e 0a 20 20 20 20 | each ti|me.. |
|00005e00| 20 2a 2f 0a 20 0a 20 20 | 20 20 66 6f 72 20 28 3b | */. . | for (;|
|00005e10| 20 6e 6d 6f 6e 74 68 73 | 20 3e 20 30 20 26 26 20 | nmonths| > 0 && |
|00005e20| 63 75 72 72 2d 3e 79 79 | 20 3c 3d 20 4d 41 58 59 |curr->yy| <= MAXY|
|00005e30| 52 3b 20 6e 6d 6f 6e 74 | 68 73 2d 2d 29 09 2f 2a |R; nmont|hs--)./*|
|00005e40| 20 6d 61 69 6e 20 6c 6f | 6f 70 20 2a 2f 0a 09 7b | main lo|op */..{|
|00005e50| 0a 09 6e 65 78 74 2d 3e | 6d 6d 20 3d 20 28 63 75 |..next->|mm = (cu|
|00005e60| 72 72 2d 3e 6d 6d 20 3d | 3d 20 44 45 43 29 20 3f |rr->mm =|= DEC) ?|
|00005e70| 20 4a 41 4e 20 3a 20 63 | 75 72 72 2d 3e 6d 6d 20 | JAN : c|urr->mm |
|00005e80| 2b 20 31 3b 0a 09 6e 65 | 78 74 2d 3e 79 79 20 3d |+ 1;..ne|xt->yy =|
|00005e90| 20 28 63 75 72 72 2d 3e | 6d 6d 20 3d 3d 20 44 45 | (curr->|mm == DE|
|00005ea0| 43 29 20 3f 20 63 75 72 | 72 2d 3e 79 79 20 2b 20 |C) ? cur|r->yy + |
|00005eb0| 31 20 3a 20 63 75 72 72 | 2d 3e 79 79 3b 0a 09 66 |1 : curr|->yy;..f|
|00005ec0| 69 6c 6c 43 61 6c 65 6e | 64 61 72 28 6e 65 78 74 |illCalen|dar(next|
|00005ed0| 29 3b 09 09 09 2f 2a 20 | 66 69 6c 6c 20 69 6e 20 |);.../* |fill in |
|00005ee0| 66 6f 6c 6c 6f 77 69 6e | 67 20 6d 6f 6e 74 68 20 |followin|g month |
|00005ef0| 2a 2f 0a 20 0a 09 70 72 | 69 6e 74 43 61 6c 65 6e |*/. ..pr|intCalen|
|00005f00| 64 61 72 28 70 72 65 76 | 2c 20 63 75 72 72 2c 20 |dar(prev|, curr, |
|00005f10| 6e 65 78 74 29 3b 0a 20 | 0a 09 74 65 6d 70 20 3d |next);. |..temp =|
|00005f20| 20 70 72 65 76 3b 09 09 | 09 09 2f 2a 20 73 77 61 | prev;..|../* swa|
|00005f30| 70 20 74 68 65 20 74 68 | 72 65 65 20 6d 6f 6e 74 |p the th|ree mont|
|00005f40| 68 73 20 2a 2f 0a 09 70 | 72 65 76 20 3d 20 63 75 |hs */..p|rev = cu|
|00005f50| 72 72 3b 0a 09 63 75 72 | 72 20 3d 20 6e 65 78 74 |rr;..cur|r = next|
|00005f60| 3b 0a 09 6e 65 78 74 20 | 3d 20 74 65 6d 70 3b 0a |;..next |= temp;.|
|00005f70| 09 7d 0a 20 0a 20 20 20 | 20 7d 0a 0c 0a 2f 2a 0a |.}. . | }.../*.|
|00005f80| 20 2a 09 50 72 69 6e 74 | 20 74 68 65 20 63 61 6c | *.Print| the cal|
|00005f90| 65 6e 64 61 72 20 66 6f | 72 20 74 68 65 20 63 75 |endar fo|r the cu|
|00005fa0| 72 72 65 6e 74 20 6d 6f | 6e 74 68 2c 20 67 65 6e |rrent mo|nth, gen|
|00005fb0| 65 72 61 74 69 6e 67 20 | 73 6d 61 6c 6c 20 63 61 |erating |small ca|
|00005fc0| 6c 65 6e 64 61 72 73 0a | 20 2a 09 66 6f 72 20 74 |lendars.| *.for t|
|00005fd0| 68 65 20 70 72 65 76 69 | 6f 75 73 20 61 6e 64 20 |he previ|ous and |
|00005fe0| 66 6f 6c 6c 6f 77 69 6e | 67 20 6d 6f 6e 74 68 73 |followin|g months|
|00005ff0| 20 69 6e 20 74 68 65 20 | 75 70 70 65 72 20 63 6f | in the |upper co|
+--------+-------------------------+-------------------------+--------+--------+