summaryrefslogtreecommitdiff
path: root/config/nvim-2/nvim/undodir/%home%coast%projects%c%compteur%src%main.c
blob: 4e6ff1a4c92d646336ea87777acc7dfcf1861204 (plain)
ofshex dumpascii
0000 56 69 6d 9f 55 6e 44 6f e5 00 03 af 94 c5 14 a2 1a 35 66 8a 87 af d5 be 8b 21 7d d1 3b f9 a5 1d Vim.UnDo.........5f......!}.;...
0020 af 8d c9 e1 cf 95 04 8a c8 90 3f 00 00 01 7e 00 00 00 35 20 20 20 20 70 72 69 6e 74 66 28 22 20 ..........?...~...5....printf(".
0040 20 25 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 .%s.--show-length.\"april.6\"\n"
0060 2c 20 70 72 6f 67 29 3b 00 00 00 f5 00 00 00 00 00 00 00 01 00 00 00 14 00 00 00 00 00 00 00 14 ,.prog);........................
0080 00 00 00 14 00 00 00 14 00 00 00 00 6a 00 40 22 04 01 00 00 00 0d 00 5f d0 00 00 00 00 00 00 00 ............j.@"......._........
00a0 02 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 ................................
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3a 20 04 ...........................j.:..
0220 01 00 00 00 02 00 f5 18 00 00 00 91 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 20 20 20 20 ................................
0240 f5 18 00 00 00 92 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0260 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 ..........................5.....
0280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 ................................
02a0 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 ................................
02c0 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................................
02e0 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 91 00 ................................
0300 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 ................................
0320 00 00 00 00 91 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 0d 00 00 00 01 00 00 00 f9 0f 00 00 ................................
0340 00 00 00 00 00 00 00 00 00 00 00 00 b3 01 00 00 00 00 00 00 35 81 5f d0 00 00 00 01 00 00 00 03 ....................5._.........
0360 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 ................................
0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
04a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
04c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3a 7b 04 01 ..........................j.:{..
04e0 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 9f 00 00 00 12 23 69 6e 63 6c ...........................#incl
0500 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 ude.<stdio.h>....#include.<stdli
0520 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 b.h>....#include.<string.h>....#
0540 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 include.<time.h>........typedef.
0560 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 0e 20 20 20 struct.{........int.year;.......
0580 20 69 6e 74 20 6d 6f 6e 74 68 3b 00 00 00 0c 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 0d 20 .int.month;........int.day;.....
05a0 20 20 20 69 6e 74 20 68 6f 75 72 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 3b 00 ...int.hour;........int.minute;.
05c0 00 00 0f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 3b 00 00 00 0b 7d 20 64 61 74 65 74 69 6d 65 .......int.second;....}.datetime
05e0 3b 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 ;........typedef.struct.{.......
0600 20 69 6e 74 20 79 65 61 72 3b 00 00 00 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 .int.year;........int.is_leap;..
0620 00 1b 20 20 20 20 69 6e 74 20 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 ......int.days_per_month[12];...
0640 0b 7d 20 63 61 6c 65 6e 64 61 72 3b 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 .}.calendar;.......8calendar.loa
0660 64 5f 63 61 6c 65 6e 64 61 72 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c d_calendar(const.char.*filename,
0680 20 69 6e 74 20 79 65 61 72 29 20 7b 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c .int.year).{........calendar.cal
06a0 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 ;........cal.year.=.year;.......
06c0 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 30 3b 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 .cal.is_leap.=.0;...#....FILE.*f
06e0 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 0d 20 20 20 20 .=.fopen(filename,."r");........
0700 69 66 20 28 21 66 29 20 7b 00 00 00 26 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 if.(!f).{...&........for.(int.i.
0720 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 33 20 20 20 20 20 20 20 20 20 =.0;.i.<.12;.i++).{...3.........
0740 20 20 20 69 66 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 ...if.(i.==.1).cal.days_per_mont
0760 68 5b 69 5d 20 3d 20 32 38 3b 00 00 00 57 20 20 20 20 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 h[i].=.28;...W............else.i
0780 66 20 28 69 20 3d 3d 20 33 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c f.(i.==.3.||.i.==.5.||.i.==.8.||
07a0 20 69 20 3d 3d 20 31 30 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 .i.==.10).cal.days_per_month[i].
07c0 3d 20 33 30 3b 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 =.30;...,............else.cal.da
07e0 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 31 3b 00 00 00 09 20 20 20 20 20 20 20 ys_per_month[i].=.31;...........
0800 20 7d 00 00 00 13 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 05 20 20 20 .}............return.cal;.......
0820 20 7d 00 00 00 13 20 20 20 20 63 68 61 72 20 6c 69 6e 65 5b 32 35 36 5d 3b 00 00 00 2a 20 20 20 .}........char.line[256];...*...
0840 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 .while.(fgets(line,.sizeof(line)
0860 2c 20 66 29 29 20 7b 00 00 00 14 20 20 20 20 20 20 20 20 69 6e 74 20 79 2c 20 6d 2c 20 64 3b 00 ,.f)).{............int.y,.m,.d;.
0880 00 00 45 20 20 20 20 20 20 20 20 69 66 20 28 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 25 64 20 ..E........if.(sscanf(line,."%d.
08a0 25 64 20 25 64 22 2c 20 26 79 2c 20 26 6d 2c 20 26 64 29 20 3d 3d 20 33 20 26 26 20 79 20 3d 3d %d.%d",.&y,.&m,.&d).==.3.&&.y.==
08c0 20 79 65 61 72 29 20 7b 00 00 00 3f 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 20 3e 3d .year).{...?............if.(m.>=
08e0 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 .1.&&.m.<=.12).cal.days_per_mont
0900 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 h[m-1].=.d;............}........
0920 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 12 20 20 20 20 69 6e 74 20 74 }........fclose(f);........int.t
0940 6f 74 61 6c 20 3d 20 30 3b 00 00 00 40 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b otal.=.0;...@....for.(int.i.=.0;
0960 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 74 6f 74 61 6c 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f .i.<.12;.i++).total.+=.cal.days_
0980 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 26 20 20 20 20 69 66 20 28 74 6f 74 61 6c 20 3d per_month[i];...&....if.(total.=
09a0 3d 20 33 36 36 29 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 31 3b 00 00 00 0f 20 20 20 20 72 =.366).cal.is_leap.=.1;........r
09c0 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 10 64 61 74 65 74 69 6d 65 20 eturn.cal;....}........datetime.
09e0 6e 6f 77 28 29 20 7b 00 00 00 10 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 1a 20 now().{........datetime.dt;.....
0a00 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 25 20 20 20 ...time_t.t.=.time(NULL);...%...
0a20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 .struct.tm.*local.=.localtime(&t
0a40 29 3b 00 00 00 24 20 20 20 20 64 74 2e 79 65 61 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 65 );...$....dt.year.=.local->tm_ye
0a60 61 72 20 2b 20 31 39 30 30 3b 00 00 00 21 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6c 6f 63 ar.+.1900;...!....dt.month.=.loc
0a80 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1c 20 20 20 20 64 74 2e 64 61 79 20 3d 20 al->tm_mon.+.1;........dt.day.=.
0aa0 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1d 20 20 20 20 64 74 2e 68 6f 75 72 20 3d local->tm_mday;........dt.hour.=
0ac0 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1e 20 20 20 20 64 74 2e 6d 69 6e 75 74 .local->tm_hour;........dt.minut
0ae0 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 00 00 1e 20 20 20 20 64 74 2e 73 65 63 e.=.local->tm_min;........dt.sec
0b00 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 3b 00 00 00 0e 20 20 20 20 72 65 74 75 ond.=.local->tm_sec;........retu
0b20 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2c 6c 6f 6e 67 20 64 61 74 65 74 69 6d 65 rn.dt;....}.......,long.datetime
0b40 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 64 74 2c 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 _to_seconds(dt,.calendar.cal).{.
0b60 00 00 13 20 20 20 20 6c 6f 6e 67 20 74 6f 74 61 6c 20 3d 20 30 3b 00 00 00 2a 20 20 20 20 66 6f .......long.total.=.0;...*....fo
0b80 72 20 28 69 6e 74 20 79 20 3d 20 31 39 37 30 3b 20 79 20 3c 20 64 74 2e 79 65 61 72 3b 20 79 2b r.(int.y.=.1970;.y.<.dt.year;.y+
0ba0 2b 29 20 7b 00 00 00 36 20 20 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 20 3d 20 6c 6f 61 +).{...6........calendar.c.=.loa
0bc0 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 d_calendar("calendar.txt",.y);..
0be0 00 4a 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 .J........for.(int.m.=.0;.m.<.12
0c00 3b 20 6d 2b 2b 29 20 74 6f 74 61 6c 20 2b 3d 20 63 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 ;.m++).total.+=.c.days_per_month
0c20 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 05 20 20 20 20 7d 00 00 00 52 20 20 20 20 66 6f 72 [m].*.86400;........}...R....for
0c40 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 64 74 2e 6d 6f 6e 74 68 20 2d 20 31 3b 20 6d .(int.m.=.0;.m.<.dt.month.-.1;.m
0c60 2b 2b 29 20 74 6f 74 61 6c 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b ++).total.+=.cal.days_per_month[
0c80 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 22 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 28 64 74 2e m].*.86400;..."....total.+=.(dt.
0ca0 64 61 79 20 2d 20 31 29 20 2a 20 38 36 34 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b day.-.1).*.86400;........total.+
0cc0 3d 20 64 74 2e 68 6f 75 72 20 2a 20 33 36 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b =.dt.hour.*.3600;........total.+
0ce0 3d 20 64 74 2e 6d 69 6e 75 74 65 20 2a 20 36 30 3b 00 00 00 17 20 20 20 20 74 6f 74 61 6c 20 2b =.dt.minute.*.60;........total.+
0d00 3d 20 64 74 2e 73 65 63 6f 6e 64 3b 00 00 00 11 20 20 20 20 72 65 74 75 72 6e 20 74 6f 74 61 6c =.dt.second;........return.total
0d20 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3a 64 61 74 65 74 69 6d 65 20 73 65 63 6f 6e 64 73 5f 74 ;....}.......:datetime.seconds_t
0d40 6f 5f 64 61 74 65 74 69 6d 65 28 6c 6f 6e 67 20 73 65 63 6f 6e 64 73 2c 20 63 61 6c 65 6e 64 61 o_datetime(long.seconds,.calenda
0d60 72 20 63 61 6c 29 20 7b 00 00 00 10 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 17 r.cal).{........datetime.dt;....
0d80 20 20 20 20 64 74 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 1d 20 20 20 20 6c ....dt.year.=.cal.year;........l
0da0 6f 6e 67 20 72 65 6d 61 69 6e 69 6e 67 20 3d 20 73 65 63 6f 6e 64 73 3b 00 00 00 22 20 20 20 20 ong.remaining.=.seconds;..."....
0dc0 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 7b 00 00 for.(int.m.=.0;.m.<.12;.m++).{..
0de0 00 38 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 5f 73 65 63 6f 6e 64 73 20 3d 20 63 61 6c 2e .8........int.day_seconds.=.cal.
0e00 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 20 days_per_month[m].*.86400;...&..
0e20 20 20 20 20 20 20 69 66 20 28 72 65 6d 61 69 6e 69 6e 67 20 3c 20 64 61 79 5f 73 65 63 6f 6e 64 ......if.(remaining.<.day_second
0e40 73 29 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6d s).{................dt.month.=.m
0e60 20 2b 20 31 3b 00 00 00 2b 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 64 61 79 20 3d 20 72 65 .+.1;...+............dt.day.=.re
0e80 6d 61 69 6e 69 6e 67 20 2f 20 38 36 34 30 30 20 2b 20 31 3b 00 00 00 1f 20 20 20 20 20 20 20 20 maining./.86400.+.1;............
0ea0 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 25 3d 20 38 36 34 30 30 3b 00 00 00 27 20 20 20 20 20 ....remaining.%=.86400;...'.....
0ec0 20 20 20 20 20 20 20 64 74 2e 68 6f 75 72 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 33 36 30 .......dt.hour.=.remaining./.360
0ee0 30 3b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 25 3d 20 33 0;................remaining.%=.3
0f00 36 30 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 69 6e 75 74 65 20 3d 20 600;...'............dt.minute.=.
0f20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 36 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 remaining./.60;...'............d
0f40 74 2e 73 65 63 6f 6e 64 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 25 20 36 30 3b 00 00 00 12 20 20 t.second.=.remaining.%.60;......
0f60 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 ..........break;............}...
0f80 21 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 2d 3d 20 64 61 79 5f 73 65 63 6f 6e 64 !........remaining.-=.day_second
0fa0 73 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 s;........}........return.dt;...
0fc0 01 7d 00 00 00 00 00 00 00 3d 64 6f 75 62 6c 65 20 6d 65 61 73 75 72 65 5f 64 61 79 5f 6c 65 6e .}.......=double.measure_day_len
0fe0 67 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 gth(calendar.cal,.int.month,.int
1000 20 64 61 79 29 20 7b 00 00 00 1d 20 20 20 20 64 61 74 65 74 69 6d 65 20 73 75 6e 72 69 73 65 2c .day).{........datetime.sunrise,
1020 20 73 75 6e 73 65 74 3b 00 00 00 1c 20 20 20 20 73 75 6e 72 69 73 65 2e 79 65 61 72 20 3d 20 63 .sunset;........sunrise.year.=.c
1040 61 6c 2e 79 65 61 72 3b 00 00 00 1a 20 20 20 20 73 75 6e 72 69 73 65 2e 6d 6f 6e 74 68 20 3d 20 al.year;........sunrise.month.=.
1060 6d 6f 6e 74 68 3b 00 00 00 16 20 20 20 20 73 75 6e 72 69 73 65 2e 64 61 79 20 3d 20 64 61 79 3b month;........sunrise.day.=.day;
1080 00 00 00 15 20 20 20 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 36 3b 00 00 00 17 20 20 20 ........sunrise.hour.=.6;.......
10a0 20 73 75 6e 72 69 73 65 2e 6d 69 6e 75 74 65 20 3d 20 30 3b 00 00 00 17 20 20 20 20 73 75 6e 72 .sunrise.minute.=.0;........sunr
10c0 69 73 65 2e 73 65 63 6f 6e 64 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 73 75 6e 73 65 74 2e 79 65 ise.second.=.0;........sunset.ye
10e0 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 19 20 20 20 20 73 75 6e 73 65 74 2e 6d 6f 6e ar.=.cal.year;........sunset.mon
1100 74 68 20 3d 20 6d 6f 6e 74 68 3b 00 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 64 61 79 20 3d 20 th.=.month;........sunset.day.=.
1120 64 61 79 3b 00 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 38 3b 00 00 00 day;........sunset.hour.=.18;...
1140 16 20 20 20 20 73 75 6e 73 65 74 2e 6d 69 6e 75 74 65 20 3d 20 30 3b 00 00 00 16 20 20 20 20 73 .....sunset.minute.=.0;........s
1160 75 6e 73 65 74 2e 73 65 63 6f 6e 64 20 3d 20 30 3b 00 00 00 33 20 20 20 20 6c 6f 6e 67 20 73 74 unset.second.=.0;...3....long.st
1180 61 72 74 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 73 75 6e 72 69 73 art.=.datetime_to_seconds(sunris
11a0 65 2c 20 63 61 6c 29 3b 00 00 00 30 20 20 20 20 6c 6f 6e 67 20 65 6e 64 20 3d 20 64 61 74 65 74 e,.cal);...0....long.end.=.datet
11c0 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 73 75 6e 73 65 74 2c 20 63 61 6c 29 3b 00 00 00 22 ime_to_seconds(sunset,.cal);..."
11e0 20 20 20 20 72 65 74 75 72 6e 20 28 65 6e 64 20 2d 20 73 74 61 72 74 29 20 2f 20 33 36 30 30 2e ....return.(end.-.start)./.3600.
1200 30 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 73 74 6f 70 77 61 74 63 68 28 63 61 0;....}........void.stopwatch(ca
1220 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 36 20 20 20 20 70 72 69 6e 74 66 28 22 73 74 6f lendar.cal).{...6....printf("sto
1240 70 77 61 74 63 68 20 73 74 61 72 74 65 64 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 pwatch.started.press.enter.to.st
1260 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b 20 20 20 op\n");........getchar();.......
1280 20 64 61 74 65 74 69 6d 65 20 73 74 61 72 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 32 20 20 20 20 .datetime.start.=.now();...2....
12a0 70 72 69 6e 74 66 28 22 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 61 67 61 69 printf("running.press.enter.agai
12c0 6e 20 74 6f 20 73 74 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b n.to.stop\n");........getchar();
12e0 00 00 00 19 20 20 20 20 64 61 74 65 74 69 6d 65 20 65 6e 64 20 3d 20 6e 6f 77 28 29 3b 00 00 00 ........datetime.end.=.now();...
1300 35 20 20 20 20 6c 6f 6e 67 20 73 74 61 72 74 5f 73 65 63 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 5....long.start_sec.=.datetime_t
1320 6f 5f 73 65 63 6f 6e 64 73 28 73 74 61 72 74 2c 20 63 61 6c 29 3b 00 00 00 31 20 20 20 20 6c 6f o_seconds(start,.cal);...1....lo
1340 6e 67 20 65 6e 64 5f 73 65 63 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 ng.end_sec.=.datetime_to_seconds
1360 28 65 6e 64 2c 20 63 61 6c 29 3b 00 00 00 24 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 (end,.cal);...$....long.diff.=.e
1380 6e 64 5f 73 65 63 20 2d 20 73 74 61 72 74 5f 73 65 63 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 68 nd_sec.-.start_sec;........int.h
13a0 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 20 69 6e 74 20 6d ours.=.diff./.3600;...%....int.m
13c0 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 30 3b 00 00 00 1c inutes.=.(diff.%.3600)./.60;....
13e0 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 30 3b 00 00 00 38 ....int.seconds.=.diff.%.60;...8
1400 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 68 ....printf("%02d:%02d:%02d\n",.h
1420 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 01 7d 00 00 00 ours,.minutes,.seconds);....}...
1440 00 00 00 00 22 76 6f 69 64 20 73 68 6f 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 6e 64 61 72 ...."void.show_calendar(calendar
1460 20 63 61 6c 29 20 7b 00 00 00 37 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 20 6c .cal).{...7....printf("year.%d.l
1480 65 61 70 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 79 65 61 72 2c 20 63 61 6c 2e 69 73 5f 6c 65 61 70 eap.%d\n",.cal.year,.cal.is_leap
14a0 29 3b 00 00 00 5f 20 20 20 20 63 68 61 72 20 2a 6d 6f 6e 74 68 73 5b 5d 20 3d 20 7b 22 6a 61 6e );..._....char.*months[].=.{"jan
14c0 22 2c 22 66 65 62 22 2c 22 6d 61 72 22 2c 22 61 70 72 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 22 2c ","feb","mar","apr","may","jun",
14e0 22 6a 75 6c 22 2c 22 61 75 67 22 2c 22 73 65 70 22 2c 22 6f 63 74 22 2c 22 6e 6f 76 22 2c 22 64 "jul","aug","sep","oct","nov","d
1500 65 63 22 7d 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c ec"};..."....for.(int.i.=.0;.i.<
1520 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 41 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 .12;.i++).{...A........printf("%
1540 73 20 25 64 20 64 61 79 73 5c 6e 22 2c 20 6d 6f 6e 74 68 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 s.%d.days\n",.months[i],.cal.day
1560 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 s_per_month[i]);........}....}..
1580 00 00 00 00 00 0c 69 6e 74 20 6d 61 69 6e 28 29 20 7b 00 00 00 37 20 20 20 20 63 61 6c 65 6e 64 ......int.main().{...7....calend
15a0 61 72 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 ar.cal.=.load_calendar("calendar
15c0 2e 74 78 74 22 2c 20 32 30 32 34 29 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 63 68 6f 69 63 65 3b .txt",.2024);........int.choice;
15e0 00 00 00 64 20 20 20 20 70 72 69 6e 74 66 28 22 63 6f 6d 70 74 65 75 72 5c 6e 31 20 73 74 6f 70 ...d....printf("compteur\n1.stop
1600 77 61 74 63 68 5c 6e 32 20 6d 65 61 73 75 72 65 20 64 61 79 20 6c 65 6e 67 74 68 5c 6e 33 20 73 watch\n2.measure.day.length\n3.s
1620 68 6f 77 20 63 61 6c 65 6e 64 61 72 5c 6e 34 20 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e 63 68 how.calendar\n4.current.time\nch
1640 6f 69 63 65 20 22 29 3b 00 00 00 19 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 63 68 6f oice.");........scanf("%d",.&cho
1660 69 63 65 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 24 20 20 20 20 69 ice);........getchar();...$....i
1680 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 31 29 20 73 74 6f 70 77 61 74 63 68 28 63 61 6c 29 3b 00 f.(choice.==.1).stopwatch(cal);.
16a0 00 00 1b 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 32 29 20 7b 00 00 .......else.if.(choice.==.2).{..
16c0 00 10 20 20 20 20 20 20 20 20 69 6e 74 20 6d 2c 64 3b 00 00 00 1d 20 20 20 20 20 20 20 20 70 72 ..........int.m,d;............pr
16e0 69 6e 74 66 28 22 6d 6f 6e 74 68 20 64 61 79 20 22 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 73 intf("month.day.");............s
1700 63 61 6e 66 28 22 25 64 20 25 64 22 2c 20 26 6d 2c 20 26 64 29 3b 00 00 00 33 20 20 20 20 20 20 canf("%d.%d",.&m,.&d);...3......
1720 20 20 64 6f 75 62 6c 65 20 6c 65 6e 20 3d 20 6d 65 61 73 75 72 65 5f 64 61 79 5f 6c 65 6e 67 74 ..double.len.=.measure_day_lengt
1740 68 28 63 61 6c 2c 20 6d 2c 20 64 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 h(cal,.m,.d);.../........printf(
1760 22 64 61 79 20 6c 65 6e 67 74 68 20 25 2e 32 66 20 68 6f 75 72 73 5c 6e 22 2c 20 6c 65 6e 29 3b "day.length.%.2f.hours\n",.len);
1780 00 00 00 05 20 20 20 20 7d 00 00 00 2d 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 ........}...-....else.if.(choice
17a0 20 3d 3d 20 33 29 20 73 68 6f 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 29 3b 00 00 00 1b 20 20 .==.3).show_calendar(cal);......
17c0 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 34 29 20 7b 00 00 00 1b 20 20 20 ..else.if.(choice.==.4).{.......
17e0 20 20 20 20 20 64 61 74 65 74 69 6d 65 20 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 66 20 20 20 20 .....datetime.t.=.now();...f....
1800 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 34 64 2d 25 30 32 64 2d 25 30 32 64 20 25 30 32 64 3a ....printf("%04d-%02d-%02d.%02d:
1820 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 74 2e 79 65 61 72 2c 20 74 2e 6d 6f 6e 74 68 2c 20 74 %02d:%02d\n",.t.year,.t.month,.t
1840 2e 64 61 79 2c 20 74 2e 68 6f 75 72 2c 20 74 2e 6d 69 6e 75 74 65 2c 20 74 2e 73 65 63 6f 6e 64 .day,.t.hour,.t.minute,.t.second
1860 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 01 );........}........return.0;....
1880 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 9f 00 00 00 00 00 00 00 01 00 00 00 00 00 00 }5..............................
18a0 00 00 00 00 00 00 00 00 00 ad 11 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 .........................5._....
18c0 02 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ................................
18e0 ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1980 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1a00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1a20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a ...............................j
1a40 00 3a 7c 04 01 00 00 00 03 00 f5 18 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 .:|.............................
1a60 20 20 20 f5 18 00 00 00 91 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 ................................
1a80 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 .............................5..
1aa0 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 03 00 00 00 00 00 00 ................................
1ac0 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 90 00 00 00 03 ................................
1ae0 00 00 00 00 00 00 00 00 00 00 00 0c 00 00 00 01 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 ................................
1b00 00 00 00 98 01 00 00 00 00 00 00 35 81 5f d0 00 00 00 03 00 00 00 05 00 00 00 00 00 00 00 00 00 ...........5._..................
1b20 00 00 04 00 00 00 01 00 00 00 11 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 ................................
1b40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1b60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1b80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1ba0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1bc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1be0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1c00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1c20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1c40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
1c80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3b 2a 04 01 00 00 00 00 00 f5 18 00 00 .................j.;*...........
1ca0 00 00 00 00 00 02 00 00 00 00 00 00 00 9d 00 00 00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 ..................#include.<stdi
1cc0 6f 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 o.h>....#include.<stdlib.h>....#
1ce0 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c include.<string.h>....#include.<
1d00 74 69 6d 65 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 time.h>........typedef.struct.{.
1d20 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 0e 20 20 20 20 69 6e 74 20 6d 6f 6e 74 .......int.year;........int.mont
1d40 68 3b 00 00 00 0c 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 0d 20 20 20 20 69 6e 74 20 68 6f h;........int.day;........int.ho
1d60 75 72 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 3b 00 00 00 0f 20 20 20 20 69 6e ur;........int.minute;........in
1d80 74 20 73 65 63 6f 6e 64 3b 00 00 00 0b 7d 20 64 61 74 65 74 69 6d 65 3b 00 00 00 00 00 00 00 10 t.second;....}.datetime;........
1da0 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 typedef.struct.{........int.year
1dc0 3b 00 00 00 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 ;........int.is_leap;........int
1de0 20 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 .days_per_month[12];....}.calend
1e00 61 72 3b 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 ar;.......8calendar.load_calenda
1e20 72 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 r(const.char.*filename,.int.year
1e40 29 20 7b 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 ).{........calendar.cal;........
1e60 63 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c cal.year.=.year;........cal.is_l
1e80 65 61 70 20 3d 20 30 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 eap.=.0;..."....for.(int.i.=.0;.
1ea0 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 2f 20 20 20 20 20 20 20 20 69 66 20 28 69 20 i.<.12;.i++).{.../........if.(i.
1ec0 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 32 38 ==.1).cal.days_per_month[i].=.28
1ee0 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 33 20 7c 7c 20 ;...S........else.if.(i.==.3.||.
1f00 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d 20 31 30 29 20 63 61 6c i.==.5.||.i.==.8.||.i.==.10).cal
1f20 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b 00 00 00 28 20 20 20 20 .days_per_month[i].=.30;...(....
1f40 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d ....else.cal.days_per_month[i].=
1f60 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 20 3d 20 66 .31;........}...#....FILE.*f.=.f
1f80 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 20 20 20 20 69 66 20 28 open(filename,."r");........if.(
1fa0 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 20 63 68 61 72 20 6c 69 6e 65 !f).return.cal;........char.line
1fc0 5b 32 35 36 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c 69 6e 65 2c [256];...*....while.(fgets(line,
1fe0 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 00 14 20 20 20 20 20 20 20 20 .sizeof(line),.f)).{............
2000 69 6e 74 20 79 2c 20 6d 2c 20 64 3b 00 00 00 45 20 20 20 20 20 20 20 20 69 66 20 28 73 73 63 61 int.y,.m,.d;...E........if.(ssca
2020 6e 66 28 6c 69 6e 65 2c 20 22 25 64 20 25 64 20 25 64 22 2c 20 26 79 2c 20 26 6d 2c 20 26 64 29 nf(line,."%d.%d.%d",.&y,.&m,.&d)
2040 20 3d 3d 20 33 20 26 26 20 79 20 3d 3d 20 79 65 61 72 29 20 7b 00 00 00 3f 20 20 20 20 20 20 20 .==.3.&&.y.==.year).{...?.......
2060 20 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 63 61 6c 2e .....if.(m.>=.1.&&.m.<=.12).cal.
2080 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 09 20 20 20 20 days_per_month[m-1].=.d;........
20a0 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b ....}........}........fclose(f);
20c0 00 00 00 12 20 20 20 20 69 6e 74 20 74 6f 74 61 6c 20 3d 20 30 3b 00 00 00 40 20 20 20 20 66 6f ........int.total.=.0;...@....fo
20e0 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 74 6f 74 61 6c r.(int.i.=.0;.i.<.12;.i++).total
2100 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 26 20 20 .+=.cal.days_per_month[i];...&..
2120 20 20 69 66 20 28 74 6f 74 61 6c 20 3d 3d 20 33 36 36 29 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 ..if.(total.==.366).cal.is_leap.
2140 3d 20 31 3b 00 00 00 0f 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 =.1;........return.cal;....}....
2160 00 00 00 10 64 61 74 65 74 69 6d 65 20 6e 6f 77 28 29 20 7b 00 00 00 10 20 20 20 20 64 61 74 65 ....datetime.now().{........date
2180 74 69 6d 65 20 64 74 3b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 time.dt;........time_t.t.=.time(
21a0 4e 55 4c 4c 29 3b 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d NULL);...%....struct.tm.*local.=
21c0 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 24 20 20 20 20 64 74 2e 79 65 61 72 20 3d .localtime(&t);...$....dt.year.=
21e0 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 21 20 20 20 20 64 .local->tm_year.+.1900;...!....d
2200 74 2e 6d 6f 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1c t.month.=.local->tm_mon.+.1;....
2220 20 20 20 20 64 74 2e 64 61 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1d ....dt.day.=.local->tm_mday;....
2240 20 20 20 20 64 74 2e 68 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 ....dt.hour.=.local->tm_hour;...
2260 1e 20 20 20 20 64 74 2e 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 .....dt.minute.=.local->tm_min;.
2280 00 00 1e 20 20 20 20 64 74 2e 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 .......dt.second.=.local->tm_sec
22a0 3b 00 00 00 0e 20 20 20 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 00 00 35 ;........return.dt;....}.......5
22c0 6c 6f 6e 67 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 64 61 74 65 74 69 6d long.datetime_to_seconds(datetim
22e0 65 20 64 74 2c 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 13 20 20 20 20 6c 6f 6e e.dt,.calendar.cal).{........lon
2300 67 20 74 6f 74 61 6c 20 3d 20 30 3b 00 00 00 2a 20 20 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d g.total.=.0;...*....for.(int.y.=
2320 20 31 39 37 30 3b 20 79 20 3c 20 64 74 2e 79 65 61 72 3b 20 79 2b 2b 29 20 7b 00 00 00 36 20 20 .1970;.y.<.dt.year;.y++).{...6..
2340 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 ......calendar.c.=.load_calendar
2360 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 4a 20 20 20 20 20 20 20 20 ("calendar.txt",.y);...J........
2380 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 74 6f 74 for.(int.m.=.0;.m.<.12;.m++).tot
23a0 61 6c 20 2b 3d 20 63 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 al.+=.c.days_per_month[m].*.8640
23c0 30 3b 00 00 00 05 20 20 20 20 7d 00 00 00 52 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 0;........}...R....for.(int.m.=.
23e0 30 3b 20 6d 20 3c 20 64 74 2e 6d 6f 6e 74 68 20 2d 20 31 3b 20 6d 2b 2b 29 20 74 6f 74 61 6c 20 0;.m.<.dt.month.-.1;.m++).total.
2400 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 +=.cal.days_per_month[m].*.86400
2420 3b 00 00 00 22 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 28 64 74 2e 64 61 79 20 2d 20 31 29 20 2a ;..."....total.+=.(dt.day.-.1).*
2440 20 38 36 34 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 68 6f 75 72 20 .86400;........total.+=.dt.hour.
2460 2a 20 33 36 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 6d 69 6e 75 74 *.3600;........total.+=.dt.minut
2480 65 20 2a 20 36 30 3b 00 00 00 17 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 73 65 63 6f 6e e.*.60;........total.+=.dt.secon
24a0 64 3b 00 00 00 11 20 20 20 20 72 65 74 75 72 6e 20 74 6f 74 61 6c 3b 00 00 00 01 7d 00 00 00 00 d;........return.total;....}....
24c0 00 00 00 3a 64 61 74 65 74 69 6d 65 20 73 65 63 6f 6e 64 73 5f 74 6f 5f 64 61 74 65 74 69 6d 65 ...:datetime.seconds_to_datetime
24e0 28 6c 6f 6e 67 20 73 65 63 6f 6e 64 73 2c 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 (long.seconds,.calendar.cal).{..
2500 00 10 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 17 20 20 20 20 64 74 2e 79 65 61 ......datetime.dt;........dt.yea
2520 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 1d 20 20 20 20 6c 6f 6e 67 20 72 65 6d 61 69 6e r.=.cal.year;........long.remain
2540 69 6e 67 20 3d 20 73 65 63 6f 6e 64 73 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d ing.=.seconds;..."....for.(int.m
2560 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 7b 00 00 00 38 20 20 20 20 20 20 20 20 .=.0;.m.<.12;.m++).{...8........
2580 69 6e 74 20 64 61 79 5f 73 65 63 6f 6e 64 73 20 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d int.day_seconds.=.cal.days_per_m
25a0 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 20 20 20 20 20 20 20 69 66 20 28 onth[m].*.86400;...&........if.(
25c0 72 65 6d 61 69 6e 69 6e 67 20 3c 20 64 61 79 5f 73 65 63 6f 6e 64 73 29 20 7b 00 00 00 1d 20 20 remaining.<.day_seconds).{......
25e0 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6d 20 2b 20 31 3b 00 00 00 2b 20 ..........dt.month.=.m.+.1;...+.
2600 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 64 61 79 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 ...........dt.day.=.remaining./.
2620 38 36 34 30 30 20 2b 20 31 3b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 86400.+.1;................remain
2640 69 6e 67 20 25 3d 20 38 36 34 30 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e ing.%=.86400;...'............dt.
2660 68 6f 75 72 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 33 36 30 30 3b 00 00 00 1e 20 20 20 20 hour.=.remaining./.3600;........
2680 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 25 3d 20 33 36 30 30 3b 00 00 00 27 20 20 ........remaining.%=.3600;...'..
26a0 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 69 6e 75 74 65 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 ..........dt.minute.=.remaining.
26c0 2f 20 36 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 73 65 63 6f 6e 64 20 3d /.60;...'............dt.second.=
26e0 20 72 65 6d 61 69 6e 69 6e 67 20 25 20 36 30 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 .remaining.%.60;................
2700 62 72 65 61 6b 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 21 20 20 20 20 20 20 20 20 72 break;............}...!........r
2720 65 6d 61 69 6e 69 6e 67 20 2d 3d 20 64 61 79 5f 73 65 63 6f 6e 64 73 3b 00 00 00 05 20 20 20 20 emaining.-=.day_seconds;........
2740 7d 00 00 00 0e 20 20 20 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3d }........return.dt;....}.......=
2760 64 6f 75 62 6c 65 20 6d 65 61 73 75 72 65 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 65 6e 64 double.measure_day_length(calend
2780 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 ar.cal,.int.month,.int.day).{...
27a0 1d 20 20 20 20 64 61 74 65 74 69 6d 65 20 73 75 6e 72 69 73 65 2c 20 73 75 6e 73 65 74 3b 00 00 .....datetime.sunrise,.sunset;..
27c0 00 1c 20 20 20 20 73 75 6e 72 69 73 65 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 ......sunrise.year.=.cal.year;..
27e0 00 1a 20 20 20 20 73 75 6e 72 69 73 65 2e 6d 6f 6e 74 68 20 3d 20 6d 6f 6e 74 68 3b 00 00 00 16 ......sunrise.month.=.month;....
2800 20 20 20 20 73 75 6e 72 69 73 65 2e 64 61 79 20 3d 20 64 61 79 3b 00 00 00 15 20 20 20 20 73 75 ....sunrise.day.=.day;........su
2820 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 36 3b 00 00 00 17 20 20 20 20 73 75 6e 72 69 73 65 2e 6d nrise.hour.=.6;........sunrise.m
2840 69 6e 75 74 65 20 3d 20 30 3b 00 00 00 17 20 20 20 20 73 75 6e 72 69 73 65 2e 73 65 63 6f 6e 64 inute.=.0;........sunrise.second
2860 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 73 75 6e 73 65 74 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 .=.0;........sunset.year.=.cal.y
2880 65 61 72 3b 00 00 00 19 20 20 20 20 73 75 6e 73 65 74 2e 6d 6f 6e 74 68 20 3d 20 6d 6f 6e 74 68 ear;........sunset.month.=.month
28a0 3b 00 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 64 61 79 20 3d 20 64 61 79 3b 00 00 00 15 20 20 ;........sunset.day.=.day;......
28c0 20 20 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 38 3b 00 00 00 16 20 20 20 20 73 75 6e 73 65 ..sunset.hour.=.18;........sunse
28e0 74 2e 6d 69 6e 75 74 65 20 3d 20 30 3b 00 00 00 16 20 20 20 20 73 75 6e 73 65 74 2e 73 65 63 6f t.minute.=.0;........sunset.seco
2900 6e 64 20 3d 20 30 3b 00 00 00 33 20 20 20 20 6c 6f 6e 67 20 73 74 61 72 74 20 3d 20 64 61 74 65 nd.=.0;...3....long.start.=.date
2920 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 73 75 6e 72 69 73 65 2c 20 63 61 6c 29 3b 00 00 time_to_seconds(sunrise,.cal);..
2940 00 30 20 20 20 20 6c 6f 6e 67 20 65 6e 64 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 .0....long.end.=.datetime_to_sec
2960 6f 6e 64 73 28 73 75 6e 73 65 74 2c 20 63 61 6c 29 3b 00 00 00 22 20 20 20 20 72 65 74 75 72 6e onds(sunset,.cal);..."....return
2980 20 28 65 6e 64 20 2d 20 73 74 61 72 74 29 20 2f 20 33 36 30 30 2e 30 3b 00 00 00 01 7d 00 00 00 .(end.-.start)./.3600.0;....}...
29a0 00 00 00 00 1e 76 6f 69 64 20 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c .....void.stopwatch(calendar.cal
29c0 29 20 7b 00 00 00 36 20 20 20 20 70 72 69 6e 74 66 28 22 73 74 6f 70 77 61 74 63 68 20 73 74 61 ).{...6....printf("stopwatch.sta
29e0 72 74 65 64 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 6f 70 5c 6e 22 29 3b 00 00 00 rted.press.enter.to.stop\n");...
2a00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b 20 20 20 20 64 61 74 65 74 69 6d 65 20 .....getchar();........datetime.
2a20 73 74 61 72 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 32 20 20 20 20 70 72 69 6e 74 66 28 22 72 75 start.=.now();...2....printf("ru
2a40 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 61 67 61 69 6e 20 74 6f 20 73 74 6f 70 5c nning.press.enter.again.to.stop\
2a60 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 19 20 20 20 20 64 61 n");........getchar();........da
2a80 74 65 74 69 6d 65 20 65 6e 64 20 3d 20 6e 6f 77 28 29 3b 00 00 00 35 20 20 20 20 6c 6f 6e 67 20 tetime.end.=.now();...5....long.
2aa0 73 74 61 72 74 5f 73 65 63 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 start_sec.=.datetime_to_seconds(
2ac0 73 74 61 72 74 2c 20 63 61 6c 29 3b 00 00 00 31 20 20 20 20 6c 6f 6e 67 20 65 6e 64 5f 73 65 63 start,.cal);...1....long.end_sec
2ae0 20 3d 20 64 61 74 65 74 69 6d 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 65 6e 64 2c 20 63 61 6c 29 .=.datetime_to_seconds(end,.cal)
2b00 3b 00 00 00 24 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 5f 73 65 63 20 2d 20 73 ;...$....long.diff.=.end_sec.-.s
2b20 74 61 72 74 5f 73 65 63 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 66 tart_sec;........int.hours.=.dif
2b40 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 28 f./.3600;...%....int.minutes.=.(
2b60 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 65 diff.%.3600)./.60;........int.se
2b80 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 30 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 conds.=.diff.%.60;...8....printf
2ba0 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e 75 ("%02d:%02d:%02d\n",.hours,.minu
2bc0 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 tes,.seconds);....}......."void.
2be0 73 68 6f 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 show_calendar(calendar.cal).{...
2c00 37 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 20 6c 65 61 70 20 25 64 5c 6e 22 2c 7....printf("year.%d.leap.%d\n",
2c20 20 63 61 6c 2e 79 65 61 72 2c 20 63 61 6c 2e 69 73 5f 6c 65 61 70 29 3b 00 00 00 5f 20 20 20 20 .cal.year,.cal.is_leap);..._....
2c40 63 68 61 72 20 2a 6d 6f 6e 74 68 73 5b 5d 20 3d 20 7b 22 6a 61 6e 22 2c 22 66 65 62 22 2c 22 6d char.*months[].=.{"jan","feb","m
2c60 61 72 22 2c 22 61 70 72 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 22 2c 22 6a 75 6c 22 2c 22 61 75 67 ar","apr","may","jun","jul","aug
2c80 22 2c 22 73 65 70 22 2c 22 6f 63 74 22 2c 22 6e 6f 76 22 2c 22 64 65 63 22 7d 3b 00 00 00 22 20 ","sep","oct","nov","dec"};...".
2ca0 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 ...for.(int.i.=.0;.i.<.12;.i++).
2cc0 7b 00 00 00 41 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 64 61 79 73 5c {...A........printf("%s.%d.days\
2ce0 6e 22 2c 20 6d 6f 6e 74 68 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 n",.months[i],.cal.days_per_mont
2d00 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 0c 69 6e 74 20 h[i]);........}....}........int.
2d20 6d 61 69 6e 28 29 20 7b 00 00 00 37 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c main().{...7....calendar.cal.=.l
2d40 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 32 30 32 oad_calendar("calendar.txt",.202
2d60 34 29 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 63 68 6f 69 63 65 3b 00 00 00 64 20 20 20 20 70 72 4);........int.choice;...d....pr
2d80 69 6e 74 66 28 22 63 6f 6d 70 74 65 75 72 5c 6e 31 20 73 74 6f 70 77 61 74 63 68 5c 6e 32 20 6d intf("compteur\n1.stopwatch\n2.m
2da0 65 61 73 75 72 65 20 64 61 79 20 6c 65 6e 67 74 68 5c 6e 33 20 73 68 6f 77 20 63 61 6c 65 6e 64 easure.day.length\n3.show.calend
2dc0 61 72 5c 6e 34 20 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e 63 68 6f 69 63 65 20 22 29 3b 00 00 ar\n4.current.time\nchoice.");..
2de0 00 19 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 63 68 6f 69 63 65 29 3b 00 00 00 0e 20 ......scanf("%d",.&choice);.....
2e00 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 24 20 20 20 20 69 66 20 28 63 68 6f 69 63 65 20 ...getchar();...$....if.(choice.
2e20 3d 3d 20 31 29 20 73 74 6f 70 77 61 74 63 68 28 63 61 6c 29 3b 00 00 00 1b 20 20 20 20 65 6c 73 ==.1).stopwatch(cal);........els
2e40 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 32 29 20 7b 00 00 00 10 20 20 20 20 20 20 20 20 e.if.(choice.==.2).{............
2e60 69 6e 74 20 6d 2c 64 3b 00 00 00 1d 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 6d 6f 6e 74 int.m,d;............printf("mont
2e80 68 20 64 61 79 20 22 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 73 63 61 6e 66 28 22 25 64 20 25 h.day.");............scanf("%d.%
2ea0 64 22 2c 20 26 6d 2c 20 26 64 29 3b 00 00 00 33 20 20 20 20 20 20 20 20 64 6f 75 62 6c 65 20 6c d",.&m,.&d);...3........double.l
2ec0 65 6e 20 3d 20 6d 65 61 73 75 72 65 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 2c 20 6d 2c 20 en.=.measure_day_length(cal,.m,.
2ee0 64 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 64 61 79 20 6c 65 6e 67 74 d);.../........printf("day.lengt
2f00 68 20 25 2e 32 66 20 68 6f 75 72 73 5c 6e 22 2c 20 6c 65 6e 29 3b 00 00 00 05 20 20 20 20 7d 00 h.%.2f.hours\n",.len);........}.
2f20 00 00 2d 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 33 29 20 73 68 6f ..-....else.if.(choice.==.3).sho
2f40 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 29 3b 00 00 00 1b 20 20 20 20 65 6c 73 65 20 69 66 20 w_calendar(cal);........else.if.
2f60 28 63 68 6f 69 63 65 20 3d 3d 20 34 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 64 61 74 65 74 (choice.==.4).{............datet
2f80 69 6d 65 20 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 66 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 ime.t.=.now();...f........printf
2fa0 28 22 25 30 34 64 2d 25 30 32 64 2d 25 30 32 64 20 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c ("%04d-%02d-%02d.%02d:%02d:%02d\
2fc0 6e 22 2c 20 74 2e 79 65 61 72 2c 20 74 2e 6d 6f 6e 74 68 2c 20 74 2e 64 61 79 2c 20 74 2e 68 6f n",.t.year,.t.month,.t.day,.t.ho
2fe0 75 72 2c 20 74 2e 6d 69 6e 75 74 65 2c 20 74 2e 73 65 63 6f 6e 64 29 3b 00 00 00 05 20 20 20 20 ur,.t.minute,.t.second);........
3000 7d 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 }........return.0;....}5........
3020 00 00 00 00 00 00 00 9d 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 92 ................................
3040 11 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 04 00 00 00 06 00 00 00 00 00 ...............5._..............
3060 00 00 00 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 ................................
3080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
30a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
30c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
30e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
31a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
31c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3b 2b 04 01 00 00 00 04 00 .....................j.;+.......
31e0 f5 18 00 00 01 12 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 23 20 20 20 20 70 72 69 6e 74 66 .....................#....printf
3200 28 22 64 69 66 66 65 72 65 6e 63 65 20 25 64 20 64 61 79 73 5c 6e 22 2c 20 f5 18 00 00 01 13 00 ("difference.%d.days\n",........
3220 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 8a 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 ................................
3240 15 76 6f 69 64 20 6d 65 61 73 75 72 65 5f 64 61 79 28 63 61 6c 65 f5 18 00 00 00 8b 00 00 00 00 .void.measure_day(cale..........
3260 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 ................................
3280 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 ................5...............
32a0 00 00 00 00 00 00 00 00 8a 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
32c0 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 8a 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 88 00 ................................
32e0 00 00 23 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 ..#.............................
3300 00 00 00 00 12 01 00 00 23 00 00 00 00 00 00 00 00 00 00 00 2c 00 00 00 01 00 00 00 f8 1f 00 00 ........#...........,...........
3320 00 00 00 00 00 00 00 00 00 00 00 00 98 05 00 00 00 00 00 00 35 81 5f d0 00 00 00 05 00 00 00 07 ....................5._.........
3340 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 ................................
3360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
33a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
33c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
33e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
34a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3b a0 04 01 ..........................j.;...
34c0 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 3f 00 00 00 12 23 69 6e 63 6c ......................?....#incl
34e0 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 ude.<stdio.h>....#include.<stdli
3500 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 b.h>....#include.<string.h>....#
3520 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 include.<time.h>........typedef.
3540 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 0e 20 20 20 struct.{........int.year;.......
3560 20 69 6e 74 20 6d 6f 6e 74 68 3b 00 00 00 0c 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 0d 20 .int.month;........int.day;.....
3580 20 20 20 69 6e 74 20 68 6f 75 72 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 3b 00 ...int.hour;........int.minute;.
35a0 00 00 0f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 3b 00 00 00 0b 7d 20 64 61 74 65 74 69 6d 65 .......int.second;....}.datetime
35c0 3b 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 ;........typedef.struct.{.......
35e0 20 69 6e 74 20 79 65 61 72 3b 00 00 00 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 .int.year;........int.is_leap;..
3600 00 1b 20 20 20 20 69 6e 74 20 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 ......int.days_per_month[12];...
3620 1d 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 .....char.month_names[12][10];..
3640 00 0b 7d 20 63 61 6c 65 6e 64 61 72 3b 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f ..}.calendar;.......8calendar.lo
3660 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 ad_calendar(const.char.*filename
3680 2c 20 69 6e 74 20 79 65 61 72 29 20 7b 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 ,.int.year).{........calendar.ca
36a0 6c 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 l;........cal.year.=.year;......
36c0 20 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 30 3b 00 00 00 8e 20 20 20 20 63 68 61 72 20 2a ..cal.is_leap.=.0;........char.*
36e0 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 31 32 5d 20 3d 20 7b 22 6a 61 6e 75 61 72 79 22 2c 22 default_names[12].=.{"january","
3700 66 65 62 72 75 61 72 79 22 2c 22 6d 61 72 63 68 22 2c 22 61 70 72 69 6c 22 2c 22 6d 61 79 22 2c february","march","april","may",
3720 22 6a 75 6e 65 22 2c 22 6a 75 6c 79 22 2c 22 61 75 67 75 73 74 22 2c 22 73 65 70 74 65 6d 62 65 "june","july","august","septembe
3740 72 22 2c 22 6f 63 74 6f 62 65 72 22 2c 22 6e 6f 76 65 6d 62 65 72 22 2c 22 64 65 63 65 6d 62 65 r","october","november","decembe
3760 72 22 7d 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 r"};..."....for.(int.i.=.0;.i.<.
3780 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 35 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 12;.i++).{...5........strcpy(cal
37a0 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 .month_names[i],.default_names[i
37c0 5d 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 69 66 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 ]);.../........if.(i.==.1).cal.d
37e0 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 32 38 3b 00 00 00 53 20 20 20 20 20 20 ays_per_month[i].=.28;...S......
3800 20 20 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 33 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 ..else.if.(i.==.3.||.i.==.5.||.i
3820 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d 20 31 30 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d .==.8.||.i.==.10).cal.days_per_m
3840 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 onth[i].=.30;...(........else.ca
3860 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 31 3b 00 00 00 05 20 20 20 l.days_per_month[i].=.31;.......
3880 20 7d 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 .}...#....FILE.*f.=.fopen(filena
38a0 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 20 20 20 20 69 66 20 28 21 66 29 20 72 65 74 75 72 6e 20 me,."r");........if.(!f).return.
38c0 63 61 6c 3b 00 00 00 13 20 20 20 20 63 68 61 72 20 6c 69 6e 65 5b 35 31 32 5d 3b 00 00 00 2a 20 cal;........char.line[512];...*.
38e0 20 20 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e ...while.(fgets(line,.sizeof(lin
3900 65 29 2c 20 66 29 29 20 7b 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 e),.f)).{...-........if.(strncmp
3920 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 (line,."year:",.5).==.0).{......
3940 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 ..........int.y;...)............
3960 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 20 25 64 22 2c 20 26 79 29 3b 00 00 00 sscanf(line,."year:.%d",.&y);...
3980 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 20 21 3d 20 79 65 61 72 29 20 63 6f 6e 74 $............if.(y.!=.year).cont
39a0 69 6e 75 65 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 2e 20 20 20 20 20 20 20 20 69 66 inue;............}............if
39c0 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 22 2c 20 36 29 20 3d 3d 20 .(strncmp(line,."month:",.6).==.
39e0 30 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6d 2c 20 64 3b 00 00 00 0).{................int.m,.d;...
3a00 1a 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 6e 61 6d 65 5b 32 30 5d 3b 00 00 00 46 20 .............char.name[20];...F.
3a20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 ...........sscanf(line,."month:.
3a40 25 64 20 64 61 79 73 3a 20 25 64 20 6e 61 6d 65 3a 20 25 73 22 2c 20 26 6d 2c 20 26 64 2c 20 6e %d.days:.%d.name:.%s",.&m,.&d,.n
3a60 61 6d 65 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 ame);...$............if.(m.>=.1.
3a80 26 26 20 6d 20 3c 3d 20 31 32 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &&.m.<=.12).{...,...............
3aa0 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 .cal.days_per_month[m-1].=.d;...
3ac0 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 3................strcpy(cal.mont
3ae0 68 5f 6e 61 6d 65 73 5b 6d 2d 31 5d 2c 20 6e 61 6d 65 29 3b 00 00 00 0d 20 20 20 20 20 20 20 20 h_names[m-1],.name);............
3b00 20 20 20 20 7d 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 ....}............}...-........if
3b20 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 22 2c 20 35 29 20 3d 3d 20 30 .(strncmp(line,."leap:",.5).==.0
3b40 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6c 3b 00 00 00 29 20 20 20 ).{................int.l;...)...
3b60 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 20 25 64 22 .........sscanf(line,."leap:.%d"
3b80 2c 20 26 6c 29 3b 00 00 00 32 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 20 3d ,.&l);...2............if.(year.=
3ba0 3d 20 63 61 6c 2e 79 65 61 72 29 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 6c 3b 00 00 00 09 =.cal.year).cal.is_leap.=.l;....
3bc0 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 ........}........}........fclose
3be0 28 66 29 3b 00 00 00 0f 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 (f);........return.cal;....}....
3c00 00 00 00 2e 69 6e 74 20 69 73 5f 76 61 6c 69 64 5f 64 61 74 65 28 63 61 6c 65 6e 64 61 72 20 63 ....int.is_valid_date(calendar.c
3c20 61 6c 2c 20 64 61 74 65 74 69 6d 65 20 64 74 29 20 7b 00 00 00 26 20 20 20 20 69 66 20 28 64 74 al,.datetime.dt).{...&....if.(dt
3c40 2e 79 65 61 72 20 21 3d 20 63 61 6c 2e 79 65 61 72 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 30 .year.!=.cal.year).return.0;...0
3c60 20 20 20 20 69 66 20 28 64 74 2e 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 64 74 2e 6d 6f 6e 74 68 ....if.(dt.month.<.1.||.dt.month
3c80 20 3e 20 31 32 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 48 20 20 20 20 69 66 20 28 64 74 2e 64 .>.12).return.0;...H....if.(dt.d
3ca0 61 79 20 3c 20 31 20 7c 7c 20 64 74 2e 64 61 79 20 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f ay.<.1.||.dt.day.>.cal.days_per_
3cc0 6d 6f 6e 74 68 5b 64 74 2e 6d 6f 6e 74 68 2d 31 5d 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 2e month[dt.month-1]).return.0;....
3ce0 20 20 20 20 69 66 20 28 64 74 2e 68 6f 75 72 20 3c 20 30 20 7c 7c 20 64 74 2e 68 6f 75 72 20 3e ....if.(dt.hour.<.0.||.dt.hour.>
3d00 20 32 33 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 32 20 20 20 20 69 66 20 28 64 74 2e 6d 69 6e .23).return.0;...2....if.(dt.min
3d20 75 74 65 20 3c 20 30 20 7c 7c 20 64 74 2e 6d 69 6e 75 74 65 20 3e 20 35 39 29 20 72 65 74 75 72 ute.<.0.||.dt.minute.>.59).retur
3d40 6e 20 30 3b 00 00 00 32 20 20 20 20 69 66 20 28 64 74 2e 73 65 63 6f 6e 64 20 3c 20 30 20 7c 7c n.0;...2....if.(dt.second.<.0.||
3d60 20 64 74 2e 73 65 63 6f 6e 64 20 3e 20 35 39 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 0d 20 20 .dt.second.>.59).return.0;......
3d80 20 20 72 65 74 75 72 6e 20 31 3b 00 00 00 01 7d 00 00 00 00 00 00 00 10 64 61 74 65 74 69 6d 65 ..return.1;....}........datetime
3da0 20 6e 6f 77 28 29 20 7b 00 00 00 10 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 1a .now().{........datetime.dt;....
3dc0 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 25 20 20 ....time_t.t.=.time(NULL);...%..
3de0 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 ..struct.tm.*local.=.localtime(&
3e00 74 29 3b 00 00 00 24 20 20 20 20 64 74 2e 79 65 61 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 t);...$....dt.year.=.local->tm_y
3e20 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 21 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6c 6f ear.+.1900;...!....dt.month.=.lo
3e40 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1c 20 20 20 20 64 74 2e 64 61 79 20 3d cal->tm_mon.+.1;........dt.day.=
3e60 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1d 20 20 20 20 64 74 2e 68 6f 75 72 20 .local->tm_mday;........dt.hour.
3e80 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1e 20 20 20 20 64 74 2e 6d 69 6e 75 =.local->tm_hour;........dt.minu
3ea0 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 00 00 1e 20 20 20 20 64 74 2e 73 65 te.=.local->tm_min;........dt.se
3ec0 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 3b 00 00 00 0e 20 20 20 20 72 65 74 cond.=.local->tm_sec;........ret
3ee0 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 00 00 31 6c 6f 6e 67 20 64 61 74 65 5f 74 6f urn.dt;....}.......1long.date_to
3f00 5f 73 65 63 6f 6e 64 73 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 64 61 74 65 74 69 6d 65 20 _seconds(calendar.cal,.datetime.
3f20 64 74 29 20 7b 00 00 00 2b 20 20 20 20 69 66 20 28 21 69 73 5f 76 61 6c 69 64 5f 64 61 74 65 28 dt).{...+....if.(!is_valid_date(
3f40 63 61 6c 2c 20 64 74 29 29 20 72 65 74 75 72 6e 20 2d 31 3b 00 00 00 13 20 20 20 20 6c 6f 6e 67 cal,.dt)).return.-1;........long
3f60 20 74 6f 74 61 6c 20 3d 20 30 3b 00 00 00 2a 20 20 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d 20 .total.=.0;...*....for.(int.y.=.
3f80 31 39 37 30 3b 20 79 20 3c 20 64 74 2e 79 65 61 72 3b 20 79 2b 2b 29 20 7b 00 00 00 37 20 20 20 1970;.y.<.dt.year;.y++).{...7...
3fa0 20 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 79 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 .....calendar.cy.=.load_calendar
3fc0 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 4b 20 20 20 20 20 20 20 20 ("calendar.txt",.y);...K........
3fe0 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 74 6f 74 for.(int.m.=.0;.m.<.12;.m++).tot
4000 61 6c 20 2b 3d 20 63 79 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 al.+=.cy.days_per_month[m].*.864
4020 30 30 3b 00 00 00 05 20 20 20 20 7d 00 00 00 52 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 00;........}...R....for.(int.m.=
4040 20 30 3b 20 6d 20 3c 20 64 74 2e 6d 6f 6e 74 68 20 2d 20 31 3b 20 6d 2b 2b 29 20 74 6f 74 61 6c .0;.m.<.dt.month.-.1;.m++).total
4060 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 .+=.cal.days_per_month[m].*.8640
4080 30 3b 00 00 00 22 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 28 64 74 2e 64 61 79 20 2d 20 31 29 20 0;..."....total.+=.(dt.day.-.1).
40a0 2a 20 38 36 34 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 68 6f 75 72 *.86400;........total.+=.dt.hour
40c0 20 2a 20 33 36 30 30 3b 00 00 00 1c 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 6d 69 6e 75 .*.3600;........total.+=.dt.minu
40e0 74 65 20 2a 20 36 30 3b 00 00 00 17 20 20 20 20 74 6f 74 61 6c 20 2b 3d 20 64 74 2e 73 65 63 6f te.*.60;........total.+=.dt.seco
4100 6e 64 3b 00 00 00 11 20 20 20 20 72 65 74 75 72 6e 20 74 6f 74 61 6c 3b 00 00 00 01 7d 00 00 00 nd;........return.total;....}...
4120 00 00 00 00 36 64 61 74 65 74 69 6d 65 20 73 65 63 6f 6e 64 73 5f 74 6f 5f 64 61 74 65 28 63 61 ....6datetime.seconds_to_date(ca
4140 6c 65 6e 64 61 72 20 63 61 6c 2c 20 6c 6f 6e 67 20 73 65 63 6f 6e 64 73 29 20 7b 00 00 00 10 20 lendar.cal,.long.seconds).{.....
4160 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 17 20 20 20 20 64 74 2e 79 65 61 72 20 3d ...datetime.dt;........dt.year.=
4180 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 11 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 31 3b 00 .cal.year;........dt.month.=.1;.
41a0 00 00 1d 20 20 20 20 6c 6f 6e 67 20 72 65 6d 61 69 6e 69 6e 67 20 3d 20 73 65 63 6f 6e 64 73 3b .......long.remaining.=.seconds;
41c0 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 ..."....for.(int.m.=.0;.m.<.12;.
41e0 6d 2b 2b 29 20 7b 00 00 00 3a 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 5f 73 65 63 6f m++).{...:........int.month_seco
4200 6e 64 73 20 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 nds.=.cal.days_per_month[m].*.86
4220 34 30 30 3b 00 00 00 28 20 20 20 20 20 20 20 20 69 66 20 28 72 65 6d 61 69 6e 69 6e 67 20 3c 20 400;...(........if.(remaining.<.
4240 6d 6f 6e 74 68 5f 73 65 63 6f 6e 64 73 29 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 month_seconds).{................
4260 64 74 2e 6d 6f 6e 74 68 20 3d 20 6d 20 2b 20 31 3b 00 00 00 2b 20 20 20 20 20 20 20 20 20 20 20 dt.month.=.m.+.1;...+...........
4280 20 64 74 2e 64 61 79 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 38 36 34 30 30 20 2b 20 31 3b .dt.day.=.remaining./.86400.+.1;
42a0 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 25 3d 20 38 36 34 ................remaining.%=.864
42c0 30 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 68 6f 75 72 20 3d 20 72 65 6d 00;...'............dt.hour.=.rem
42e0 61 69 6e 69 6e 67 20 2f 20 33 36 30 30 3b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 72 65 aining./.3600;................re
4300 6d 61 69 6e 69 6e 67 20 25 3d 20 33 36 30 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 maining.%=.3600;...'............
4320 64 74 2e 6d 69 6e 75 74 65 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 36 30 3b 00 00 00 27 20 dt.minute.=.remaining./.60;...'.
4340 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 73 65 63 6f 6e 64 20 3d 20 72 65 6d 61 69 6e 69 6e 67 ...........dt.second.=.remaining
4360 20 25 20 36 30 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 09 .%.60;................break;....
4380 20 20 20 20 20 20 20 20 7d 00 00 00 23 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 2d ........}...#........remaining.-
43a0 3d 20 6d 6f 6e 74 68 5f 73 65 63 6f 6e 64 73 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 =.month_seconds;........}.......
43c0 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 73 74 6f .return.dt;....}........void.sto
43e0 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 2f 20 20 20 20 70 72 pwatch(calendar.cal).{.../....pr
4400 69 6e 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 61 72 74 20 73 74 6f 70 77 intf("press.enter.to.start.stopw
4420 61 74 63 68 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b 20 atch\n");........getchar();.....
4440 20 20 20 64 61 74 65 74 69 6d 65 20 73 74 61 72 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 36 20 20 ...datetime.start.=.now();...6..
4460 20 20 70 72 69 6e 74 66 28 22 73 74 6f 70 77 61 74 63 68 20 72 75 6e 6e 69 6e 67 20 70 72 65 73 ..printf("stopwatch.running.pres
4480 73 20 65 6e 74 65 72 20 74 6f 20 73 74 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 s.enter.to.stop\n");........getc
44a0 68 61 72 28 29 3b 00 00 00 19 20 20 20 20 64 61 74 65 74 69 6d 65 20 65 6e 64 20 3d 20 6e 6f 77 har();........datetime.end.=.now
44c0 28 29 3b 00 00 00 31 20 20 20 20 6c 6f 6e 67 20 73 74 61 72 74 5f 73 65 63 20 3d 20 64 61 74 65 ();...1....long.start_sec.=.date
44e0 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 73 74 61 72 74 29 3b 00 00 00 2d 20 20 20 20 _to_seconds(cal,.start);...-....
4500 6c 6f 6e 67 20 65 6e 64 5f 73 65 63 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 long.end_sec.=.date_to_seconds(c
4520 61 6c 2c 20 65 6e 64 29 3b 00 00 00 24 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 al,.end);...$....long.diff.=.end
4540 5f 73 65 63 20 2d 20 73 74 61 72 74 5f 73 65 63 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 68 6f 75 _sec.-.start_sec;........int.hou
4560 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 20 69 6e 74 20 6d 69 6e rs.=.diff./.3600;...%....int.min
4580 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 30 3b 00 00 00 1c 20 20 utes.=.(diff.%.3600)./.60;......
45a0 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 30 3b 00 00 00 1d 20 20 ..int.seconds.=.diff.%.60;......
45c0 20 20 69 6e 74 20 74 6f 74 61 6c 5f 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 3b 00 00 00 45 20 ..int.total_seconds.=.diff;...E.
45e0 20 20 20 70 72 69 6e 74 66 28 22 65 6c 61 70 73 65 64 20 74 69 6d 65 20 25 30 32 64 3a 25 30 32 ...printf("elapsed.time.%02d:%02
4600 64 3a 25 30 32 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e d:%02d\n",.hours,.minutes,.secon
4620 64 73 29 3b 00 00 00 28 20 20 20 20 70 72 69 6e 74 66 28 22 74 6f 74 61 6c 20 73 65 63 6f 6e 64 ds);...(....printf("total.second
4640 73 20 25 6c 64 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 20 76 6f 69 s.%ld\n",.diff);....}........voi
4660 64 20 6d 65 61 73 75 72 65 5f 64 61 79 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 d.measure_day(calendar.cal).{...
4680 19 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 69 6e 70 75 74 5b 32 30 5d 3b 00 00 00 0c 20 20 .....char.month_input[20];......
46a0 20 20 69 6e 74 20 64 61 79 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 ..int.day;...*....printf("enter.
46c0 6d 6f 6e 74 68 20 6e 61 6d 65 20 6f 72 20 6e 75 6d 62 65 72 20 22 29 3b 00 00 00 1d 20 20 20 20 month.name.or.number.");........
46e0 73 63 61 6e 66 28 22 25 73 22 2c 20 6d 6f 6e 74 68 5f 69 6e 70 75 74 29 3b 00 00 00 19 20 20 20 scanf("%s",.month_input);.......
4700 20 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 64 61 79 20 22 29 3b 00 00 00 16 20 20 20 20 73 63 .printf("enter.day.");........sc
4720 61 6e 66 28 22 25 64 22 2c 20 26 64 61 79 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 anf("%d",.&day);........getchar(
4740 29 3b 00 00 00 16 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 30 3b 00 00 00 22 );........int.month_num.=.0;..."
4760 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 ....for.(int.i.=.0;.i.<.12;.i++)
4780 20 7b 00 00 00 3b 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d 70 28 6d 6f 6e 74 68 5f 69 .{...;........if.(strcmp(month_i
47a0 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 nput,.cal.month_names[i]).==.0).
47c0 7b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 69 20 2b {................month_num.=.i.+
47e0 20 31 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 .1;................break;.......
4800 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 19 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 .....}........}........if.(month
4820 5f 6e 75 6d 20 3d 3d 20 30 29 20 7b 00 00 00 26 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 _num.==.0).{...&........month_nu
4840 6d 20 3d 20 61 74 6f 69 28 6d 6f 6e 74 68 5f 69 6e 70 75 74 29 3b 00 00 00 05 20 20 20 20 7d 00 m.=.atoi(month_input);........}.
4860 00 00 5e 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e 75 6d 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 ..^....if.(month_num.<.1.||.mont
4880 68 5f 6e 75 6d 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 20 7c 7c 20 64 61 79 20 3e 20 63 h_num.>.12.||.day.<.1.||.day.>.c
48a0 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 29 20 al.days_per_month[month_num-1]).
48c0 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 64 61 74 {...!........printf("invalid.dat
48e0 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 e\n");............return;.......
4900 20 7d 00 00 00 15 20 20 20 20 64 61 74 65 74 69 6d 65 20 73 75 6e 72 69 73 65 3b 00 00 00 1c 20 .}........datetime.sunrise;.....
4920 20 20 20 73 75 6e 72 69 73 65 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 1e 20 ...sunrise.year.=.cal.year;.....
4940 20 20 20 73 75 6e 72 69 73 65 2e 6d 6f 6e 74 68 20 3d 20 6d 6f 6e 74 68 5f 6e 75 6d 3b 00 00 00 ...sunrise.month.=.month_num;...
4960 16 20 20 20 20 73 75 6e 72 69 73 65 2e 64 61 79 20 3d 20 64 61 79 3b 00 00 00 15 20 20 20 20 73 .....sunrise.day.=.day;........s
4980 75 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 36 3b 00 00 00 18 20 20 20 20 73 75 6e 72 69 73 65 2e unrise.hour.=.6;........sunrise.
49a0 6d 69 6e 75 74 65 20 3d 20 33 30 3b 00 00 00 17 20 20 20 20 73 75 6e 72 69 73 65 2e 73 65 63 6f minute.=.30;........sunrise.seco
49c0 6e 64 20 3d 20 30 3b 00 00 00 14 20 20 20 20 64 61 74 65 74 69 6d 65 20 73 75 6e 73 65 74 3b 00 nd.=.0;........datetime.sunset;.
49e0 00 00 1b 20 20 20 20 73 75 6e 73 65 74 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 .......sunset.year.=.cal.year;..
4a00 00 1d 20 20 20 20 73 75 6e 73 65 74 2e 6d 6f 6e 74 68 20 3d 20 6d 6f 6e 74 68 5f 6e 75 6d 3b 00 ......sunset.month.=.month_num;.
4a20 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 64 61 79 20 3d 20 64 61 79 3b 00 00 00 15 20 20 20 20 .......sunset.day.=.day;........
4a40 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 38 3b 00 00 00 17 20 20 20 20 73 75 6e 73 65 74 2e sunset.hour.=.18;........sunset.
4a60 6d 69 6e 75 74 65 20 3d 20 33 30 3b 00 00 00 16 20 20 20 20 73 75 6e 73 65 74 2e 73 65 63 6f 6e minute.=.30;........sunset.secon
4a80 64 20 3d 20 30 3b 00 00 00 3d 20 20 20 20 69 66 20 28 63 61 6c 2e 6d 6f 6e 74 68 20 3d 3d 20 35 d.=.0;...=....if.(cal.month.==.5
4aa0 20 7c 7c 20 63 61 6c 2e 6d 6f 6e 74 68 20 3d 3d 20 36 20 7c 7c 20 63 61 6c 2e 6d 6f 6e 74 68 20 .||.cal.month.==.6.||.cal.month.
4ac0 3d 3d 20 37 29 20 7b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 20 ==.7).{............sunrise.hour.
4ae0 3d 20 35 3b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 39 =.5;............sunset.hour.=.19
4b00 3b 00 00 00 05 20 20 20 20 7d 00 00 00 3f 20 20 20 20 69 66 20 28 63 61 6c 2e 6d 6f 6e 74 68 20 ;........}...?....if.(cal.month.
4b20 3d 3d 20 31 31 20 7c 7c 20 63 61 6c 2e 6d 6f 6e 74 68 20 3d 3d 20 31 32 20 7c 7c 20 63 61 6c 2e ==.11.||.cal.month.==.12.||.cal.
4b40 6d 6f 6e 74 68 20 3d 3d 20 31 29 20 7b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 month.==.1).{............sunrise
4b60 2e 68 6f 75 72 20 3d 20 37 3b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 73 65 74 2e 68 6f 75 .hour.=.7;............sunset.hou
4b80 72 20 3d 20 31 37 3b 00 00 00 05 20 20 20 20 7d 00 00 00 33 20 20 20 20 6c 6f 6e 67 20 73 74 61 r.=.17;........}...3....long.sta
4ba0 72 74 5f 73 65 63 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 73 75 rt_sec.=.date_to_seconds(cal,.su
4bc0 6e 72 69 73 65 29 3b 00 00 00 30 20 20 20 20 6c 6f 6e 67 20 65 6e 64 5f 73 65 63 20 3d 20 64 61 nrise);...0....long.end_sec.=.da
4be0 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 73 75 6e 73 65 74 29 3b 00 00 00 32 20 te_to_seconds(cal,.sunset);...2.
4c00 20 20 20 64 6f 75 62 6c 65 20 68 6f 75 72 73 20 3d 20 28 65 6e 64 5f 73 65 63 20 2d 20 73 74 61 ...double.hours.=.(end_sec.-.sta
4c20 72 74 5f 73 65 63 29 20 2f 20 33 36 30 30 2e 30 3b 00 00 00 56 20 20 20 20 70 72 69 6e 74 66 28 rt_sec)./.3600.0;...V....printf(
4c40 22 25 73 20 25 64 20 64 61 79 20 6c 65 6e 67 74 68 20 25 2e 32 66 20 68 6f 75 72 73 5c 6e 22 2c "%s.%d.day.length.%.2f.hours\n",
4c60 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 2c 20 64 .cal.month_names[month_num-1],.d
4c80 61 79 2c 20 68 6f 75 72 73 29 3b 00 00 00 6d 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 6e 72 69 ay,.hours);...m....printf("sunri
4ca0 73 65 20 25 30 32 64 3a 25 30 32 64 20 73 75 6e 73 65 74 20 25 30 32 64 3a 25 30 32 64 5c 6e 22 se.%02d:%02d.sunset.%02d:%02d\n"
4cc0 2c 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 2c 20 73 75 6e 72 69 73 65 2e 6d 69 6e 75 74 65 2c 20 ,.sunrise.hour,.sunrise.minute,.
4ce0 73 75 6e 73 65 74 2e 68 6f 75 72 2c 20 73 75 6e 73 65 74 2e 6d 69 6e 75 74 65 29 3b 00 00 00 01 sunset.hour,.sunset.minute);....
4d00 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 73 68 6f 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 }......."void.show_calendar(cale
4d20 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 2b 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 3d 3d 3d ndar.cal).{...+....printf("\n===
4d40 3d 3d 20 25 64 20 3d 3d 3d 3d 3d 5c 6e 22 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 ==.%d.=====\n",.cal.year);...+..
4d60 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 29 20 70 72 69 6e 74 66 28 22 6c 65 61 70 20 ..if.(cal.is_leap).printf("leap.
4d80 79 65 61 72 5c 6e 22 29 3b 00 00 00 21 20 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 22 63 6f year\n");...!....else.printf("co
4da0 6d 6d 6f 6e 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 11 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e mmon.year\n");........printf("\n
4dc0 22 29 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 ");..."....for.(int.i.=.0;.i.<.1
4de0 32 3b 20 69 2b 2b 29 20 7b 00 00 00 4d 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 31 32 2;.i++).{...M........printf("%12
4e00 73 20 25 33 64 20 64 61 79 73 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 s.%3d.days\n",.cal.month_names[i
4e20 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 ],.cal.days_per_month[i]);......
4e40 20 20 7d 00 00 00 11 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 ..}........printf("\n");....}...
4e60 00 00 00 00 1f 76 6f 69 64 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 .....void.show_month(calendar.ca
4e80 6c 29 20 7b 00 00 00 19 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 69 6e 70 75 74 5b 32 30 5d l).{........char.month_input[20]
4ea0 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 6d 6f 6e 74 68 20 6e 61 6d ;...*....printf("enter.month.nam
4ec0 65 20 6f 72 20 6e 75 6d 62 65 72 20 22 29 3b 00 00 00 1d 20 20 20 20 73 63 61 6e 66 28 22 25 73 e.or.number.");........scanf("%s
4ee0 22 2c 20 6d 6f 6e 74 68 5f 69 6e 70 75 74 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 ",.month_input);........getchar(
4f00 29 3b 00 00 00 16 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 30 3b 00 00 00 22 );........int.month_num.=.0;..."
4f20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 ....for.(int.i.=.0;.i.<.12;.i++)
4f40 20 7b 00 00 00 3b 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d 70 28 6d 6f 6e 74 68 5f 69 .{...;........if.(strcmp(month_i
4f60 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 nput,.cal.month_names[i]).==.0).
4f80 7b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 69 20 2b {................month_num.=.i.+
4fa0 20 31 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 .1;................break;.......
4fc0 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 19 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 .....}........}........if.(month
4fe0 5f 6e 75 6d 20 3d 3d 20 30 29 20 7b 00 00 00 26 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 _num.==.0).{...&........month_nu
5000 6d 20 3d 20 61 74 6f 69 28 6d 6f 6e 74 68 5f 69 6e 70 75 74 29 3b 00 00 00 05 20 20 20 20 7d 00 m.=.atoi(month_input);........}.
5020 00 00 2a 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e 75 6d 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 ..*....if.(month_num.<.1.||.mont
5040 68 5f 6e 75 6d 20 3e 20 31 32 29 20 7b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 h_num.>.12).{..."........printf(
5060 22 69 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 "invalid.month\n");............r
5080 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 40 20 20 20 20 70 72 69 6e 74 66 28 22 5c eturn;........}...@....printf("\
50a0 6e 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 n%s.%d\n",.cal.month_names[month
50c0 5f 6e 75 6d 2d 31 5d 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 _num-1],.cal.year);...%....print
50e0 66 28 22 73 75 20 6d 6f 20 74 75 20 77 65 20 74 68 20 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 16 f("su.mo.tu.we.th.fr.sa\n");....
5100 20 20 20 20 69 6e 74 20 66 69 72 73 74 5f 64 61 79 20 3d 20 31 3b 00 00 00 17 20 20 20 20 73 74 ....int.first_day.=.1;........st
5120 72 75 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 ruct.tm.tm.=.{0};...!....tm.tm_y
5140 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 2d 20 31 39 30 30 3b 00 00 00 1e 20 20 20 20 74 6d ear.=.cal.year.-.1900;........tm
5160 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 5f 6e 75 6d 20 2d 20 31 3b 00 00 00 13 20 20 20 20 .tm_mon.=.month_num.-.1;........
5180 74 6d 2e 74 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 00 00 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 tm.tm_mday.=.1;........mktime(&t
51a0 6d 29 3b 00 00 00 1b 20 20 20 20 66 69 72 73 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 m);........first_day.=.tm.tm_wda
51c0 79 3b 00 00 00 36 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 y;...6....for.(int.i.=.0;.i.<.fi
51e0 72 73 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 40 rst_day;.i++).printf("...");...@
5200 20 20 20 20 66 6f 72 20 28 69 6e 74 20 64 20 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 ....for.(int.d.=.1;.d.<=.cal.day
5220 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 3b 20 64 2b 2b 29 20 7b s_per_month[month_num-1];.d++).{
5240 00 00 00 1a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 ............printf("%2d.",.d);..
5260 00 33 20 20 20 20 20 20 20 20 69 66 20 28 28 66 69 72 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 .3........if.((first_day.+.d).%.
5280 37 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 7.==.0).printf("\n");........}..
52a0 00 13 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 ......printf("\n\n");....}......
52c0 00 1d 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 ..void.add_days(calendar.cal).{.
52e0 00 00 0d 20 20 20 20 69 6e 74 20 64 61 79 73 3b 00 00 00 1b 20 20 20 20 70 72 69 6e 74 66 28 22 .......int.days;........printf("
5300 64 61 79 73 20 74 6f 20 61 64 64 20 22 29 3b 00 00 00 17 20 20 20 20 73 63 61 6e 66 28 22 25 64 days.to.add.");........scanf("%d
5320 22 2c 20 26 64 61 79 73 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b ",.&days);........getchar();....
5340 20 20 20 20 64 61 74 65 74 69 6d 65 20 74 6f 64 61 79 20 3d 20 6e 6f 77 28 29 3b 00 00 00 2f 20 ....datetime.today.=.now();.../.
5360 20 20 20 6c 6f 6e 67 20 73 65 63 6f 6e 64 73 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 ...long.seconds.=.date_to_second
5380 73 28 63 61 6c 2c 20 74 6f 64 61 79 29 3b 00 00 00 16 20 20 20 20 69 66 20 28 73 65 63 6f 6e 64 s(cal,.today);........if.(second
53a0 73 20 3c 20 30 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 64 61 74 65 s.<.0).{............printf("date
53c0 20 65 72 72 6f 72 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 .error\n");............return;..
53e0 00 05 20 20 20 20 7d 00 00 00 1c 20 20 20 20 73 65 63 6f 6e 64 73 20 2b 3d 20 64 61 79 73 20 2a ......}........seconds.+=.days.*
5400 20 38 36 34 30 30 3b 00 00 00 34 20 20 20 20 64 61 74 65 74 69 6d 65 20 66 75 74 75 72 65 20 3d .86400;...4....datetime.future.=
5420 20 73 65 63 6f 6e 64 73 5f 74 6f 5f 64 61 74 65 28 63 61 6c 2c 20 73 65 63 6f 6e 64 73 29 3b 00 .seconds_to_date(cal,.seconds);.
5440 00 00 3d 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 34 64 2d 25 30 32 64 2d 25 30 32 64 20 70 6c ..=....printf("%04d-%02d-%02d.pl
5460 75 73 20 25 64 20 64 61 79 73 20 3d 20 25 30 34 64 2d 25 30 32 64 2d 25 30 32 64 5c 6e 22 2c 20 us.%d.days.=.%04d-%02d-%02d\n",.
5480 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 74 6f 64 61 79 2e 79 65 61 72 2c 20 74 6f 64 61 79 ...4...........today.year,.today
54a0 2e 6d 6f 6e 74 68 2c 20 74 6f 64 61 79 2e 64 61 79 2c 20 64 61 79 73 2c 00 00 00 32 20 20 20 20 .month,.today.day,.days,...2....
54c0 20 20 20 20 20 20 20 66 75 74 75 72 65 2e 79 65 61 72 2c 20 66 75 74 75 72 65 2e 6d 6f 6e 74 68 .......future.year,.future.month
54e0 2c 20 66 75 74 75 72 65 2e 64 61 79 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 21 76 6f 69 64 20 ,.future.day);....}.......!void.
5500 64 61 79 73 5f 62 65 74 77 65 65 6e 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 1a days_between(calendar.cal).{....
5520 20 20 20 20 69 6e 74 20 79 31 2c 6d 31 2c 64 31 2c 79 32 2c 6d 32 2c 64 32 3b 00 00 00 29 20 20 ....int.y1,m1,d1,y2,m2,d2;...)..
5540 20 20 70 72 69 6e 74 66 28 22 66 69 72 73 74 20 64 61 74 65 20 79 65 61 72 20 6d 6f 6e 74 68 20 ..printf("first.date.year.month.
5560 64 61 79 20 22 29 3b 00 00 00 25 20 20 20 20 73 63 61 6e 66 28 22 25 64 20 25 64 20 25 64 22 2c day.");...%....scanf("%d.%d.%d",
5580 20 26 79 31 2c 20 26 6d 31 2c 20 26 64 31 29 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 .&y1,.&m1,.&d1);...*....printf("
55a0 73 65 63 6f 6e 64 20 64 61 74 65 20 79 65 61 72 20 6d 6f 6e 74 68 20 64 61 79 20 22 29 3b 00 00 second.date.year.month.day.");..
55c0 00 25 20 20 20 20 73 63 61 6e 66 28 22 25 64 20 25 64 20 25 64 22 2c 20 26 79 32 2c 20 26 6d 32 .%....scanf("%d.%d.%d",.&y2,.&m2
55e0 2c 20 26 64 32 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 24 20 20 20 ,.&d2);........getchar();...$...
5600 20 64 61 74 65 74 69 6d 65 20 64 74 31 20 3d 20 7b 79 31 2c 6d 31 2c 64 31 2c 30 2c 30 2c 30 7d .datetime.dt1.=.{y1,m1,d1,0,0,0}
5620 3b 00 00 00 24 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 32 20 3d 20 7b 79 32 2c 6d 32 2c 64 ;...$....datetime.dt2.=.{y2,m2,d
5640 32 2c 30 2c 30 2c 30 7d 3b 00 00 00 36 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 31 20 3d 2,0,0,0};...6....calendar.cal1.=
5660 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 .load_calendar("calendar.txt",.y
5680 31 29 3b 00 00 00 36 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 32 20 3d 20 6c 6f 61 64 5f 1);...6....calendar.cal2.=.load_
56a0 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 32 29 3b 00 00 00 calendar("calendar.txt",.y2);...
56c0 2b 20 20 20 20 6c 6f 6e 67 20 73 65 63 31 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 +....long.sec1.=.date_to_seconds
56e0 28 63 61 6c 31 2c 20 64 74 31 29 3b 00 00 00 2b 20 20 20 20 6c 6f 6e 67 20 73 65 63 32 20 3d 20 (cal1,.dt1);...+....long.sec2.=.
5700 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 32 2c 20 64 74 32 29 3b 00 00 00 1f 20 date_to_seconds(cal2,.dt2);.....
5720 20 20 20 69 66 20 28 73 65 63 31 20 3c 20 30 20 7c 7c 20 73 65 63 32 20 3c 20 30 29 20 7b 00 00 ...if.(sec1.<.0.||.sec2.<.0).{..
5740 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 64 61 74 65 5c 6e .!........printf("invalid.date\n
5760 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 ");............return;........}.
5780 00 00 1c 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 73 65 63 32 20 2d 20 73 65 63 31 3b 00 .......long.diff.=.sec2.-.sec1;.
57a0 00 00 1f 20 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 .......if.(diff.<.0).diff.=.-dif
57c0 66 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 64 61 79 73 20 3d 20 64 69 66 66 20 2f 20 38 36 34 30 f;........int.days.=.diff./.8640
57e0 30 3b 00 00 00 29 20 20 20 20 70 72 69 6e 74 66 28 22 64 69 66 66 65 72 65 6e 63 65 20 25 64 20 0;...)....printf("difference.%d.
5800 64 61 79 73 5c 6e 22 2c 20 64 61 79 73 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 0c 69 6e 74 20 days\n",.days);....}........int.
5820 6d 61 69 6e 28 29 20 7b 00 00 00 37 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c main().{...7....calendar.cal.=.l
5840 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 32 30 32 oad_calendar("calendar.txt",.202
5860 36 29 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 63 68 6f 69 63 65 3b 00 00 00 0f 20 20 20 20 77 68 6);........int.choice;........wh
5880 69 6c 65 20 28 31 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 63 ile.(1).{...,........printf("\nc
58a0 6f 6d 70 74 65 75 72 20 74 69 6d 65 20 63 6f 75 6e 74 65 72 5c 6e 22 29 3b 00 00 00 20 20 20 20 ompteur.time.counter\n");.......
58c0 20 20 20 20 20 70 72 69 6e 74 66 28 22 31 20 73 74 6f 70 77 61 74 63 68 5c 6e 22 29 3b 00 00 00 .....printf("1.stopwatch\n");...
58e0 29 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 32 20 6d 65 61 73 75 72 65 20 64 61 79 20 6c )........printf("2.measure.day.l
5900 65 6e 67 74 68 5c 6e 22 29 3b 00 00 00 29 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 33 20 ength\n");...)........printf("3.
5920 73 68 6f 77 20 66 75 6c 6c 20 63 61 6c 65 6e 64 61 72 5c 6e 22 29 3b 00 00 00 21 20 20 20 20 20 show.full.calendar\n");...!.....
5940 20 20 20 70 72 69 6e 74 66 28 22 34 20 73 68 6f 77 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 23 ...printf("4.show.month\n");...#
5960 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 35 20 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e ........printf("5.current.time\n
5980 22 29 3b 00 00 00 28 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 36 20 61 64 64 20 64 61 79 ");...(........printf("6.add.day
59a0 73 20 74 6f 20 74 6f 64 61 79 5c 6e 22 29 3b 00 00 00 2d 20 20 20 20 20 20 20 20 70 72 69 6e 74 s.to.today\n");...-........print
59c0 66 28 22 37 20 64 61 79 73 20 62 65 74 77 65 65 6e 20 74 77 6f 20 64 61 74 65 73 5c 6e 22 29 3b f("7.days.between.two.dates\n");
59e0 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 38 20 63 68 61 6e 67 65 20 79 65 61 ..."........printf("8.change.yea
5a00 72 5c 6e 22 29 3b 00 00 00 1b 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 39 20 65 78 69 74 r\n");............printf("9.exit
5a20 5c 6e 22 29 3b 00 00 00 1a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 63 68 6f 69 63 65 20 \n");............printf("choice.
5a40 22 29 3b 00 00 00 1d 20 20 20 20 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 63 68 6f 69 ");............scanf("%d",.&choi
5a60 63 65 29 3b 00 00 00 12 20 20 20 20 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 28 20 20 ce);............getchar();...(..
5a80 20 20 20 20 20 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 31 29 20 73 74 6f 70 77 61 74 63 68 ......if.(choice.==.1).stopwatch
5aa0 28 63 61 6c 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 (cal);.../........else.if.(choic
5ac0 65 20 3d 3d 20 32 29 20 6d 65 61 73 75 72 65 5f 64 61 79 28 63 61 6c 29 3b 00 00 00 31 20 20 20 e.==.2).measure_day(cal);...1...
5ae0 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 33 29 20 73 68 6f 77 5f .....else.if.(choice.==.3).show_
5b00 63 61 6c 65 6e 64 61 72 28 63 61 6c 29 3b 00 00 00 2e 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 calendar(cal);............else.i
5b20 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 34 29 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 29 3b f.(choice.==.4).show_month(cal);
5b40 00 00 00 1f 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 35 ............else.if.(choice.==.5
5b60 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 64 61 74 65 74 69 6d 65 20 74 20 3d 20 ).{................datetime.t.=.
5b80 6e 6f 77 28 29 3b 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 now();...4............printf("%0
5ba0 34 64 20 25 73 20 25 30 32 64 20 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 00 00 4d.%s.%02d.%02d:%02d:%02d\n",...
5bc0 00 3d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 2e 79 65 61 72 2c 20 63 61 6c .=...................t.year,.cal
5be0 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 74 2e 6d 6f 6e 74 68 2d 31 5d 2c 20 74 2e 64 61 79 2c 00 .month_names[t.month-1],.t.day,.
5c00 00 00 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 2e 68 6f 75 72 2c 20 74 2e ../...................t.hour,.t.
5c20 6d 69 6e 75 74 65 2c 20 74 2e 73 65 63 6f 6e 64 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 minute,.t.second);............}.
5c40 00 00 2c 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 36 29 ..,........else.if.(choice.==.6)
5c60 20 61 64 64 5f 64 61 79 73 28 63 61 6c 29 3b 00 00 00 30 20 20 20 20 20 20 20 20 65 6c 73 65 20 .add_days(cal);...0........else.
5c80 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 37 29 20 64 61 79 73 5f 62 65 74 77 65 65 6e 28 63 61 if.(choice.==.7).days_between(ca
5ca0 6c 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d l);............else.if.(choice.=
5cc0 3d 20 38 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 3b 00 00 00 22 =.8).{................int.y;..."
5ce0 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 79 65 61 72 20 22 ............printf("enter.year."
5d00 29 3b 00 00 00 1c 20 20 20 20 20 20 20 20 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 79 );................scanf("%d",.&y
5d20 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 33 );................getchar();...3
5d40 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 ............cal.=.load_calendar(
5d60 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 2e 20 20 20 20 20 20 20 20 20 "calendar.txt",.y);.............
5d80 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 63 68 61 6e 67 65 64 20 74 6f 20 25 64 5c 6e 22 ...printf("year.changed.to.%d\n"
5da0 2c 20 79 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 24 20 20 20 20 20 20 20 20 65 6c ,.y);............}...$........el
5dc0 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 39 29 20 62 72 65 61 6b 3b 00 00 00 28 20 20 se.if.(choice.==.9).break;...(..
5de0 20 20 20 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 63 68 6f 69 63 ......else.printf("invalid.choic
5e00 65 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b e\n");........}........return.0;
5e20 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 3f 01 00 00 00 00 00 00 01 00 00 ....}5...............?..........
5e40 00 00 00 00 00 00 00 00 00 00 00 00 00 91 25 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f ..............%..............5._
5e60 d0 00 00 00 06 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 01 00 00 00 00 00 00 00 ................................
5e80 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5ea0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5ec0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5ee0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5f00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5f60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5f80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
5fe0 00 00 00 6a 00 3b a1 04 01 00 00 00 05 00 f5 18 00 00 01 15 00 00 00 00 00 00 00 00 00 00 00 01 ...j.;..........................
6000 00 00 00 07 20 20 20 20 63 61 6c f5 18 00 00 01 16 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 ........cal.....................
6020 00 00 8a 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 12 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 .......................char.mont
6040 68 5f 69 6e 70 f5 18 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 h_inp...........................
6060 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 ...............................5
6080 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8a 00 00 00 12 00 00 00 00 ................................
60a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 8a 00 00 ................................
60c0 00 12 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 07 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 ................................
60e0 00 00 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 15 01 00 00 07 00 00 00 00 00 00 00 00 ................................
6100 00 00 00 28 00 00 00 01 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7a 05 00 00 00 ...(.......................z....
6120 00 00 00 35 81 5f d0 00 00 00 07 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 01 00 ...5._..........................
6140 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
61a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
61c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
61e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
6280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
62a0 00 00 00 00 00 00 00 00 00 6a 00 3c 33 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 .........j.<3...................
62c0 00 00 00 00 01 3e 00 00 00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 .....>....#include.<stdio.h>....
62e0 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 #include.<stdlib.h>....#include.
6300 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 <string.h>....#include.<time.h>.
6320 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 .......typedef.struct.{........i
6340 6e 74 20 79 65 61 72 3b 00 00 00 0e 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 3b 00 00 00 0c 20 20 nt.year;........int.month;......
6360 20 20 69 6e 74 20 64 61 79 3b 00 00 00 0d 20 20 20 20 69 6e 74 20 68 6f 75 72 3b 00 00 00 0f 20 ..int.day;........int.hour;.....
6380 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 ...int.minute;........int.second
63a0 3b 00 00 00 0b 7d 20 64 61 74 65 74 69 6d 65 3b 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 ;....}.datetime;........typedef.
63c0 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 10 20 20 20 struct.{........int.year;.......
63e0 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 64 61 79 73 5f 70 65 .int.is_leap;........int.days_pe
6400 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 6e r_month[12];........char.month_n
6420 61 6d 65 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 61 72 3b 00 00 00 00 ames[12][10];....}.calendar;....
6440 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 6f 6e 73 74 ...8calendar.load_calendar(const
6460 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 29 20 7b 00 00 00 11 .char.*filename,.int.year).{....
6480 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 79 65 61 ....calendar.cal;........cal.yea
64a0 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 30 r.=.year;........cal.is_leap.=.0
64c0 3b 00 00 00 8e 20 20 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 31 32 5d ;........char.*default_names[12]
64e0 20 3d 20 7b 22 6a 61 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 2c 22 6d 61 72 63 68 22 .=.{"january","february","march"
6500 2c 22 61 70 72 69 6c 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a 75 6c 79 22 2c 22 61 75 ,"april","may","june","july","au
6520 67 75 73 74 22 2c 22 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 65 72 22 2c 22 6e 6f 76 gust","september","october","nov
6540 65 6d 62 65 72 22 2c 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 ember","december"};..."....for.(
6560 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 35 20 20 20 int.i.=.0;.i.<.12;.i++).{...5...
6580 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 .....strcpy(cal.month_names[i],.
65a0 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 69 66 default_names[i]);.../........if
65c0 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 .(i.==.1).cal.days_per_month[i].
65e0 3d 20 32 38 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 33 =.28;...S........else.if.(i.==.3
6600 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d 20 31 30 29 .||.i.==.5.||.i.==.8.||.i.==.10)
6620 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b 00 00 00 28 .cal.days_per_month[i].=.30;...(
6640 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b ........else.cal.days_per_month[
6660 69 5d 20 3d 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 i].=.31;........}...#....FILE.*f
6680 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 20 20 20 20 .=.fopen(filename,."r");........
66a0 69 66 20 28 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 20 63 68 61 72 20 if.(!f).return.cal;........char.
66c0 6c 69 6e 65 5b 35 31 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c line[512];...*....while.(fgets(l
66e0 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 00 2d 20 20 20 20 ine,.sizeof(line),.f)).{...-....
6700 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 22 2c 20 35 ....if.(strncmp(line,."year:",.5
6720 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 3b 00 ).==.0).{................int.y;.
6740 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 79 65 61 ..)............sscanf(line,."yea
6760 72 3a 20 25 64 22 2c 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 r:.%d",.&y);...$............if.(
6780 79 20 21 3d 20 79 65 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 20 20 20 20 20 20 20 20 y.!=.year).continue;............
67a0 7d 00 00 00 2e 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 }............if.(strncmp(line,."
67c0 6d 6f 6e 74 68 3a 22 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 month:",.6).==.0).{.............
67e0 20 20 20 69 6e 74 20 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 ...int.m,.d;................char
6800 20 6e 61 6d 65 5b 32 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 .name[20];...F............sscanf
6820 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 25 64 20 6e 61 6d 65 3a (line,."month:.%d.days:.%d.name:
6840 20 25 73 22 2c 20 26 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 .%s",.&m,.&d,.name);...$........
6860 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 7b 00 00 00 2c ....if.(m.>=.1.&&.m.<=.12).{...,
6880 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e ................cal.days_per_mon
68a0 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 th[m-1].=.d;...3................
68c0 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 2d 31 5d 2c 20 6e 61 6d strcpy(cal.month_names[m-1],.nam
68e0 65 29 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 20 20 20 20 20 20 20 20 e);................}............
6900 7d 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 }...-........if.(strncmp(line,."
6920 6c 65 61 70 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 leap:",.5).==.0).{..............
6940 20 20 69 6e 74 20 6c 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c ..int.l;...)............sscanf(l
6960 69 6e 65 2c 20 22 6c 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 32 20 20 20 20 20 20 20 ine,."leap:.%d",.&l);...2.......
6980 20 20 20 20 20 69 66 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 20 63 61 6c 2e 69 .....if.(year.==.cal.year).cal.i
69a0 73 5f 6c 65 61 70 20 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 s_leap.=.l;............}........
69c0 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 20 20 20 72 65 74 75 72 }........fclose(f);........retur
69e0 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2e 69 6e 74 20 69 73 5f 76 61 6c 69 64 5f n.cal;....}........int.is_valid_
6a00 64 61 74 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 64 61 74 65 74 69 6d 65 20 64 74 29 20 date(calendar.cal,.datetime.dt).
6a20 7b 00 00 00 26 20 20 20 20 69 66 20 28 64 74 2e 79 65 61 72 20 21 3d 20 63 61 6c 2e 79 65 61 72 {...&....if.(dt.year.!=.cal.year
6a40 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 30 20 20 20 20 69 66 20 28 64 74 2e 6d 6f 6e 74 68 20 ).return.0;...0....if.(dt.month.
6a60 3c 20 31 20 7c 7c 20 64 74 2e 6d 6f 6e 74 68 20 3e 20 31 32 29 20 72 65 74 75 72 6e 20 30 3b 00 <.1.||.dt.month.>.12).return.0;.
6a80 00 00 48 20 20 20 20 69 66 20 28 64 74 2e 64 61 79 20 3c 20 31 20 7c 7c 20 64 74 2e 64 61 79 20 ..H....if.(dt.day.<.1.||.dt.day.
6aa0 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 64 74 2e 6d 6f 6e 74 68 2d 31 5d >.cal.days_per_month[dt.month-1]
6ac0 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 2e 20 20 20 20 69 66 20 28 64 74 2e 68 6f 75 72 20 3c ).return.0;........if.(dt.hour.<
6ae0 20 30 20 7c 7c 20 64 74 2e 68 6f 75 72 20 3e 20 32 33 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 .0.||.dt.hour.>.23).return.0;...
6b00 32 20 20 20 20 69 66 20 28 64 74 2e 6d 69 6e 75 74 65 20 3c 20 30 20 7c 7c 20 64 74 2e 6d 69 6e 2....if.(dt.minute.<.0.||.dt.min
6b20 75 74 65 20 3e 20 35 39 29 20 72 65 74 75 72 6e 20 30 3b 00 00 00 32 20 20 20 20 69 66 20 28 64 ute.>.59).return.0;...2....if.(d
6b40 74 2e 73 65 63 6f 6e 64 20 3c 20 30 20 7c 7c 20 64 74 2e 73 65 63 6f 6e 64 20 3e 20 35 39 29 20 t.second.<.0.||.dt.second.>.59).
6b60 72 65 74 75 72 6e 20 30 3b 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 31 3b 00 00 00 01 7d 00 return.0;........return.1;....}.
6b80 00 00 00 00 00 00 10 64 61 74 65 74 69 6d 65 20 6e 6f 77 28 29 20 7b 00 00 00 10 20 20 20 20 64 .......datetime.now().{........d
6ba0 61 74 65 74 69 6d 65 20 64 74 3b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 atetime.dt;........time_t.t.=.ti
6bc0 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 me(NULL);...%....struct.tm.*loca
6be0 6c 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 24 20 20 20 20 64 74 2e 79 65 61 l.=.localtime(&t);...$....dt.yea
6c00 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 21 20 20 r.=.local->tm_year.+.1900;...!..
6c20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 ..dt.month.=.local->tm_mon.+.1;.
6c40 00 00 1c 20 20 20 20 64 74 2e 64 61 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 .......dt.day.=.local->tm_mday;.
6c60 00 00 1d 20 20 20 20 64 74 2e 68 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b .......dt.hour.=.local->tm_hour;
6c80 00 00 00 1e 20 20 20 20 64 74 2e 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 ........dt.minute.=.local->tm_mi
6ca0 6e 3b 00 00 00 1e 20 20 20 20 64 74 2e 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f n;........dt.second.=.local->tm_
6cc0 73 65 63 3b 00 00 00 0e 20 20 20 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 00 00 00 00 sec;........return.dt;....}.....
6ce0 00 00 31 6c 6f 6e 67 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 65 6e 64 61 72 ..1long.date_to_seconds(calendar
6d00 20 63 61 6c 2c 20 64 61 74 65 74 69 6d 65 20 64 74 29 20 7b 00 00 00 2b 20 20 20 20 69 66 20 28 .cal,.datetime.dt).{...+....if.(
6d20 21 69 73 5f 76 61 6c 69 64 5f 64 61 74 65 28 63 61 6c 2c 20 64 74 29 29 20 72 65 74 75 72 6e 20 !is_valid_date(cal,.dt)).return.
6d40 2d 31 3b 00 00 00 13 20 20 20 20 6c 6f 6e 67 20 74 6f 74 61 6c 20 3d 20 30 3b 00 00 00 2a 20 20 -1;........long.total.=.0;...*..
6d60 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d 20 31 39 37 30 3b 20 79 20 3c 20 64 74 2e 79 65 61 72 ..for.(int.y.=.1970;.y.<.dt.year
6d80 3b 20 79 2b 2b 29 20 7b 00 00 00 37 20 20 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 79 20 ;.y++).{...7........calendar.cy.
6da0 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 =.load_calendar("calendar.txt",.
6dc0 79 29 3b 00 00 00 4b 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d y);...K........for.(int.m.=.0;.m
6de0 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 74 6f 74 61 6c 20 2b 3d 20 63 79 2e 64 61 79 73 5f 70 65 72 .<.12;.m++).total.+=.cy.days_per
6e00 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 05 20 20 20 20 7d 00 00 00 52 20 _month[m].*.86400;........}...R.
6e20 20 20 20 66 6f 72 20 28 69 6e 74 20 6d 20 3d 20 30 3b 20 6d 20 3c 20 64 74 2e 6d 6f 6e 74 68 20 ...for.(int.m.=.0;.m.<.dt.month.
6e40 2d 20 31 3b 20 6d 2b 2b 29 20 74 6f 74 61 6c 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f -.1;.m++).total.+=.cal.days_per_
6e60 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 22 20 20 20 20 74 6f 74 61 6c 20 2b month[m].*.86400;..."....total.+
6e80 3d 20 28 64 74 2e 64 61 79 20 2d 20 31 29 20 2a 20 38 36 34 30 30 3b 00 00 00 1c 20 20 20 20 74 =.(dt.day.-.1).*.86400;........t
6ea0 6f 74 61 6c 20 2b 3d 20 64 74 2e 68 6f 75 72 20 2a 20 33 36 30 30 3b 00 00 00 1c 20 20 20 20 74 otal.+=.dt.hour.*.3600;........t
6ec0 6f 74 61 6c 20 2b 3d 20 64 74 2e 6d 69 6e 75 74 65 20 2a 20 36 30 3b 00 00 00 17 20 20 20 20 74 otal.+=.dt.minute.*.60;........t
6ee0 6f 74 61 6c 20 2b 3d 20 64 74 2e 73 65 63 6f 6e 64 3b 00 00 00 11 20 20 20 20 72 65 74 75 72 6e otal.+=.dt.second;........return
6f00 20 74 6f 74 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 36 64 61 74 65 74 69 6d 65 20 73 65 63 .total;....}.......6datetime.sec
6f20 6f 6e 64 73 5f 74 6f 5f 64 61 74 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 6c 6f 6e 67 20 onds_to_date(calendar.cal,.long.
6f40 73 65 63 6f 6e 64 73 29 20 7b 00 00 00 10 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 3b 00 00 seconds).{........datetime.dt;..
6f60 00 17 20 20 20 20 64 74 2e 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 11 20 20 20 ......dt.year.=.cal.year;.......
6f80 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 31 3b 00 00 00 1d 20 20 20 20 6c 6f 6e 67 20 72 65 6d 61 69 .dt.month.=.1;........long.remai
6fa0 6e 69 6e 67 20 3d 20 73 65 63 6f 6e 64 73 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 ning.=.seconds;..."....for.(int.
6fc0 6d 20 3d 20 30 3b 20 6d 20 3c 20 31 32 3b 20 6d 2b 2b 29 20 7b 00 00 00 3a 20 20 20 20 20 20 20 m.=.0;.m.<.12;.m++).{...:.......
6fe0 20 69 6e 74 20 6d 6f 6e 74 68 5f 73 65 63 6f 6e 64 73 20 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 .int.month_seconds.=.cal.days_pe
7000 72 5f 6d 6f 6e 74 68 5b 6d 5d 20 2a 20 38 36 34 30 30 3b 00 00 00 28 20 20 20 20 20 20 20 20 69 r_month[m].*.86400;...(........i
7020 66 20 28 72 65 6d 61 69 6e 69 6e 67 20 3c 20 6d 6f 6e 74 68 5f 73 65 63 6f 6e 64 73 29 20 7b 00 f.(remaining.<.month_seconds).{.
7040 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 6f 6e 74 68 20 3d 20 6d 20 2b 20 31 3b ...............dt.month.=.m.+.1;
7060 00 00 00 2b 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 64 61 79 20 3d 20 72 65 6d 61 69 6e 69 ...+............dt.day.=.remaini
7080 6e 67 20 2f 20 38 36 34 30 30 20 2b 20 31 3b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 72 ng./.86400.+.1;................r
70a0 65 6d 61 69 6e 69 6e 67 20 25 3d 20 38 36 34 30 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 emaining.%=.86400;...'..........
70c0 20 20 64 74 2e 68 6f 75 72 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 2f 20 33 36 30 30 3b 00 00 00 ..dt.hour.=.remaining./.3600;...
70e0 1e 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 25 3d 20 33 36 30 30 3b 00 .............remaining.%=.3600;.
7100 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 6d 69 6e 75 74 65 20 3d 20 72 65 6d 61 69 ..'............dt.minute.=.remai
7120 6e 69 6e 67 20 2f 20 36 30 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 74 2e 73 65 63 ning./.60;...'............dt.sec
7140 6f 6e 64 20 3d 20 72 65 6d 61 69 6e 69 6e 67 20 25 20 36 30 3b 00 00 00 12 20 20 20 20 20 20 20 ond.=.remaining.%.60;...........
7160 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 23 20 20 20 20 .....break;............}...#....
7180 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 2d 3d 20 6d 6f 6e 74 68 5f 73 65 63 6f 6e 64 73 3b 00 ....remaining.-=.month_seconds;.
71a0 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 72 65 74 75 72 6e 20 64 74 3b 00 00 00 01 7d 00 .......}........return.dt;....}.
71c0 00 00 00 00 00 00 1e 76 6f 69 64 20 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 .......void.stopwatch(calendar.c
71e0 61 6c 29 20 7b 00 00 00 2f 20 20 20 20 70 72 69 6e 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 al).{.../....printf("press.enter
7200 20 74 6f 20 73 74 61 72 74 20 73 74 6f 70 77 61 74 63 68 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 .to.start.stopwatch\n");........
7220 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b 20 20 20 20 64 61 74 65 74 69 6d 65 20 73 74 61 72 74 getchar();........datetime.start
7240 20 3d 20 6e 6f 77 28 29 3b 00 00 00 36 20 20 20 20 70 72 69 6e 74 66 28 22 73 74 6f 70 77 61 74 .=.now();...6....printf("stopwat
7260 63 68 20 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 6f 70 5c 6e ch.running.press.enter.to.stop\n
7280 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 19 20 20 20 20 64 61 74 ");........getchar();........dat
72a0 65 74 69 6d 65 20 65 6e 64 20 3d 20 6e 6f 77 28 29 3b 00 00 00 31 20 20 20 20 6c 6f 6e 67 20 73 etime.end.=.now();...1....long.s
72c0 74 61 72 74 5f 73 65 63 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 tart_sec.=.date_to_seconds(cal,.
72e0 73 74 61 72 74 29 3b 00 00 00 2d 20 20 20 20 6c 6f 6e 67 20 65 6e 64 5f 73 65 63 20 3d 20 64 61 start);...-....long.end_sec.=.da
7300 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 65 6e 64 29 3b 00 00 00 24 20 20 20 20 te_to_seconds(cal,.end);...$....
7320 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 5f 73 65 63 20 2d 20 73 74 61 72 74 5f 73 65 63 3b long.diff.=.end_sec.-.start_sec;
7340 00 00 00 1c 20 20 20 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b ........int.hours.=.diff./.3600;
7360 00 00 00 25 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 ...%....int.minutes.=.(diff.%.36
7380 30 30 29 20 2f 20 36 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 00)./.60;........int.seconds.=.d
73a0 69 66 66 20 25 20 36 30 3b 00 00 00 45 20 20 20 20 70 72 69 6e 74 66 28 22 65 6c 61 70 73 65 64 iff.%.60;...E....printf("elapsed
73c0 20 74 69 6d 65 20 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 .time.%02d:%02d:%02d\n",.hours,.
73e0 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 28 20 20 20 20 70 72 69 6e 74 66 minutes,.seconds);...(....printf
7400 28 22 74 6f 74 61 6c 20 73 65 63 6f 6e 64 73 20 25 6c 64 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 ("total.seconds.%ld\n",.diff);..
7420 00 01 7d 00 00 00 00 00 00 00 20 76 6f 69 64 20 6d 65 61 73 75 72 65 5f 64 61 79 28 63 61 6c 65 ..}........void.measure_day(cale
7440 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 19 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 69 6e ndar.cal).{........char.month_in
7460 70 75 74 5b 32 30 5d 3b 00 00 00 0c 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 2a 20 20 20 20 put[20];........int.day;...*....
7480 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 6d 6f 6e 74 68 20 6e 61 6d 65 20 6f 72 20 6e 75 6d 62 printf("enter.month.name.or.numb
74a0 65 72 20 22 29 3b 00 00 00 1d 20 20 20 20 73 63 61 6e 66 28 22 25 73 22 2c 20 6d 6f 6e 74 68 5f er.");........scanf("%s",.month_
74c0 69 6e 70 75 74 29 3b 00 00 00 19 20 20 20 20 70 72 69 6e 74 66 28 22 65 6e 74 65 72 20 64 61 79 input);........printf("enter.day
74e0 20 22 29 3b 00 00 00 16 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 64 61 79 29 3b 00 00 .");........scanf("%d",.&day);..
7500 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 16 20 20 20 20 69 6e 74 20 6d 6f 6e 74 ......getchar();........int.mont
7520 68 5f 6e 75 6d 20 3d 20 30 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 h_num.=.0;..."....for.(int.i.=.0
7540 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 3b 20 20 20 20 20 20 20 20 69 66 20 28 ;.i.<.12;.i++).{...;........if.(
7560 73 74 72 63 6d 70 28 6d 6f 6e 74 68 5f 69 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 strcmp(month_input,.cal.month_na
7580 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 7b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 6d mes[i]).==.0).{................m
75a0 6f 6e 74 68 5f 6e 75 6d 20 3d 20 69 20 2b 20 31 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 onth_num.=.i.+.1;...............
75c0 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 .break;............}........}...
75e0 19 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 30 29 20 7b 00 00 00 26 20 20 .....if.(month_num.==.0).{...&..
7600 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 61 74 6f 69 28 6d 6f 6e 74 68 5f 69 6e 70 ......month_num.=.atoi(month_inp
7620 75 74 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 5e 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e ut);........}...^....if.(month_n
7640 75 6d 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 um.<.1.||.month_num.>.12.||.day.
7660 3c 20 31 20 7c 7c 20 64 61 79 20 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b <.1.||.day.>.cal.days_per_month[
7680 6d 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 29 20 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 month_num-1]).{...!........print
76a0 66 28 22 69 6e 76 61 6c 69 64 20 64 61 74 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 f("invalid.date\n");............
76c0 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 15 20 20 20 20 64 61 74 65 74 69 6d 65 return;........}........datetime
76e0 20 73 75 6e 72 69 73 65 3b 00 00 00 1c 20 20 20 20 73 75 6e 72 69 73 65 2e 79 65 61 72 20 3d 20 .sunrise;........sunrise.year.=.
7700 63 61 6c 2e 79 65 61 72 3b 00 00 00 1e 20 20 20 20 73 75 6e 72 69 73 65 2e 6d 6f 6e 74 68 20 3d cal.year;........sunrise.month.=
7720 20 6d 6f 6e 74 68 5f 6e 75 6d 3b 00 00 00 16 20 20 20 20 73 75 6e 72 69 73 65 2e 64 61 79 20 3d .month_num;........sunrise.day.=
7740 20 64 61 79 3b 00 00 00 15 20 20 20 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 36 3b 00 00 .day;........sunrise.hour.=.6;..
7760 00 18 20 20 20 20 73 75 6e 72 69 73 65 2e 6d 69 6e 75 74 65 20 3d 20 33 30 3b 00 00 00 17 20 20 ......sunrise.minute.=.30;......
7780 20 20 73 75 6e 72 69 73 65 2e 73 65 63 6f 6e 64 20 3d 20 30 3b 00 00 00 14 20 20 20 20 64 61 74 ..sunrise.second.=.0;........dat
77a0 65 74 69 6d 65 20 73 75 6e 73 65 74 3b 00 00 00 1b 20 20 20 20 73 75 6e 73 65 74 2e 79 65 61 72 etime.sunset;........sunset.year
77c0 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 1d 20 20 20 20 73 75 6e 73 65 74 2e 6d 6f 6e 74 68 .=.cal.year;........sunset.month
77e0 20 3d 20 6d 6f 6e 74 68 5f 6e 75 6d 3b 00 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 64 61 79 20 .=.month_num;........sunset.day.
7800 3d 20 64 61 79 3b 00 00 00 15 20 20 20 20 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 38 3b 00 =.day;........sunset.hour.=.18;.
7820 00 00 17 20 20 20 20 73 75 6e 73 65 74 2e 6d 69 6e 75 74 65 20 3d 20 33 30 3b 00 00 00 16 20 20 .......sunset.minute.=.30;......
7840 20 20 73 75 6e 73 65 74 2e 73 65 63 6f 6e 64 20 3d 20 30 3b 00 00 00 3d 20 20 20 20 69 66 20 28 ..sunset.second.=.0;...=....if.(
7860 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 35 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 36 month_num.==.5.||.month_num.==.6
7880 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 37 29 20 7b 00 00 00 19 20 20 20 20 20 20 20 .||.month_num.==.7).{...........
78a0 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 35 3b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 .sunrise.hour.=.5;............su
78c0 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 39 3b 00 00 00 05 20 20 20 20 7d 00 00 00 3f 20 20 20 20 nset.hour.=.19;........}...?....
78e0 69 66 20 28 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 31 31 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d if.(month_num.==.11.||.month_num
7900 20 3d 3d 20 31 32 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 31 29 20 7b 00 00 00 19 20 .==.12.||.month_num.==.1).{.....
7920 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 20 3d 20 37 3b 00 00 00 19 20 20 20 20 .......sunrise.hour.=.7;........
7940 20 20 20 20 73 75 6e 73 65 74 2e 68 6f 75 72 20 3d 20 31 37 3b 00 00 00 05 20 20 20 20 7d 00 00 ....sunset.hour.=.17;........}..
7960 00 33 20 20 20 20 6c 6f 6e 67 20 73 74 61 72 74 5f 73 65 63 20 3d 20 64 61 74 65 5f 74 6f 5f 73 .3....long.start_sec.=.date_to_s
7980 65 63 6f 6e 64 73 28 63 61 6c 2c 20 73 75 6e 72 69 73 65 29 3b 00 00 00 30 20 20 20 20 6c 6f 6e econds(cal,.sunrise);...0....lon
79a0 67 20 65 6e 64 5f 73 65 63 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c g.end_sec.=.date_to_seconds(cal,
79c0 20 73 75 6e 73 65 74 29 3b 00 00 00 32 20 20 20 20 64 6f 75 62 6c 65 20 68 6f 75 72 73 20 3d 20 .sunset);...2....double.hours.=.
79e0 28 65 6e 64 5f 73 65 63 20 2d 20 73 74 61 72 74 5f 73 65 63 29 20 2f 20 33 36 30 30 2e 30 3b 00 (end_sec.-.start_sec)./.3600.0;.
7a00 00 00 56 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 64 61 79 20 6c 65 6e 67 74 68 20 ..V....printf("%s.%d.day.length.
7a20 25 2e 32 66 20 68 6f 75 72 73 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d %.2f.hours\n",.cal.month_names[m
7a40 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 2c 20 64 61 79 2c 20 68 6f 75 72 73 29 3b 00 00 00 6d 20 20 20 onth_num-1],.day,.hours);...m...
7a60 20 70 72 69 6e 74 66 28 22 73 75 6e 72 69 73 65 20 25 30 32 64 3a 25 30 32 64 20 73 75 6e 73 65 .printf("sunrise.%02d:%02d.sunse
7a80 74 20 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 73 75 6e 72 69 73 65 2e 68 6f 75 72 2c 20 73 75 t.%02d:%02d\n",.sunrise.hour,.su
7aa0 6e 72 69 73 65 2e 6d 69 6e 75 74 65 2c 20 73 75 6e 73 65 74 2e 68 6f 75 72 2c 20 73 75 6e 73 65 nrise.minute,.sunset.hour,.sunse
7ac0 74 2e 6d 69 6e 75 74 65 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 73 68 6f 77 t.minute);....}......."void.show
7ae0 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 2b 20 20 20 _calendar(calendar.cal).{...+...
7b00 20 70 72 69 6e 74 66 28 22 5c 6e 3d 3d 3d 3d 3d 20 25 64 20 3d 3d 3d 3d 3d 5c 6e 22 2c 20 63 61 .printf("\n=====.%d.=====\n",.ca
7b20 6c 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 29 l.year);...+....if.(cal.is_leap)
7b40 20 70 72 69 6e 74 66 28 22 6c 65 61 70 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 21 20 20 20 20 65 .printf("leap.year\n");...!....e
7b60 6c 73 65 20 70 72 69 6e 74 66 28 22 63 6f 6d 6d 6f 6e 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 11 lse.printf("common.year\n");....
7b80 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e ....printf("\n");..."....for.(in
7ba0 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 4d 20 20 20 20 20 t.i.=.0;.i.<.12;.i++).{...M.....
7bc0 20 20 20 70 72 69 6e 74 66 28 22 25 31 32 73 20 25 33 64 20 64 61 79 73 5c 6e 22 2c 20 63 61 6c ...printf("%12s.%3d.days\n",.cal
7be0 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f .month_names[i],.cal.days_per_mo
7c00 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 20 20 20 70 72 69 6e 74 66 28 nth[i]);........}........printf(
7c20 22 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1f 76 6f 69 64 20 73 68 6f 77 5f 6d 6f 6e "\n");....}........void.show_mon
7c40 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 19 20 20 20 20 63 68 61 72 20 6d th(calendar.cal).{........char.m
7c60 6f 6e 74 68 5f 69 6e 70 75 74 5b 32 30 5d 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 65 onth_input[20];...*....printf("e
7c80 6e 74 65 72 20 6d 6f 6e 74 68 20 6e 61 6d 65 20 6f 72 20 6e 75 6d 62 65 72 20 22 29 3b 00 00 00 nter.month.name.or.number.");...
7ca0 1d 20 20 20 20 73 63 61 6e 66 28 22 25 73 22 2c 20 6d 6f 6e 74 68 5f 69 6e 70 75 74 29 3b 00 00 .....scanf("%s",.month_input);..
7cc0 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 16 20 20 20 20 69 6e 74 20 6d 6f 6e 74 ......getchar();........int.mont
7ce0 68 5f 6e 75 6d 20 3d 20 30 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 h_num.=.0;..."....for.(int.i.=.0
7d00 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 3b 20 20 20 20 20 20 20 20 69 66 20 28 ;.i.<.12;.i++).{...;........if.(
7d20 73 74 72 63 6d 70 28 6d 6f 6e 74 68 5f 69 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 strcmp(month_input,.cal.month_na
7d40 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 7b 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 6d mes[i]).==.0).{................m
7d60 6f 6e 74 68 5f 6e 75 6d 20 3d 20 69 20 2b 20 31 3b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 onth_num.=.i.+.1;...............
7d80 20 62 72 65 61 6b 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 .break;............}........}...
7da0 19 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 3d 20 30 29 20 7b 00 00 00 26 20 20 .....if.(month_num.==.0).{...&..
7dc0 20 20 20 20 20 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3d 20 61 74 6f 69 28 6d 6f 6e 74 68 5f 69 6e 70 ......month_num.=.atoi(month_inp
7de0 75 74 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 2a 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 5f 6e ut);........}...*....if.(month_n
7e00 75 6d 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 5f 6e 75 6d 20 3e 20 31 32 29 20 7b 00 00 00 22 20 um.<.1.||.month_num.>.12).{...".
7e20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c 6e 22 29 .......printf("invalid.month\n")
7e40 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 ;............return;........}...
7e60 40 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e @....printf("\n%s.%d\n",.cal.mon
7e80 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 5f 6e 75 6d 2d 31 5d 2c 20 63 61 6c 2e 79 65 61 72 29 th_names[month_num-1],.cal.year)
7ea0 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 20 6d 6f 20 74 75 20 77 65 20 74 68 20 ;...%....printf("su.mo.tu.we.th.
7ec0 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 16 20 20 20 20 69 6e 74 20 66 69 72 73 74 5f 64 61 79 20 fr.sa\n");........int.first_day.
7ee0 3d 20 31 3b 00 00 00 17 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 7d 3b 00 =.1;........struct.tm.tm.=.{0};.
7f00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 2d 20 31 ..!....tm.tm_year.=.cal.year.-.1
7f20 39 30 30 3b 00 00 00 1e 20 20 20 20 74 6d 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 5f 6e 75 900;........tm.tm_mon.=.month_nu
7f40 6d 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e 74 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 00 00 m.-.1;........tm.tm_mday.=.1;...
7f60 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b 00 00 00 1b 20 20 20 20 66 69 72 73 74 5f 64 .....mktime(&tm);........first_d
7f80 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 79 3b 00 00 00 36 20 20 20 20 66 6f 72 20 28 69 6e 74 ay.=.tm.tm_wday;...6....for.(int
7fa0 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 72 73 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 72 69 6e .i.=.0;.i.<.first_day;.i++).prin
7fc0 74 66 28 22 20 20 20 22 29 3b 00 00 00 40 20 20 20 20 66 6f 72 20 28 69 6e 74 20 64 20 3d 20 31 tf("...");...@....for.(int.d.=.1
7fe0 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 5f ;.d.<=.cal.days_per_month[month_
8000 6e 75 6d 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 num-1];.d++).{............printf
8020 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 20 20 20 20 20 20 20 69 66 20 28 28 66 69 72 ("%2d.",.d);...3........if.((fir
8040 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 5c 6e st_day.+.d).%.7.==.0).printf("\n
8060 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 13 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 5c 6e ");........}........printf("\n\n
8080 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1d 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 ");....}........void.add_days(ca
80a0 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 64 61 79 73 3b 00 00 lendar.cal).{........int.days;..
80c0 00 1b 20 20 20 20 70 72 69 6e 74 66 28 22 64 61 79 73 20 74 6f 20 61 64 64 20 22 29 3b 00 00 00 ......printf("days.to.add.");...
80e0 17 20 20 20 20 73 63 61 6e 66 28 22 25 64 22 2c 20 26 64 61 79 73 29 3b 00 00 00 0e 20 20 20 20 .....scanf("%d",.&days);........
8100 67 65 74 63 68 61 72 28 29 3b 00 00 00 1b 20 20 20 20 64 61 74 65 74 69 6d 65 20 74 6f 64 61 79 getchar();........datetime.today
8120 20 3d 20 6e 6f 77 28 29 3b 00 00 00 2f 20 20 20 20 6c 6f 6e 67 20 73 65 63 6f 6e 64 73 20 3d 20 .=.now();.../....long.seconds.=.
8140 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 2c 20 74 6f 64 61 79 29 3b 00 00 00 16 date_to_seconds(cal,.today);....
8160 20 20 20 20 69 66 20 28 73 65 63 6f 6e 64 73 20 3c 20 30 29 20 7b 00 00 00 1f 20 20 20 20 20 20 ....if.(seconds.<.0).{..........
8180 20 20 70 72 69 6e 74 66 28 22 64 61 74 65 20 65 72 72 6f 72 5c 6e 22 29 3b 00 00 00 0f 20 20 20 ..printf("date.error\n");.......
81a0 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1c 20 20 20 20 73 65 63 .....return;........}........sec
81c0 6f 6e 64 73 20 2b 3d 20 64 61 79 73 20 2a 20 38 36 34 30 30 3b 00 00 00 34 20 20 20 20 64 61 74 onds.+=.days.*.86400;...4....dat
81e0 65 74 69 6d 65 20 66 75 74 75 72 65 20 3d 20 73 65 63 6f 6e 64 73 5f 74 6f 5f 64 61 74 65 28 63 etime.future.=.seconds_to_date(c
8200 61 6c 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 3d 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 34 al,.seconds);...=....printf("%04
8220 64 2d 25 30 32 64 2d 25 30 32 64 20 70 6c 75 73 20 25 64 20 64 61 79 73 20 3d 20 25 30 34 64 2d d-%02d-%02d.plus.%d.days.=.%04d-
8240 25 30 32 64 2d 25 30 32 64 5c 6e 22 2c 20 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 74 6f 64 %02d-%02d\n",....4...........tod
8260 61 79 2e 79 65 61 72 2c 20 74 6f 64 61 79 2e 6d 6f 6e 74 68 2c 20 74 6f 64 61 79 2e 64 61 79 2c ay.year,.today.month,.today.day,
8280 20 64 61 79 73 2c 00 00 00 32 20 20 20 20 20 20 20 20 20 20 20 66 75 74 75 72 65 2e 79 65 61 72 .days,...2...........future.year
82a0 2c 20 66 75 74 75 72 65 2e 6d 6f 6e 74 68 2c 20 66 75 74 75 72 65 2e 64 61 79 29 3b 00 00 00 01 ,.future.month,.future.day);....
82c0 7d 00 00 00 00 00 00 00 21 76 6f 69 64 20 64 61 79 73 5f 62 65 74 77 65 65 6e 28 63 61 6c 65 6e }.......!void.days_between(calen
82e0 64 61 72 20 63 61 6c 29 20 7b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 31 2c 6d 31 2c 64 31 2c 79 dar.cal).{........int.y1,m1,d1,y
8300 32 2c 6d 32 2c 64 32 3b 00 00 00 29 20 20 20 20 70 72 69 6e 74 66 28 22 66 69 72 73 74 20 64 61 2,m2,d2;...)....printf("first.da
8320 74 65 20 79 65 61 72 20 6d 6f 6e 74 68 20 64 61 79 20 22 29 3b 00 00 00 25 20 20 20 20 73 63 61 te.year.month.day.");...%....sca
8340 6e 66 28 22 25 64 20 25 64 20 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c 20 26 64 31 29 3b 00 00 nf("%d.%d.%d",.&y1,.&m1,.&d1);..
8360 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 73 65 63 6f 6e 64 20 64 61 74 65 20 79 65 61 72 20 6d .*....printf("second.date.year.m
8380 6f 6e 74 68 20 64 61 79 20 22 29 3b 00 00 00 25 20 20 20 20 73 63 61 6e 66 28 22 25 64 20 25 64 onth.day.");...%....scanf("%d.%d
83a0 20 25 64 22 2c 20 26 79 32 2c 20 26 6d 32 2c 20 26 64 32 29 3b 00 00 00 0e 20 20 20 20 67 65 74 .%d",.&y2,.&m2,.&d2);........get
83c0 63 68 61 72 28 29 3b 00 00 00 24 20 20 20 20 64 61 74 65 74 69 6d 65 20 64 74 31 20 3d 20 7b 79 char();...$....datetime.dt1.=.{y
83e0 31 2c 6d 31 2c 64 31 2c 30 2c 30 2c 30 7d 3b 00 00 00 24 20 20 20 20 64 61 74 65 74 69 6d 65 20 1,m1,d1,0,0,0};...$....datetime.
8400 64 74 32 20 3d 20 7b 79 32 2c 6d 32 2c 64 32 2c 30 2c 30 2c 30 7d 3b 00 00 00 36 20 20 20 20 63 dt2.=.{y2,m2,d2,0,0,0};...6....c
8420 61 6c 65 6e 64 61 72 20 63 61 6c 31 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 alendar.cal1.=.load_calendar("ca
8440 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 31 29 3b 00 00 00 36 20 20 20 20 63 61 6c 65 6e 64 61 lendar.txt",.y1);...6....calenda
8460 72 20 63 61 6c 32 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 r.cal2.=.load_calendar("calendar
8480 2e 74 78 74 22 2c 20 79 32 29 3b 00 00 00 2b 20 20 20 20 6c 6f 6e 67 20 73 65 63 31 20 3d 20 64 .txt",.y2);...+....long.sec1.=.d
84a0 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 6c 31 2c 20 64 74 31 29 3b 00 00 00 2b 20 20 ate_to_seconds(cal1,.dt1);...+..
84c0 20 20 6c 6f 6e 67 20 73 65 63 32 20 3d 20 64 61 74 65 5f 74 6f 5f 73 65 63 6f 6e 64 73 28 63 61 ..long.sec2.=.date_to_seconds(ca
84e0 6c 32 2c 20 64 74 32 29 3b 00 00 00 1f 20 20 20 20 69 66 20 28 73 65 63 31 20 3c 20 30 20 7c 7c l2,.dt2);........if.(sec1.<.0.||
8500 20 73 65 63 32 20 3c 20 30 29 20 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 .sec2.<.0).{...!........printf("
8520 69 6e 76 61 6c 69 64 20 64 61 74 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 invalid.date\n");............ret
8540 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1c 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d urn;........}........long.diff.=
8560 20 73 65 63 32 20 2d 20 73 65 63 31 3b 00 00 00 1f 20 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 .sec2.-.sec1;........if.(diff.<.
8580 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 64 61 79 73 0).diff.=.-diff;........int.days
85a0 20 3d 20 64 69 66 66 20 2f 20 38 36 34 30 30 3b 00 00 00 29 20 20 20 20 70 72 69 6e 74 66 28 22 .=.diff./.86400;...)....printf("
85c0 64 69 66 66 65 72 65 6e 63 65 20 25 64 20 64 61 79 73 5c 6e 22 2c 20 64 61 79 73 29 3b 00 00 00 difference.%d.days\n",.days);...
85e0 01 7d 00 00 00 00 00 00 00 0c 69 6e 74 20 6d 61 69 6e 28 29 20 7b 00 00 00 37 20 20 20 20 63 61 .}........int.main().{...7....ca
8600 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 lendar.cal.=.load_calendar("cale
8620 6e 64 61 72 2e 74 78 74 22 2c 20 32 30 32 36 29 3b 00 00 00 0f 20 20 20 20 69 6e 74 20 63 68 6f ndar.txt",.2026);........int.cho
8640 69 63 65 3b 00 00 00 0f 20 20 20 20 77 68 69 6c 65 20 28 31 29 20 7b 00 00 00 2c 20 20 20 20 20 ice;........while.(1).{...,.....
8660 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 63 6f 6d 70 74 65 75 72 20 74 69 6d 65 20 63 6f 75 6e 74 ...printf("\ncompteur.time.count
8680 65 72 5c 6e 22 29 3b 00 00 00 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 31 20 73 74 6f er\n");............printf("1.sto
86a0 70 77 61 74 63 68 5c 6e 22 29 3b 00 00 00 29 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 32 pwatch\n");...)........printf("2
86c0 20 6d 65 61 73 75 72 65 20 64 61 79 20 6c 65 6e 67 74 68 5c 6e 22 29 3b 00 00 00 29 20 20 20 20 .measure.day.length\n");...)....
86e0 20 20 20 20 70 72 69 6e 74 66 28 22 33 20 73 68 6f 77 20 66 75 6c 6c 20 63 61 6c 65 6e 64 61 72 ....printf("3.show.full.calendar
8700 5c 6e 22 29 3b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 34 20 73 68 6f 77 20 \n");...!........printf("4.show.
8720 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 23 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 35 20 month\n");...#........printf("5.
8740 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e 22 29 3b 00 00 00 28 20 20 20 20 20 20 20 20 70 72 69 current.time\n");...(........pri
8760 6e 74 66 28 22 36 20 61 64 64 20 64 61 79 73 20 74 6f 20 74 6f 64 61 79 5c 6e 22 29 3b 00 00 00 ntf("6.add.days.to.today\n");...
8780 2d 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 37 20 64 61 79 73 20 62 65 74 77 65 65 6e 20 -........printf("7.days.between.
87a0 74 77 6f 20 64 61 74 65 73 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 two.dates\n");..."........printf
87c0 28 22 38 20 63 68 61 6e 67 65 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 1b 20 20 20 20 20 20 20 20 ("8.change.year\n");............
87e0 70 72 69 6e 74 66 28 22 39 20 65 78 69 74 5c 6e 22 29 3b 00 00 00 1a 20 20 20 20 20 20 20 20 70 printf("9.exit\n");............p
8800 72 69 6e 74 66 28 22 63 68 6f 69 63 65 20 22 29 3b 00 00 00 1d 20 20 20 20 20 20 20 20 73 63 61 rintf("choice.");............sca
8820 6e 66 28 22 25 64 22 2c 20 26 63 68 6f 69 63 65 29 3b 00 00 00 12 20 20 20 20 20 20 20 20 67 65 nf("%d",.&choice);............ge
8840 74 63 68 61 72 28 29 3b 00 00 00 28 20 20 20 20 20 20 20 20 69 66 20 28 63 68 6f 69 63 65 20 3d tchar();...(........if.(choice.=
8860 3d 20 31 29 20 73 74 6f 70 77 61 74 63 68 28 63 61 6c 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 =.1).stopwatch(cal);.../........
8880 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 32 29 20 6d 65 61 73 75 72 65 5f 64 61 else.if.(choice.==.2).measure_da
88a0 79 28 63 61 6c 29 3b 00 00 00 31 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 y(cal);...1........else.if.(choi
88c0 63 65 20 3d 3d 20 33 29 20 73 68 6f 77 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 29 3b 00 00 00 2e ce.==.3).show_calendar(cal);....
88e0 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 34 29 20 73 68 ........else.if.(choice.==.4).sh
8900 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 ow_month(cal);............else.i
8920 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 35 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 f.(choice.==.5).{...............
8940 20 64 61 74 65 74 69 6d 65 20 74 20 3d 20 6e 6f 77 28 29 3b 00 00 00 34 20 20 20 20 20 20 20 20 .datetime.t.=.now();...4........
8960 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 34 64 20 25 73 20 25 30 32 64 20 25 30 32 64 3a 25 30 ....printf("%04d.%s.%02d.%02d:%0
8980 32 64 3a 25 30 32 64 5c 6e 22 2c 20 00 00 00 3d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d:%02d\n",....=................
89a0 20 20 20 74 2e 79 65 61 72 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 74 2e 6d 6f 6e ...t.year,.cal.month_names[t.mon
89c0 74 68 2d 31 5d 2c 20 74 2e 64 61 79 2c 00 00 00 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 th-1],.t.day,.../...............
89e0 20 20 20 20 74 2e 68 6f 75 72 2c 20 74 2e 6d 69 6e 75 74 65 2c 20 74 2e 73 65 63 6f 6e 64 29 3b ....t.hour,.t.minute,.t.second);
8a00 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 2c 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 ............}...,........else.if
8a20 20 28 63 68 6f 69 63 65 20 3d 3d 20 36 29 20 61 64 64 5f 64 61 79 73 28 63 61 6c 29 3b 00 00 00 .(choice.==.6).add_days(cal);...
8a40 30 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 37 29 20 64 0........else.if.(choice.==.7).d
8a60 61 79 73 5f 62 65 74 77 65 65 6e 28 63 61 6c 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 65 6c 73 ays_between(cal);............els
8a80 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 38 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 e.if.(choice.==.8).{............
8aa0 20 20 20 20 69 6e 74 20 79 3b 00 00 00 22 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 ....int.y;..."............printf
8ac0 28 22 65 6e 74 65 72 20 79 65 61 72 20 22 29 3b 00 00 00 1c 20 20 20 20 20 20 20 20 20 20 20 20 ("enter.year.");................
8ae0 73 63 61 6e 66 28 22 25 64 22 2c 20 26 79 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 scanf("%d",.&y);................
8b00 67 65 74 63 68 61 72 28 29 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 20 3d 20 getchar();...3............cal.=.
8b20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 load_calendar("calendar.txt",.y)
8b40 3b 00 00 00 2e 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 63 68 ;................printf("year.ch
8b60 61 6e 67 65 64 20 74 6f 20 25 64 5c 6e 22 2c 20 79 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d anged.to.%d\n",.y);............}
8b80 00 00 00 24 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 63 68 6f 69 63 65 20 3d 3d 20 39 ...$........else.if.(choice.==.9
8ba0 29 20 62 72 65 61 6b 3b 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 ).break;...(........else.printf(
8bc0 22 69 6e 76 61 6c 69 64 20 63 68 6f 69 63 65 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 "invalid.choice\n");........}...
8be0 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 .....return.0;....}5............
8c00 00 00 00 3e 01 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 25 00 00 00 ...>.......................s%...
8c20 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 08 00 00 00 0a 00 00 00 00 00 00 00 00 00 ...........5._..................
8c40 00 00 09 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 ................................
8c60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8c80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8ca0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8cc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8ce0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8d00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3c 34 04 01 00 00 00 07 00 f5 18 00 00 .................j.<4...........
8dc0 01 04 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 01 05 00 00 00 00 00 00 00 00 ................................
8de0 00 00 00 00 f5 18 00 00 00 83 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 0d 20 20 20 20 67 65 ..............................ge
8e00 74 63 68 61 72 28 29 f5 18 00 00 00 84 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 tchar().........................
8e20 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................................
8e40 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 83 00 00 00 0d 00 00 .5..............................
8e60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 83 ................................
8e80 00 00 00 0d 00 00 00 00 00 00 00 00 00 00 00 81 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 00 ................................
8ea0 00 00 00 00 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 04 01 00 00 00 00 00 00 00 00 00 ................................
8ec0 00 00 00 00 00 23 00 00 00 01 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4d 03 00 .....#.......................M..
8ee0 00 00 00 00 00 35 81 5f d0 00 00 00 09 00 00 00 0b 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 00 .....5._........................
8f00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8f20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8f40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8f60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8f80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8fa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8fc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
8fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
9000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
9020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
9040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
9060 00 00 00 00 00 00 00 00 00 00 00 6a 00 3c ec 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 ...........j.<..................
9080 00 00 00 00 00 00 01 28 00 00 00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 .......(....#include.<stdio.h>..
90a0 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 ..#include.<stdlib.h>....#includ
90c0 65 20 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 e.<string.h>....#include.<time.h
90e0 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 67 65 74 6f 70 74 2e 68 3e 00 00 00 00 00 00 00 10 >....#include.<getopt.h>........
9100 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 typedef.struct.{........int.year
9120 3b 00 00 00 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 ;........int.is_leap;........int
9140 20 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 .days_per_month[12];........char
9160 20 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e .month_names[12][10];....}.calen
9180 64 61 72 3b 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 dar;.......8calendar.load_calend
91a0 61 72 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 ar(const.char.*filename,.int.yea
91c0 72 29 20 7b 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 r).{........calendar.cal;.......
91e0 20 63 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f .cal.year.=.year;........cal.is_
9200 6c 65 61 70 20 3d 20 30 3b 00 00 00 8e 20 20 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e leap.=.0;........char.*default_n
9220 61 6d 65 73 5b 31 32 5d 20 3d 20 7b 22 6a 61 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 ames[12].=.{"january","february"
9240 2c 22 6d 61 72 63 68 22 2c 22 61 70 72 69 6c 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a ,"march","april","may","june","j
9260 75 6c 79 22 2c 22 61 75 67 75 73 74 22 2c 22 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 uly","august","september","octob
9280 65 72 22 2c 22 6e 6f 76 65 6d 62 65 72 22 2c 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 er","november","december"};...".
92a0 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 ...for.(int.i.=.0;.i.<.12;.i++).
92c0 7b 00 00 00 35 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 {...5........strcpy(cal.month_na
92e0 6d 65 73 5b 69 5d 2c 20 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 mes[i],.default_names[i]);.../..
9300 20 20 20 20 20 20 69 66 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d ......if.(i.==.1).cal.days_per_m
9320 6f 6e 74 68 5b 69 5d 20 3d 20 32 38 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 onth[i].=.28;...S........else.if
9340 20 28 69 20 3d 3d 20 33 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 .(i.==.3.||.i.==.5.||.i.==.8.||.
9360 69 20 3d 3d 20 31 30 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d i.==.10).cal.days_per_month[i].=
9380 20 33 30 3b 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 .30;...(........else.cal.days_pe
93a0 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 r_month[i].=.31;........}...#...
93c0 20 46 49 4c 45 20 2a 66 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b .FILE.*f.=.fopen(filename,."r");
93e0 00 00 00 17 20 20 20 20 69 66 20 28 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 ........if.(!f).return.cal;.....
9400 20 20 20 63 68 61 72 20 6c 69 6e 65 5b 35 31 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 ...char.line[512];...*....while.
9420 28 66 67 65 74 73 28 6c 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b (fgets(line,.sizeof(line),.f)).{
9440 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 ...-........if.(strncmp(line,."y
9460 65 61 72 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 ear:",.5).==.0).{...............
9480 20 69 6e 74 20 79 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 .int.y;...)............sscanf(li
94a0 6e 65 2c 20 22 79 65 61 72 3a 20 25 64 22 2c 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 ne,."year:.%d",.&y);...$........
94c0 20 20 20 20 69 66 20 28 79 20 21 3d 20 79 65 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 ....if.(y.!=.year).continue;....
94e0 20 20 20 20 20 20 20 20 7d 00 00 00 2e 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 ........}............if.(strncmp
9500 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 22 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 (line,."month:",.6).==.0).{.....
9520 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 ...........int.m,.d;............
9540 20 20 20 20 63 68 61 72 20 6e 61 6d 65 5b 32 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 ....char.name[20];...F..........
9560 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 ..sscanf(line,."month:.%d.days:.
9580 25 64 20 6e 61 6d 65 3a 20 25 73 22 2c 20 26 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 %d.name:.%s",.&m,.&d,.name);...$
95a0 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 ............if.(m.>=.1.&&.m.<=.1
95c0 32 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 2).{...,................cal.days
95e0 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 _per_month[m-1].=.d;...3........
9600 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d ........strcpy(cal.month_names[m
9620 2d 31 5d 2c 20 6e 61 6d 65 29 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 -1],.name);................}....
9640 20 20 20 20 20 20 20 20 7d 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 ........}...-........if.(strncmp
9660 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 (line,."leap:",.5).==.0).{......
9680 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6c 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 ..........int.l;...)............
96a0 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 sscanf(line,."leap:.%d",.&l);...
96c0 32 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 2............if.(year.==.cal.yea
96e0 72 29 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d r).cal.is_leap.=.l;............}
9700 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 ........}........fclose(f);.....
9720 20 20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2c 69 6e 74 20 70 ...return.cal;....}.......,int.p
9740 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 69 arse_month(calendar.cal,.char.*i
9760 6e 70 75 74 29 20 7b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 nput).{..."....for.(int.i.=.0;.i
9780 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 41 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 .<.12;.i++).{...A........if.(str
97a0 63 6d 70 28 69 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d cmp(input,.cal.month_names[i]).=
97c0 3d 20 30 29 20 72 65 74 75 72 6e 20 69 20 2b 20 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 =.0).return.i.+.1;........}.....
97e0 20 20 20 72 65 74 75 72 6e 20 61 74 6f 69 28 69 6e 70 75 74 29 3b 00 00 00 01 7d 00 00 00 00 00 ...return.atoi(input);....}.....
9800 00 00 1e 76 6f 69 64 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 ...void.show_year(calendar.cal).
9820 7b 00 00 00 22 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 5c 6e 22 2c 20 63 61 6c {..."....printf("year.%d\n",.cal
9840 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 29 20 .year);...+....if.(cal.is_leap).
9860 70 72 69 6e 74 66 28 22 6c 65 61 70 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 66 6f printf("leap.year\n");..."....fo
9880 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 45 r.(int.i.=.0;.i.<.12;.i++).{...E
98a0 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f ........printf("%s.%d\n",.cal.mo
98c0 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 nth_names[i],.cal.days_per_month
98e0 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 2a 76 6f 69 64 20 [i]);........}....}.......*void.
9900 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e show_month(calendar.cal,.int.mon
9920 74 68 29 20 7b 00 00 00 22 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 6d 6f th).{..."....if.(month.<.1.||.mo
9940 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 nth.>.12).{..."........printf("i
9960 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 nvalid.month\n");............ret
9980 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 urn;........}...:....printf("%s.
99a0 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c %d\n",.cal.month_names[month-1],
99c0 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 20 6d 6f .cal.year);...%....printf("su.mo
99e0 20 74 75 20 77 65 20 74 68 20 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 17 20 20 20 20 73 74 72 75 .tu.we.th.fr.sa\n");........stru
9a00 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 65 61 ct.tm.tm.=.{0};...!....tm.tm_yea
9a20 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 2d 20 31 39 30 30 3b 00 00 00 1a 20 20 20 20 74 6d 2e 74 r.=.cal.year.-.1900;........tm.t
9a40 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e 74 6d 5f m_mon.=.month.-.1;........tm.tm_
9a60 6d 64 61 79 20 3d 20 31 3b 00 00 00 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b 00 00 00 mday.=.1;........mktime(&tm);...
9a80 1f 20 20 20 20 69 6e 74 20 66 69 72 73 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 79 3b .....int.first_day.=.tm.tm_wday;
9aa0 00 00 00 36 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 72 73 ...6....for.(int.i.=.0;.i.<.firs
9ac0 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 3c 20 20 t_day;.i++).printf("...");...<..
9ae0 20 20 66 6f 72 20 28 69 6e 74 20 64 20 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 73 5f ..for.(int.d.=.1;.d.<=.cal.days_
9b00 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 1a 20 20 per_month[month-1];.d++).{......
9b20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 20 20 20 ......printf("%2d.",.d);...3....
9b40 20 20 20 20 69 66 20 28 28 66 69 72 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d 3d 20 30 ....if.((first_day.+.d).%.7.==.0
9b60 29 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 20 20 20 ).printf("\n");........}........
9b80 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 38 76 6f 69 64 20 73 printf("\n");....}.......8void.s
9ba0 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 how_day_length(calendar.cal,.int
9bc0 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 52 20 20 20 20 69 66 20 28 6d 6f .month,.int.day).{...R....if.(mo
9be0 6e 74 68 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 nth.<.1.||.month.>.12.||.day.<.1
9c00 20 7c 7c 20 64 61 79 20 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e .||.day.>.cal.days_per_month[mon
9c20 74 68 2d 31 5d 29 20 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 th-1]).{...!........printf("inva
9c40 6c 69 64 20 64 61 74 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b lid.date\n");............return;
9c60 00 00 00 05 20 20 20 20 7d 00 00 00 2b 20 20 20 20 69 6e 74 20 73 75 6e 72 69 73 65 5f 68 6f 75 ........}...+....int.sunrise_hou
9c80 72 20 3d 20 36 2c 20 73 75 6e 72 69 73 65 5f 6d 69 6e 20 3d 20 33 30 3b 00 00 00 2a 20 20 20 20 r.=.6,.sunrise_min.=.30;...*....
9ca0 69 6e 74 20 73 75 6e 73 65 74 5f 68 6f 75 72 20 3d 20 31 38 2c 20 73 75 6e 73 65 74 5f 6d 69 6e int.sunset_hour.=.18,.sunset_min
9cc0 20 3d 20 33 30 3b 00 00 00 31 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3d 3d 20 35 20 7c 7c 20 .=.30;...1....if.(month.==.5.||.
9ce0 6d 6f 6e 74 68 20 3d 3d 20 36 20 7c 7c 20 6d 6f 6e 74 68 20 3d 3d 20 37 29 20 7b 00 00 00 19 20 month.==.6.||.month.==.7).{.....
9d00 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 5f 68 6f 75 72 20 3d 20 35 3b 00 00 00 19 20 20 20 20 .......sunrise_hour.=.5;........
9d20 20 20 20 20 73 75 6e 73 65 74 5f 68 6f 75 72 20 3d 20 31 39 3b 00 00 00 05 20 20 20 20 7d 00 00 ....sunset_hour.=.19;........}..
9d40 00 33 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3d 3d 20 31 31 20 7c 7c 20 6d 6f 6e 74 68 20 3d .3....if.(month.==.11.||.month.=
9d60 3d 20 31 32 20 7c 7c 20 6d 6f 6e 74 68 20 3d 3d 20 31 29 20 7b 00 00 00 19 20 20 20 20 20 20 20 =.12.||.month.==.1).{...........
9d80 20 73 75 6e 72 69 73 65 5f 68 6f 75 72 20 3d 20 37 3b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 .sunrise_hour.=.7;............su
9da0 6e 73 65 74 5f 68 6f 75 72 20 3d 20 31 37 3b 00 00 00 05 20 20 20 20 7d 00 00 00 24 20 20 20 20 nset_hour.=.17;........}...$....
9dc0 69 66 20 28 6d 6f 6e 74 68 20 3d 3d 20 34 20 7c 7c 20 6d 6f 6e 74 68 20 3d 3d 20 31 30 29 20 7b if.(month.==.4.||.month.==.10).{
9de0 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 5f 68 6f 75 72 20 3d 20 36 3b 00 00 00 ............sunrise_hour.=.6;...
9e00 19 20 20 20 20 20 20 20 20 73 75 6e 73 65 74 5f 68 6f 75 72 20 3d 20 31 38 3b 00 00 00 05 20 20 .........sunset_hour.=.18;......
9e20 20 20 7d 00 00 00 23 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3d 3d 20 33 20 7c 7c 20 6d 6f 6e ..}...#....if.(month.==.3.||.mon
9e40 74 68 20 3d 3d 20 39 29 20 7b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 72 69 73 65 5f 68 6f th.==.9).{............sunrise_ho
9e60 75 72 20 3d 20 36 3b 00 00 00 19 20 20 20 20 20 20 20 20 73 75 6e 73 65 74 5f 68 6f 75 72 20 3d ur.=.6;............sunset_hour.=
9e80 20 31 38 3b 00 00 00 05 20 20 20 20 7d 00 00 00 5c 20 20 20 20 64 6f 75 62 6c 65 20 64 61 79 5f .18;........}...\....double.day_
9ea0 6c 65 6e 67 74 68 20 3d 20 28 73 75 6e 73 65 74 5f 68 6f 75 72 20 2b 20 73 75 6e 73 65 74 5f 6d length.=.(sunset_hour.+.sunset_m
9ec0 69 6e 2f 36 30 2e 30 29 20 2d 20 28 73 75 6e 72 69 73 65 5f 68 6f 75 72 20 2b 20 73 75 6e 72 69 in/60.0).-.(sunrise_hour.+.sunri
9ee0 73 65 5f 6d 69 6e 2f 36 30 2e 30 29 3b 00 00 00 4a 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 se_min/60.0);...J....printf("%s.
9f00 25 64 20 73 75 6e 72 69 73 65 20 25 30 32 64 3a 25 30 32 64 20 73 75 6e 73 65 74 20 25 30 32 64 %d.sunrise.%02d:%02d.sunset.%02d
9f20 3a 25 30 32 64 20 6c 65 6e 67 74 68 20 25 2e 32 66 20 68 6f 75 72 73 5c 6e 22 2c 00 00 00 6a 20 :%02d.length.%.2f.hours\n",...j.
9f40 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d ..........cal.month_names[month-
9f60 31 5d 2c 20 64 61 79 2c 20 73 75 6e 72 69 73 65 5f 68 6f 75 72 2c 20 73 75 6e 72 69 73 65 5f 6d 1],.day,.sunrise_hour,.sunrise_m
9f80 69 6e 2c 20 73 75 6e 73 65 74 5f 68 6f 75 72 2c 20 73 75 6e 73 65 74 5f 6d 69 6e 2c 20 64 61 79 in,.sunset_hour,.sunset_min,.day
9fa0 5f 6c 65 6e 67 74 68 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 26 76 6f 69 64 20 73 68 6f 77 5f _length);....}.......&void.show_
9fc0 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 1a current_time(calendar.cal).{....
9fe0 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 25 20 20 ....time_t.t.=.time(NULL);...%..
a000 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 ..struct.tm.*local.=.localtime(&
a020 74 29 3b 00 00 00 25 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f t);...%....int.year.=.local->tm_
a040 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 22 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 year.+.1900;..."....int.month.=.
a060 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1d 20 20 20 20 69 6e 74 20 64 61 local->tm_mon.+.1;........int.da
a080 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1e 20 20 20 20 69 6e 74 20 68 y.=.local->tm_mday;........int.h
a0a0 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1f 20 20 20 20 69 6e 74 our.=.local->tm_hour;........int
a0c0 20 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 00 00 1f 20 20 20 20 .minute.=.local->tm_min;........
a0e0 69 6e 74 20 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 3b 00 00 00 3b 20 int.second.=.local->tm_sec;...;.
a100 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e ...calendar.cur_cal.=.load_calen
a120 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 3b 00 00 00 67 20 20 dar("calendar.txt",.year);...g..
a140 20 20 70 72 69 6e 74 66 28 22 25 64 20 25 73 20 25 64 20 25 30 32 64 3a 25 30 32 64 3a 25 30 32 ..printf("%d.%s.%d.%02d:%02d:%02
a160 64 5c 6e 22 2c 20 79 65 61 72 2c 20 63 75 72 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b d\n",.year,.cur_cal.month_names[
a180 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 68 6f 75 72 2c 20 6d 69 6e 75 74 65 2c 20 73 65 63 month-1],.day,.hour,.minute,.sec
a1a0 6f 6e 64 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 72 75 6e 5f 73 74 6f 70 77 ond);....}......."void.run_stopw
a1c0 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 25 20 20 20 20 70 72 69 6e atch(calendar.cal).{...%....prin
a1e0 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 61 72 74 5c 6e 22 29 3b 00 00 00 tf("press.enter.to.start\n");...
a200 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 73 74 .....getchar();........time_t.st
a220 61 72 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2c 20 20 20 20 70 72 69 6e 74 66 28 art.=.time(NULL);...,....printf(
a240 22 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 6f 70 5c 6e 22 29 "running.press.enter.to.stop\n")
a260 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1c 20 20 20 20 74 69 6d 65 5f ;........getchar();........time_
a280 74 20 65 6e 64 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 1c 20 20 20 20 6c 6f 6e 67 20 t.end.=.time(NULL);........long.
a2a0 64 69 66 66 20 3d 20 65 6e 64 20 2d 20 73 74 61 72 74 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 68 diff.=.end.-.start;........int.h
a2c0 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 20 69 6e 74 20 6d ours.=.diff./.3600;...%....int.m
a2e0 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 30 3b 00 00 00 1c inutes.=.(diff.%.3600)./.60;....
a300 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 30 3b 00 00 00 38 ....int.seconds.=.diff.%.60;...8
a320 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 68 ....printf("%02d:%02d:%02d\n",.h
a340 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 01 7d 00 00 00 ours,.minutes,.seconds);....}...
a360 00 00 00 00 27 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c ....'void.add_days(calendar.cal,
a380 20 69 6e 74 20 64 61 79 73 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 .int.days).{........time_t.t.=.t
a3a0 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 16 20 20 20 20 74 20 2b 3d 20 64 61 79 73 20 2a 20 38 36 ime(NULL);........t.+=.days.*.86
a3c0 34 30 30 3b 00 00 00 26 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 66 75 74 75 72 65 20 3d 20 400;...&....struct.tm.*future.=.
a3e0 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 26 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d localtime(&t);...&....int.year.=
a400 20 66 75 74 75 72 65 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 23 20 20 20 20 .future->tm_year.+.1900;...#....
a420 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 int.month.=.future->tm_mon.+.1;.
a440 00 00 1e 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 64 61 79 .......int.day.=.future->tm_mday
a460 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 66 75 74 5f 63 61 6c 20 3d 20 6c 6f 61 64 ;...;....calendar.fut_cal.=.load
a480 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 3b _calendar("calendar.txt",.year);
a4a0 00 00 00 5c 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 64 61 79 73 20 66 72 6f 6d 20 6e 6f 77 ...\....printf("%d.days.from.now
a4c0 20 69 73 20 25 64 20 25 73 20 25 64 5c 6e 22 2c 20 64 61 79 73 2c 20 79 65 61 72 2c 20 66 75 74 .is.%d.%s.%d\n",.days,.year,.fut
a4e0 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b _cal.month_names[month-1],.day);
a500 00 00 00 01 7d 00 00 00 00 00 00 00 3b 76 6f 69 64 20 64 61 79 73 5f 62 65 74 77 65 65 6e 28 63 ....}.......;void.days_between(c
a520 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 64 61 74 65 31 2c 20 63 68 61 72 20 2a alendar.cal,.char.*date1,.char.*
a540 64 61 74 65 32 29 20 7b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 31 2c 6d 31 2c 64 31 2c 79 32 2c date2).{........int.y1,m1,d1,y2,
a560 6d 32 2c 64 32 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 61 74 65 31 2c 20 22 25 64 2d m2,d2;...-....sscanf(date1,."%d-
a580 25 64 2d 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c 20 26 64 31 29 3b 00 00 00 2d 20 20 20 20 73 %d-%d",.&y1,.&m1,.&d1);...-....s
a5a0 73 63 61 6e 66 28 64 61 74 65 32 2c 20 22 25 64 2d 25 64 2d 25 64 22 2c 20 26 79 32 2c 20 26 6d scanf(date2,."%d-%d-%d",.&y2,.&m
a5c0 32 2c 20 26 64 32 29 3b 00 00 00 23 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 74 6d 31 20 3d 20 2,.&d2);...#....struct.tm.tm1.=.
a5e0 7b 30 7d 2c 20 74 6d 32 20 3d 20 7b 30 7d 3b 00 00 00 1c 20 20 20 20 74 6d 31 2e 74 6d 5f 79 65 {0},.tm2.=.{0};........tm1.tm_ye
a600 61 72 20 3d 20 79 31 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 6f ar.=.y1.-.1900;........tm1.tm_mo
a620 6e 20 3d 20 6d 31 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 64 61 79 20 3d n.=.m1.-.1;........tm1.tm_mday.=
a640 20 64 31 3b 00 00 00 1c 20 20 20 20 74 6d 32 2e 74 6d 5f 79 65 61 72 20 3d 20 79 32 20 2d 20 31 .d1;........tm2.tm_year.=.y2.-.1
a660 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 32 20 2d 20 31 3b 900;........tm2.tm_mon.=.m2.-.1;
a680 00 00 00 15 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 64 61 79 20 3d 20 64 32 3b 00 00 00 20 20 20 20 ........tm2.tm_mday.=.d2;.......
a6a0 20 74 69 6d 65 5f 74 20 74 69 6d 65 31 20 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 31 29 3b 00 00 00 .time_t.time1.=.mktime(&tm1);...
a6c0 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 32 20 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 32 29 .....time_t.time2.=.mktime(&tm2)
a6e0 3b 00 00 00 28 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 28 74 69 6d 65 32 20 2d 20 74 69 ;...(....long.diff.=.(time2.-.ti
a700 6d 65 31 29 20 2f 20 38 36 34 30 30 3b 00 00 00 1f 20 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 me1)./.86400;........if.(diff.<.
a720 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 0).diff.=.-diff;...*....printf("
a740 64 69 66 66 65 72 65 6e 63 65 20 25 6c 64 20 64 61 79 73 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 difference.%ld.days\n",.diff);..
a760 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 70 72 69 6e 74 5f 75 73 61 67 65 28 63 68 61 72 ..}........void.print_usage(char
a780 20 2a 70 72 6f 67 29 20 7b 00 00 00 29 20 20 20 20 70 72 69 6e 74 66 28 22 75 73 61 67 65 20 25 .*prog).{...)....printf("usage.%
a7a0 73 20 5b 6f 70 74 69 6f 6e 73 5d 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 33 20 20 20 20 70 72 s.[options]\n",.prog);...3....pr
a7c0 69 6e 74 66 28 22 2d 2d 79 65 61 72 20 59 59 59 59 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 intf("--year.YYYY...............
a7e0 73 65 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 49 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 set.year\n");...I....printf("--s
a800 68 6f 77 2d 79 65 61 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 63 61 6c 65 how-year...............show.cale
a820 6e 64 61 72 20 66 6f 72 20 63 75 72 72 65 6e 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 35 20 20 ndar.for.current.year\n");...5..
a840 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6d 6f 6e 74 68 20 4d 4d 20 6f 72 20 6e 61 6d ..printf("--show-month.MM.or.nam
a860 65 20 20 20 73 68 6f 77 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 3c 20 20 20 20 70 72 69 6e 74 e...show.month\n");...<....print
a880 66 28 22 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 6d 6f 6e 74 68 20 64 61 79 5c 22 20 73 f("--show-length.\"month.day\".s
a8a0 68 6f 77 20 64 61 79 20 6c 65 6e 67 74 68 5c 6e 22 29 3b 00 00 00 3c 20 20 20 20 70 72 69 6e 74 how.day.length\n");...<....print
a8c0 66 28 22 2d 2d 6e 6f 77 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f f("--now.....................sho
a8e0 77 20 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e 22 29 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 w.current.time\n");...8....print
a900 66 28 22 2d 2d 73 74 6f 70 77 61 74 63 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 75 6e f("--stopwatch...............run
a920 20 73 74 6f 70 77 61 74 63 68 5c 6e 22 29 3b 00 00 00 3e 20 20 20 20 70 72 69 6e 74 66 28 22 2d .stopwatch\n");...>....printf("-
a940 2d 61 64 64 2d 64 61 79 73 20 4e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 20 4e 20 64 -add-days.N..............add.N.d
a960 61 79 73 20 74 6f 20 74 6f 64 61 79 5c 6e 22 29 3b 00 00 00 47 20 20 20 20 70 72 69 6e 74 66 28 ays.to.today\n");...G....printf(
a980 22 2d 2d 62 65 74 77 65 65 6e 20 59 59 59 59 2d 4d 4d 2d 44 44 20 59 59 59 59 2d 4d 4d 2d 44 44 "--between.YYYY-MM-DD.YYYY-MM-DD
a9a0 20 64 61 79 73 20 62 65 74 77 65 65 6e 20 74 77 6f 20 64 61 74 65 73 5c 6e 22 29 3b 00 00 00 43 .days.between.two.dates\n");...C
a9c0 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 63 61 6c 65 6e 64 61 72 2d 66 69 6c 65 20 46 49 4c 45 ....printf("--calendar-file.FILE
a9e0 20 20 20 20 20 20 75 73 65 20 63 75 73 74 6f 6d 20 63 61 6c 65 6e 64 61 72 20 66 69 6c 65 5c 6e ......use.custom.calendar.file\n
aa00 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 21 69 6e 74 20 6d 61 69 6e 28 69 6e 74 20 61 72 67 ");....}.......!int.main(int.arg
aa20 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 76 29 20 7b 00 00 00 14 20 20 20 20 69 6e 74 20 79 65 61 c,.char.**argv).{........int.yea
aa40 72 20 3d 20 32 30 32 36 3b 00 00 00 29 20 20 20 20 63 68 61 72 20 2a 63 61 6c 65 6e 64 61 72 5f r.=.2026;...)....char.*calendar_
aa60 66 69 6c 65 20 3d 20 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 3b 00 00 00 1b 20 20 20 20 69 6e file.=."calendar.txt";........in
aa80 74 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 20 20 20 20 20 63 68 61 t.show_year_flag.=.0;........cha
aaa0 72 20 2a 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 21 20 20 20 r.*show_month_arg.=.NULL;...!...
aac0 20 63 68 61 72 20 2a 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 .char.*show_length_arg.=.NULL;..
aae0 00 15 20 20 20 20 69 6e 74 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 ......int.now_flag.=.0;........i
ab00 6e 74 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 19 20 20 20 20 69 6e nt.stopwatch_flag.=.0;........in
ab20 74 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 30 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 t.add_days_val.=.0;........char.
ab40 2a 62 65 74 77 65 65 6e 31 20 3d 20 4e 55 4c 4c 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 *between1.=.NULL;........char.*b
ab60 65 74 77 65 65 6e 32 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 2b 20 20 20 20 73 etween2.=.NULL;...........+....s
ab80 74 61 74 69 63 20 73 74 72 75 63 74 20 6f 70 74 69 6f 6e 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 tatic.struct.option.long_options
aba0 5b 5d 20 3d 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 22 2c 20 72 65 71 75 69 [].=.{...,........{"year",.requi
abc0 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 79 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 red_argument,.0,.'y'},...+......
abe0 20 20 7b 22 73 68 6f 77 2d 79 65 61 72 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 ..{"show-year",.no_argument,.0,.
ac00 27 59 27 7d 2c 00 00 00 32 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6d 6f 6e 74 68 22 2c 20 'Y'},...2........{"show-month",.
ac20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6d 27 7d 2c 00 00 00 33 20 required_argument,.0,.'m'},...3.
ac40 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6c 65 6e 67 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f .......{"show-length",.required_
ac60 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6c 27 7d 2c 00 00 00 25 20 20 20 20 20 20 20 20 7b 22 argument,.0,.'l'},...%........{"
ac80 6e 6f 77 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6e 27 7d 2c 00 00 00 2b 20 now",.no_argument,.0,.'n'},...+.
aca0 20 20 20 20 20 20 20 7b 22 73 74 6f 70 77 61 74 63 68 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 .......{"stopwatch",.no_argument
acc0 2c 20 30 2c 20 27 73 27 7d 2c 00 00 00 30 20 20 20 20 20 20 20 20 7b 22 61 64 64 2d 64 61 79 73 ,.0,.'s'},...0........{"add-days
ace0 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 61 27 7d 2c 00 00 ",.required_argument,.0,.'a'},..
ad00 00 2f 20 20 20 20 20 20 20 20 7b 22 62 65 74 77 65 65 6e 22 2c 20 72 65 71 75 69 72 65 64 5f 61 ./........{"between",.required_a
ad20 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 62 27 7d 2c 00 00 00 35 20 20 20 20 20 20 20 20 7b 22 63 rgument,.0,.'b'},...5........{"c
ad40 61 6c 65 6e 64 61 72 2d 66 69 6c 65 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 alendar-file",.required_argument
ad60 2c 20 30 2c 20 27 63 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 68 65 6c 70 22 2c 20 6e ,.0,.'c'},...&........{"help",.n
ad80 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 68 27 7d 2c 00 00 00 14 20 20 20 20 20 20 20 20 o_argument,.0,.'h'},............
ada0 7b 30 2c 20 30 2c 20 30 2c 20 30 7d 00 00 00 06 20 20 20 20 7d 3b 00 00 00 04 20 20 20 20 00 00 {0,.0,.0,.0}........};..........
adc0 00 19 20 20 20 20 69 6e 74 20 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 20 3d 20 30 3b 00 00 00 0a 20 ......int.option_index.=.0;.....
ade0 20 20 20 69 6e 74 20 63 3b 00 00 00 1e 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 5f 61 ...int.c;........char.*between_a
ae00 72 67 73 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 63 20 20 20 20 77 68 69 6c 65 rgs.=.NULL;...........c....while
ae20 20 28 28 63 20 3d 20 67 65 74 6f 70 74 5f 6c 6f 6e 67 28 61 72 67 63 2c 20 61 72 67 76 2c 20 22 .((c.=.getopt_long(argc,.argv,."
ae40 79 3a 59 3a 6d 3a 6c 3a 6e 73 61 3a 62 3a 63 3a 68 22 2c 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 y:Y:m:l:nsa:b:c:h",.long_options
ae60 2c 20 26 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 29 29 20 21 3d 20 2d 31 29 20 7b 00 00 00 14 20 20 ,.&option_index)).!=.-1).{......
ae80 20 20 20 20 20 20 73 77 69 74 63 68 20 28 63 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 ......switch.(c).{..............
aea0 20 20 63 61 73 65 20 27 79 27 3a 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 ..case.'y':...$................y
aec0 65 61 72 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 ear.=.atoi(optarg);.............
aee0 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 .......break;................cas
af00 65 20 27 59 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 e.'Y':...#................show_y
af20 65 61 72 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ear_flag.=.1;...................
af40 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6d 27 3a .break;................case.'m':
af60 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 ...(................show_month_a
af80 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 rg.=.optarg;....................
afa0 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6c 27 3a 00 break;................case.'l':.
afc0 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 ..)................show_length_a
afe0 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 rg.=.optarg;....................
b000 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6e 27 3a 00 break;................case.'n':.
b020 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 31 3b ...................now_flag.=.1;
b040 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 ....................break;......
b060 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 73 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 ..........case.'s':...#.........
b080 20 20 20 20 20 20 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 .......stopwatch_flag.=.1;......
b0a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 ..............break;............
b0c0 20 20 20 20 63 61 73 65 20 27 61 27 3a 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ....case.'a':...,...............
b0e0 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 .add_days_val.=.atoi(optarg);...
b100 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 .................break;.........
b120 20 20 20 20 20 20 20 63 61 73 65 20 27 62 27 3a 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 .......case.'b':...&............
b140 20 20 20 20 62 65 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 ....between_args.=.optarg;......
b160 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 ..............break;............
b180 20 20 20 20 63 61 73 65 20 27 63 27 3a 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ....case.'c':...'...............
b1a0 20 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 .calendar_file.=.optarg;........
b1c0 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 ............break;..............
b1e0 20 20 63 61 73 65 20 27 68 27 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 ..case.'h':...%................p
b200 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 rint_usage(argv[0]);............
b220 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 14 20 20 20 20 20 20 20 20 20 20 20 ........return.0;...............
b240 20 64 65 66 61 75 6c 74 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 .default:...%................pri
b260 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 nt_usage(argv[0]);..............
b280 20 20 20 20 20 20 72 65 74 75 72 6e 20 31 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 ......return.1;............}....
b2a0 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 62 65 74 77 65 65 6e ....}................if.(between
b2c0 5f 61 72 67 73 29 20 7b 00 00 00 30 20 20 20 20 20 20 20 20 63 68 61 72 20 2a 73 70 61 63 65 20 _args).{...0........char.*space.
b2e0 3d 20 73 74 72 63 68 72 28 62 65 74 77 65 65 6e 5f 61 72 67 73 2c 20 27 20 27 29 3b 00 00 00 14 =.strchr(between_args,.'.');....
b300 20 20 20 20 20 20 20 20 69 66 20 28 73 70 61 63 65 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 ........if.(space).{............
b320 20 20 20 20 2a 73 70 61 63 65 20 3d 20 27 5c 30 27 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 ....*space.=.'\0';...$..........
b340 20 20 62 65 74 77 65 65 6e 31 20 3d 20 62 65 74 77 65 65 6e 5f 61 72 67 73 3b 00 00 00 21 20 20 ..between1.=.between_args;...!..
b360 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 32 20 3d 20 73 70 61 63 65 20 2b 20 31 3b 00 ..........between2.=.space.+.1;.
b380 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 ...........}........}...........
b3a0 36 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 6....calendar.cal.=.load_calenda
b3c0 72 28 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 2c 20 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 r(calendar_file,.year);.........
b3e0 00 00 19 20 20 20 20 69 66 20 28 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 17 .......if.(show_year_flag).{....
b400 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d ........show_year(cal);........}
b420 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 ........else.if.(show_month_arg)
b440 20 7b 00 00 00 35 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f .{...5........int.month.=.parse_
b460 6d 6f 6e 74 68 28 63 61 6c 2c 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 3b 00 00 00 1f 20 month(cal,.show_month_arg);.....
b480 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 29 3b 00 00 .......show_month(cal,.month);..
b4a0 00 05 20 20 20 20 7d 00 00 00 1f 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6c 65 6e ......}........else.if.(show_len
b4c0 67 74 68 5f 61 72 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 gth_arg).{............char.month
b4e0 5f 73 74 72 5b 32 30 5d 3b 00 00 00 10 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 _str[20];............int.day;...
b500 3a 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 2c :........sscanf(show_length_arg,
b520 20 22 25 73 20 25 64 22 2c 20 6d 6f 6e 74 68 5f 73 74 72 2c 20 26 64 61 79 29 3b 00 00 00 30 20 ."%s.%d",.month_str,.&day);...0.
b540 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 .......int.month.=.parse_month(c
b560 61 6c 2c 20 6d 6f 6e 74 68 5f 73 74 72 29 3b 00 00 00 29 20 20 20 20 20 20 20 20 73 68 6f 77 5f al,.month_str);...)........show_
b580 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 29 3b 00 00 00 05 day_length(cal,.month,.day);....
b5a0 20 20 20 20 7d 00 00 00 18 20 20 20 20 65 6c 73 65 20 69 66 20 28 6e 6f 77 5f 66 6c 61 67 29 20 ....}........else.if.(now_flag).
b5c0 7b 00 00 00 1f 20 20 20 20 20 20 20 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 {............show_current_time(c
b5e0 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 74 al);........}........else.if.(st
b600 6f 70 77 61 74 63 68 5f 66 6c 61 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 72 75 6e 5f 73 opwatch_flag).{............run_s
b620 74 6f 70 77 61 74 63 68 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 21 20 20 20 20 65 topwatch(cal);........}...!....e
b640 6c 73 65 20 69 66 20 28 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 21 3d 20 30 29 20 7b 00 00 00 24 lse.if.(add_days_val.!=.0).{...$
b660 20 20 20 20 20 20 20 20 61 64 64 5f 64 61 79 73 28 63 61 6c 2c 20 61 64 64 5f 64 61 79 73 5f 76 ........add_days(cal,.add_days_v
b680 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 24 20 20 20 20 65 6c 73 65 20 69 66 20 28 62 65 al);........}...$....else.if.(be
b6a0 74 77 65 65 6e 31 20 26 26 20 62 65 74 77 65 65 6e 32 29 20 7b 00 00 00 2e 20 20 20 20 20 20 20 tween1.&&.between2).{...........
b6c0 20 64 61 79 73 5f 62 65 74 77 65 65 6e 28 63 61 6c 2c 20 62 65 74 77 65 65 6e 31 2c 20 62 65 74 .days_between(cal,.between1,.bet
b6e0 77 65 65 6e 32 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0a 20 20 20 20 65 6c 73 65 20 7b 00 00 ween2);........}........else.{..
b700 00 1d 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 ..........print_usage(argv[0]);.
b720 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 .......}................return.0
b740 3b 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 28 01 00 00 00 00 00 00 01 00 ;....}5...............(.........
b760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 23 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 ..............F#..............5.
b780 5f d0 00 00 00 0a 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 0b 00 00 00 01 00 00 00 00 00 00 _...............................
b7a0 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b7c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b7e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b820 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b840 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b880 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b8a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b8c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b8e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b900 00 00 00 00 6a 00 3c ed 04 01 00 00 00 08 00 f5 18 00 00 00 fa 00 00 00 00 00 00 00 00 00 00 00 ....j.<.........................
b920 01 00 00 00 0f 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 f5 18 00 00 00 fb 00 00 00 00 00 00 .................cas............
b940 00 00 00 00 00 00 f5 18 00 00 00 82 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 20 20 20 20 20 ................................
b960 65 6c 73 65 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 31 29 20 70 72 69 6e f5 18 00 00 else.if.(days_ago.==.1).prin....
b980 00 83 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................................
b9a0 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 ......................5.........
b9c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
b9e0 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 82 00 00 00 20 00 00 00 00 00 00 00 ................................
ba00 00 00 00 00 78 00 00 00 0f 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 0f 00 00 ....x...........................
ba20 00 00 00 00 f5 18 00 00 00 00 fa 00 00 00 0f 00 00 00 00 00 00 00 00 00 00 00 3f 00 00 00 01 00 ..........................?.....
ba40 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1c 06 00 00 00 00 00 00 35 81 5f d0 00 00 ..........................5._...
ba60 00 0b 00 00 00 0d 00 00 00 00 00 00 00 00 00 00 00 0c 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ................................
ba80 ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
baa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bac0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bb00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bb20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bb40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bb60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bb80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bba0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bbc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
bbe0 6a 00 3d 97 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 3a 00 00 00 j.=.........................:...
bc00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 .#include.<stdio.h>....#include.
bc20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 <stdlib.h>....#include.<string.h
bc40 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 >....#include.<time.h>....#inclu
bc60 64 65 20 3c 67 65 74 6f 70 74 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 de.<getopt.h>........typedef.str
bc80 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 10 20 20 20 20 69 6e uct.{........int.year;........in
bca0 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 64 61 79 73 5f 70 65 72 5f 6d t.is_leap;........int.days_per_m
bcc0 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 6e 61 6d 65 onth[12];........char.month_name
bce0 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 61 72 3b 00 00 00 00 00 00 00 s[12][10];....}.calendar;.......
bd00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 6f 6e 73 74 20 63 68 8calendar.load_calendar(const.ch
bd20 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 29 20 7b 00 00 00 11 20 20 20 ar.*filename,.int.year).{.......
bd40 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 79 65 61 72 20 3d .calendar.cal;........cal.year.=
bd60 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 30 3b 00 00 .year;........cal.is_leap.=.0;..
bd80 00 8e 20 20 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 31 32 5d 20 3d 20 ......char.*default_names[12].=.
bda0 7b 22 6a 61 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 2c 22 6d 61 72 63 68 22 2c 22 61 {"january","february","march","a
bdc0 70 72 69 6c 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a 75 6c 79 22 2c 22 61 75 67 75 73 pril","may","june","july","augus
bde0 74 22 2c 22 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 65 72 22 2c 22 6e 6f 76 65 6d 62 t","september","october","novemb
be00 65 72 22 2c 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 er","december"};..."....for.(int
be20 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 35 20 20 20 20 20 20 .i.=.0;.i.<.12;.i++).{...5......
be40 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 64 65 66 ..strcpy(cal.month_names[i],.def
be60 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 69 66 20 28 69 ault_names[i]);.../........if.(i
be80 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 32 .==.1).cal.days_per_month[i].=.2
bea0 38 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 33 20 7c 7c 8;...S........else.if.(i.==.3.||
bec0 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d 20 31 30 29 20 63 61 .i.==.5.||.i.==.8.||.i.==.10).ca
bee0 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b 00 00 00 28 20 20 20 l.days_per_month[i].=.30;...(...
bf00 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 .....else.cal.days_per_month[i].
bf20 3d 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 20 3d 20 =.31;........}...#....FILE.*f.=.
bf40 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 20 20 20 20 69 66 20 fopen(filename,."r");........if.
bf60 28 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 20 63 68 61 72 20 6c 69 6e (!f).return.cal;........char.lin
bf80 65 5b 35 31 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c 69 6e 65 e[512];...*....while.(fgets(line
bfa0 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 00 2d 20 20 20 20 20 20 20 ,.sizeof(line),.f)).{...-.......
bfc0 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 22 2c 20 35 29 20 3d .if.(strncmp(line,."year:",.5).=
bfe0 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 3b 00 00 00 29 =.0).{................int.y;...)
c000 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 20 ............sscanf(line,."year:.
c020 25 64 22 2c 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 20 21 %d",.&y);...$............if.(y.!
c040 3d 20 79 65 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 =.year).continue;............}..
c060 00 2e 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6d 6f 6e ..........if.(strncmp(line,."mon
c080 74 68 3a 22 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 th:",.6).==.0).{................
c0a0 69 6e 74 20 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 6e 61 int.m,.d;................char.na
c0c0 6d 65 5b 32 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 me[20];...F............sscanf(li
c0e0 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 25 64 20 6e 61 6d 65 3a 20 25 73 ne,."month:.%d.days:.%d.name:.%s
c100 22 2c 20 26 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 ",.&m,.&d,.name);...$...........
c120 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 7b 00 00 00 2c 20 20 20 .if.(m.>=.1.&&.m.<=.12).{...,...
c140 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b .............cal.days_per_month[
c160 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 72 m-1].=.d;...3................str
c180 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 2d 31 5d 2c 20 6e 61 6d 65 29 3b cpy(cal.month_names[m-1],.name);
c1a0 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 ................}............}..
c1c0 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6c 65 61 .-........if.(strncmp(line,."lea
c1e0 70 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 p:",.5).==.0).{................i
c200 6e 74 20 6c 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 nt.l;...)............sscanf(line
c220 2c 20 22 6c 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 32 20 20 20 20 20 20 20 20 20 20 ,."leap:.%d",.&l);...2..........
c240 20 20 69 66 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 20 63 61 6c 2e 69 73 5f 6c ..if.(year.==.cal.year).cal.is_l
c260 65 61 70 20 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 eap.=.l;............}........}..
c280 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 20 20 20 72 65 74 75 72 6e 20 63 ......fclose(f);........return.c
c2a0 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2c 69 6e 74 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 al;....}.......,int.parse_month(
c2c0 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 69 6e 70 75 74 29 20 7b 00 00 00 22 calendar.cal,.char.*input).{..."
c2e0 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 ....for.(int.i.=.0;.i.<.12;.i++)
c300 20 7b 00 00 00 41 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d 70 28 69 6e 70 75 74 2c 20 .{...A........if.(strcmp(input,.
c320 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 72 65 74 75 72 6e cal.month_names[i]).==.0).return
c340 20 69 20 2b 20 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 20 72 65 74 75 72 6e 20 61 .i.+.1;........}........return.a
c360 74 6f 69 28 69 6e 70 75 74 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3b 69 6e 74 20 64 61 74 65 toi(input);....}.......;int.date
c380 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e _to_day_of_year(calendar.cal,.in
c3a0 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 18 20 20 20 20 69 6e 74 20 64 t.month,.int.day).{........int.d
c3c0 61 79 5f 6f 66 5f 79 65 61 72 20 3d 20 30 3b 00 00 00 29 20 20 20 20 66 6f 72 20 28 69 6e 74 20 ay_of_year.=.0;...)....for.(int.
c3e0 69 20 3d 20 30 3b 20 69 20 3c 20 6d 6f 6e 74 68 20 2d 20 31 3b 20 69 2b 2b 29 20 7b 00 00 00 2d i.=.0;.i.<.month.-.1;.i++).{...-
c400 20 20 20 20 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f ........day_of_year.+=.cal.days_
c420 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 20 64 61 per_month[i];........}........da
c440 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 64 61 79 3b 00 00 00 17 20 20 20 20 72 65 74 75 72 6e 20 y_of_year.+=.day;........return.
c460 64 61 79 5f 6f 66 5f 79 65 61 72 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 73 68 day_of_year;....}........void.sh
c480 6f 77 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 22 20 20 20 20 70 ow_year(calendar.cal).{..."....p
c4a0 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 rintf("year.%d\n",.cal.year);...
c4c0 2b 20 20 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 29 20 70 72 69 6e 74 66 28 22 6c 65 +....if.(cal.is_leap).printf("le
c4e0 61 70 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d ap.year\n");..."....for.(int.i.=
c500 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 45 20 20 20 20 20 20 20 20 70 72 .0;.i.<.12;.i++).{...E........pr
c520 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b intf("%s.%d\n",.cal.month_names[
c540 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 i],.cal.days_per_month[i]);.....
c560 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 2a 76 6f 69 64 20 73 68 6f 77 5f 6d 6f 6e 74 68 ...}....}.......*void.show_month
c580 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 29 20 7b 00 00 00 22 20 (calendar.cal,.int.month).{...".
c5a0 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 20 3e 20 31 32 29 20 ...if.(month.<.1.||.month.>.12).
c5c0 7b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 6d 6f 6e {..."........printf("invalid.mon
c5e0 74 68 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 th\n");............return;......
c600 20 20 7d 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c ..}...:....printf("%s.%d\n",.cal
c620 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 63 61 6c 2e 79 65 61 72 29 .month_names[month-1],.cal.year)
c640 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 20 6d 6f 20 74 75 20 77 65 20 74 68 20 ;...%....printf("su.mo.tu.we.th.
c660 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 17 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 74 6d 20 3d fr.sa\n");........struct.tm.tm.=
c680 20 7b 30 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 .{0};...!....tm.tm_year.=.cal.ye
c6a0 61 72 20 2d 20 31 39 30 30 3b 00 00 00 1a 20 20 20 20 74 6d 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f ar.-.1900;........tm.tm_mon.=.mo
c6c0 6e 74 68 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e 74 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 nth.-.1;........tm.tm_mday.=.1;.
c6e0 00 00 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b 00 00 00 1f 20 20 20 20 69 6e 74 20 66 .......mktime(&tm);........int.f
c700 69 72 73 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 79 3b 00 00 00 36 20 20 20 20 66 6f irst_day.=.tm.tm_wday;...6....fo
c720 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 72 73 74 5f 64 61 79 3b 20 69 2b 2b r.(int.i.=.0;.i.<.first_day;.i++
c740 29 20 70 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 3c 20 20 20 20 66 6f 72 20 28 69 6e 74 ).printf("...");...<....for.(int
c760 20 64 20 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b .d.=.1;.d.<=.cal.days_per_month[
c780 6d 6f 6e 74 68 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 70 72 69 6e month-1];.d++).{............prin
c7a0 74 66 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 20 20 20 20 20 20 20 69 66 20 28 28 66 tf("%2d.",.d);...3........if.((f
c7c0 69 72 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 irst_day.+.d).%.7.==.0).printf("
c7e0 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e \n");........}........printf("\n
c800 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 38 76 6f 69 64 20 73 68 6f 77 5f 64 61 79 5f 6c 65 ");....}.......8void.show_day_le
c820 6e 67 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e ngth(calendar.cal,.int.month,.in
c840 74 20 64 61 79 29 20 7b 00 00 00 52 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c t.day).{...R....if.(month.<.1.||
c860 20 6d 6f 6e 74 68 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 20 7c 7c 20 64 61 79 20 3e 20 .month.>.12.||.day.<.1.||.day.>.
c880 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 5d 29 20 7b 00 00 cal.days_per_month[month-1]).{..
c8a0 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 64 61 74 65 5c 6e .!........printf("invalid.date\n
c8c0 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 ");............return;........}.
c8e0 00 00 04 20 20 20 20 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 6e 6f 77 5f 74 20 3d 20 74 69 ...............time_t.now_t.=.ti
c900 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2a 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6e 6f 77 5f me(NULL);...*....struct.tm.*now_
c920 74 6d 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 6e 6f 77 5f 74 29 3b 00 00 00 2e 20 20 20 20 69 tm.=.localtime(&now_t);........i
c940 6e 74 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 79 65 61 nt.current_year.=.now_tm->tm_yea
c960 72 20 2b 20 31 39 30 30 3b 00 00 00 2b 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 6d 6f 6e r.+.1900;...+....int.current_mon
c980 74 68 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 26 20 20 20 20 th.=.now_tm->tm_mon.+.1;...&....
c9a0 69 6e 74 20 63 75 72 72 65 6e 74 5f 64 61 79 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 64 61 int.current_day.=.now_tm->tm_mda
c9c0 79 3b 00 00 00 04 20 20 20 20 00 00 00 47 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 72 65 y;...........G....calendar.curre
c9e0 6e 74 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 nt_cal.=.load_calendar("calendar
ca00 2e 74 78 74 22 2c 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 .txt",.current_year);...........
ca20 3a 20 20 20 20 69 6e 74 20 74 61 72 67 65 74 5f 64 6f 79 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 :....int.target_doy.=.date_to_da
ca40 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 29 3b 00 00 00 53 20 y_of_year(cal,.month,.day);...S.
ca60 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 64 6f 79 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 79 ...int.current_doy.=.date_to_day
ca80 5f 6f 66 5f 79 65 61 72 28 63 75 72 72 65 6e 74 5f 63 61 6c 2c 20 63 75 72 72 65 6e 74 5f 6d 6f _of_year(current_cal,.current_mo
caa0 6e 74 68 2c 20 63 75 72 72 65 6e 74 5f 64 61 79 29 3b 00 00 00 04 20 20 20 20 00 00 00 15 20 20 nth,.current_day);..............
cac0 20 20 69 6e 74 20 64 61 79 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 23 20 20 20 20 69 66 20 28 63 ..int.days_ago.=.0;...#....if.(c
cae0 75 72 72 65 6e 74 5f 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 20 7b 00 00 00 2c 20 20 urrent_year.==.cal.year).{...,..
cb00 20 20 20 20 20 20 64 61 79 73 5f 61 67 6f 20 3d 20 63 75 72 72 65 6e 74 5f 64 6f 79 20 2d 20 74 ......days_ago.=.current_doy.-.t
cb20 61 72 67 65 74 5f 64 6f 79 3b 00 00 00 34 20 20 20 20 20 20 20 20 69 66 20 28 64 61 79 73 5f 61 arget_doy;...4........if.(days_a
cb40 67 6f 20 3c 20 30 29 20 64 61 79 73 5f 61 67 6f 20 3d 20 33 36 35 20 2b 20 64 61 79 73 5f 61 67 go.<.0).days_ago.=.365.+.days_ag
cb60 6f 3b 00 00 00 29 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 63 75 72 72 65 6e 74 5f 79 65 61 o;...)....}.else.if.(current_yea
cb80 72 20 3e 20 63 61 6c 2e 79 65 61 72 29 20 7b 00 00 00 34 20 20 20 20 20 20 20 20 69 6e 74 20 64 r.>.cal.year).{...4........int.d
cba0 61 79 73 5f 69 6e 5f 74 61 72 67 65 74 5f 79 65 61 72 20 3d 20 33 36 35 20 2b 20 63 61 6c 2e 69 ays_in_target_year.=.365.+.cal.i
cbc0 73 5f 6c 65 61 70 3b 00 00 00 44 20 20 20 20 20 20 20 20 64 61 79 73 5f 61 67 6f 20 3d 20 28 64 s_leap;...D........days_ago.=.(d
cbe0 61 79 73 5f 69 6e 5f 74 61 72 67 65 74 5f 79 65 61 72 20 2d 20 74 61 72 67 65 74 5f 64 6f 79 29 ays_in_target_year.-.target_doy)
cc00 20 2b 20 63 75 72 72 65 6e 74 5f 64 6f 79 3b 00 00 00 3b 20 20 20 20 20 20 20 20 66 6f 72 20 28 .+.current_doy;...;........for.(
cc20 69 6e 74 20 79 20 3d 20 63 61 6c 2e 79 65 61 72 20 2b 20 31 3b 20 79 20 3c 20 63 75 72 72 65 6e int.y.=.cal.year.+.1;.y.<.curren
cc40 74 5f 79 65 61 72 3b 20 79 2b 2b 29 20 7b 00 00 00 3d 20 20 20 20 20 20 20 20 20 20 20 20 63 61 t_year;.y++).{...=............ca
cc60 6c 65 6e 64 61 72 20 79 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c lendar.ycal.=.load_calendar("cal
cc80 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 2b 20 20 20 20 20 20 20 20 20 20 20 20 64 endar.txt",.y);...+............d
cca0 61 79 73 5f 61 67 6f 20 2b 3d 20 33 36 35 20 2b 20 79 63 61 6c 2e 69 73 5f 6c 65 61 70 3b 00 00 ays_ago.+=.365.+.ycal.is_leap;..
ccc0 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 00 16 20 ..........}........}.else.{.....
cce0 20 20 20 20 20 20 20 64 61 79 73 5f 61 67 6f 20 3d 20 2d 31 3b 00 00 00 05 20 20 20 20 7d 00 00 .......days_ago.=.-1;........}..
cd00 00 04 20 20 20 20 00 00 00 52 20 20 20 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 30 29 .........R....if.(days_ago.==.0)
cd20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 74 6f 64 61 79 5c 6e 22 2c 20 63 61 6c .printf("%s.%d.was.today\n",.cal
cd40 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 5b .month_names[month-1],.day);...[
cd60 20 20 20 20 65 6c 73 65 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 31 29 20 70 72 69 6e ....else.if.(days_ago.==.1).prin
cd80 74 66 28 22 25 73 20 25 64 20 77 61 73 20 79 65 73 74 65 72 64 61 79 5c 6e 22 2c 20 63 61 6c 2e tf("%s.%d.was.yesterday\n",.cal.
cda0 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 54 20 month_names[month-1],.day);...T.
cdc0 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 ...else.printf("%s.%d.was.%d.day
cde0 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d s.ago\n",.cal.month_names[month-
ce00 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 26 1],.day,.days_ago);....}.......&
ce20 76 6f 69 64 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 65 6e 64 61 72 20 void.show_current_time(calendar.
ce40 63 61 6c 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 cal).{........time_t.t.=.time(NU
ce60 4c 4c 29 3b 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c LL);...%....struct.tm.*local.=.l
ce80 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 25 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 ocaltime(&t);...%....int.year.=.
cea0 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 22 20 20 20 20 69 6e local->tm_year.+.1900;..."....in
cec0 74 20 6d 6f 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1d t.month.=.local->tm_mon.+.1;....
cee0 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 ....int.day.=.local->tm_mday;...
cf00 1e 20 20 20 20 69 6e 74 20 68 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 .....int.hour.=.local->tm_hour;.
cf20 00 00 1f 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 .......int.minute.=.local->tm_mi
cf40 6e 3b 00 00 00 1f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d n;........int.second.=.local->tm
cf60 5f 73 65 63 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 5f 63 61 6c 20 3d 20 _sec;...;....calendar.cur_cal.=.
cf80 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 load_calendar("calendar.txt",.ye
cfa0 61 72 29 3b 00 00 00 67 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 25 73 20 25 64 20 25 30 32 ar);...g....printf("%d.%s.%d.%02
cfc0 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 79 65 61 72 2c 20 63 75 72 5f 63 61 6c 2e 6d 6f d:%02d:%02d\n",.year,.cur_cal.mo
cfe0 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 68 6f 75 72 2c 20 6d nth_names[month-1],.day,.hour,.m
d000 69 6e 75 74 65 2c 20 73 65 63 6f 6e 64 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 inute,.second);....}......."void
d020 20 72 75 6e 5f 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 .run_stopwatch(calendar.cal).{..
d040 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 61 .%....printf("press.enter.to.sta
d060 72 74 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1e 20 20 20 rt\n");........getchar();.......
d080 20 74 69 6d 65 5f 74 20 73 74 61 72 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2c 20 .time_t.start.=.time(NULL);...,.
d0a0 20 20 20 70 72 69 6e 74 66 28 22 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 ...printf("running.press.enter.t
d0c0 6f 20 73 74 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 o.stop\n");........getchar();...
d0e0 1c 20 20 20 20 74 69 6d 65 5f 74 20 65 6e 64 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 .....time_t.end.=.time(NULL);...
d100 1c 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 20 2d 20 73 74 61 72 74 3b 00 00 00 .....long.diff.=.end.-.start;...
d120 1c 20 20 20 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 .....int.hours.=.diff./.3600;...
d140 25 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 %....int.minutes.=.(diff.%.3600)
d160 20 2f 20 36 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 ./.60;........int.seconds.=.diff
d180 20 25 20 36 30 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 32 64 3a 25 30 32 64 3a .%.60;...8....printf("%02d:%02d:
d1a0 25 30 32 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 %02d\n",.hours,.minutes,.seconds
d1c0 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 27 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 6c );....}.......'void.add_days(cal
d1e0 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 64 61 79 73 29 20 7b 00 00 00 1a 20 20 20 20 74 69 endar.cal,.int.days).{........ti
d200 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 16 20 20 20 20 74 20 2b 3d me_t.t.=.time(NULL);........t.+=
d220 20 64 61 79 73 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 .days.*.86400;...&....struct.tm.
d240 2a 66 75 74 75 72 65 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 26 20 20 20 20 *future.=.localtime(&t);...&....
d260 69 6e 74 20 79 65 61 72 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 int.year.=.future->tm_year.+.190
d280 30 3b 00 00 00 23 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 0;...#....int.month.=.future->tm
d2a0 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1e 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 66 75 74 75 72 _mon.+.1;........int.day.=.futur
d2c0 65 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 66 75 74 5f e->tm_mday;...;....calendar.fut_
d2e0 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 cal.=.load_calendar("calendar.tx
d300 74 22 2c 20 79 65 61 72 29 3b 00 00 00 5c 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 64 61 79 t",.year);...\....printf("%d.day
d320 73 20 66 72 6f 6d 20 6e 6f 77 20 69 73 20 25 64 20 25 73 20 25 64 5c 6e 22 2c 20 64 61 79 73 2c s.from.now.is.%d.%s.%d\n",.days,
d340 20 79 65 61 72 2c 20 66 75 74 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 .year,.fut_cal.month_names[month
d360 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3b 76 6f 69 64 20 64 61 79 73 -1],.day);....}.......;void.days
d380 5f 62 65 74 77 65 65 6e 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 64 61 74 _between(calendar.cal,.char.*dat
d3a0 65 31 2c 20 63 68 61 72 20 2a 64 61 74 65 32 29 20 7b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 31 e1,.char.*date2).{........int.y1
d3c0 2c 6d 31 2c 64 31 2c 79 32 2c 6d 32 2c 64 32 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 ,m1,d1,y2,m2,d2;...-....sscanf(d
d3e0 61 74 65 31 2c 20 22 25 64 2d 25 64 2d 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c 20 26 64 31 29 ate1,."%d-%d-%d",.&y1,.&m1,.&d1)
d400 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 61 74 65 32 2c 20 22 25 64 2d 25 64 2d 25 64 ;...-....sscanf(date2,."%d-%d-%d
d420 22 2c 20 26 79 32 2c 20 26 6d 32 2c 20 26 64 32 29 3b 00 00 00 23 20 20 20 20 73 74 72 75 63 74 ",.&y2,.&m2,.&d2);...#....struct
d440 20 74 6d 20 74 6d 31 20 3d 20 7b 30 7d 2c 20 74 6d 32 20 3d 20 7b 30 7d 3b 00 00 00 1c 20 20 20 .tm.tm1.=.{0},.tm2.=.{0};.......
d460 20 74 6d 31 2e 74 6d 5f 79 65 61 72 20 3d 20 79 31 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 .tm1.tm_year.=.y1.-.1900;.......
d480 20 74 6d 31 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 31 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 31 .tm1.tm_mon.=.m1.-.1;........tm1
d4a0 2e 74 6d 5f 6d 64 61 79 20 3d 20 64 31 3b 00 00 00 1c 20 20 20 20 74 6d 32 2e 74 6d 5f 79 65 61 .tm_mday.=.d1;........tm2.tm_yea
d4c0 72 20 3d 20 79 32 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 6f 6e r.=.y2.-.1900;........tm2.tm_mon
d4e0 20 3d 20 6d 32 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 64 61 79 20 3d 20 .=.m2.-.1;........tm2.tm_mday.=.
d500 64 32 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 31 20 3d 20 6d 6b 74 69 6d 65 d2;........time_t.time1.=.mktime
d520 28 26 74 6d 31 29 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 32 20 3d 20 6d 6b (&tm1);........time_t.time2.=.mk
d540 74 69 6d 65 28 26 74 6d 32 29 3b 00 00 00 28 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 28 time(&tm2);...(....long.diff.=.(
d560 74 69 6d 65 32 20 2d 20 74 69 6d 65 31 29 20 2f 20 38 36 34 30 30 3b 00 00 00 1f 20 20 20 20 69 time2.-.time1)./.86400;........i
d580 66 20 28 64 69 66 66 20 3c 20 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 00 00 2a 20 20 f.(diff.<.0).diff.=.-diff;...*..
d5a0 20 20 70 72 69 6e 74 66 28 22 64 69 66 66 65 72 65 6e 63 65 20 25 6c 64 20 64 61 79 73 5c 6e 22 ..printf("difference.%ld.days\n"
d5c0 2c 20 64 69 66 66 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 70 72 69 6e 74 5f ,.diff);....}........void.print_
d5e0 75 73 61 67 65 28 63 68 61 72 20 2a 70 72 6f 67 29 20 7b 00 00 00 29 20 20 20 20 70 72 69 6e 74 usage(char.*prog).{...)....print
d600 66 28 22 75 73 61 67 65 20 25 73 20 5b 6f 70 74 69 6f 6e 73 5d 5c 6e 22 2c 20 70 72 6f 67 29 3b f("usage.%s.[options]\n",.prog);
d620 00 00 00 33 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 79 65 61 72 20 59 59 59 59 20 20 20 20 20 ...3....printf("--year.YYYY.....
d640 20 20 20 20 20 20 20 20 20 20 73 65 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 49 20 20 20 20 70 ..........set.year\n");...I....p
d660 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 79 65 61 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 rintf("--show-year..............
d680 20 73 68 6f 77 20 63 61 6c 65 6e 64 61 72 20 66 6f 72 20 63 75 72 72 65 6e 74 20 79 65 61 72 5c .show.calendar.for.current.year\
d6a0 6e 22 29 3b 00 00 00 35 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6d 6f 6e 74 68 n");...5....printf("--show-month
d6c0 20 4d 4d 20 6f 72 20 6e 61 6d 65 20 20 20 73 68 6f 77 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 .MM.or.name...show.month\n");...
d6e0 4c 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 6d 6f 6e L....printf("--show-length.\"mon
d700 74 68 20 64 61 79 5c 22 20 73 68 6f 77 20 68 6f 77 20 6c 6f 6e 67 20 61 67 6f 20 74 68 61 74 20 th.day\".show.how.long.ago.that.
d720 64 61 74 65 20 77 61 73 5c 6e 22 29 3b 00 00 00 3c 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 6e date.was\n");...<....printf("--n
d740 6f 77 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 63 75 72 72 ow.....................show.curr
d760 65 6e 74 20 74 69 6d 65 5c 6e 22 29 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 ent.time\n");...8....printf("--s
d780 74 6f 70 77 61 74 63 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 75 6e 20 73 74 6f 70 77 topwatch...............run.stopw
d7a0 61 74 63 68 5c 6e 22 29 3b 00 00 00 3e 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 61 64 64 2d 64 atch\n");...>....printf("--add-d
d7c0 61 79 73 20 4e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 20 4e 20 64 61 79 73 20 74 6f ays.N..............add.N.days.to
d7e0 20 74 6f 64 61 79 5c 6e 22 29 3b 00 00 00 47 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 62 65 74 .today\n");...G....printf("--bet
d800 77 65 65 6e 20 59 59 59 59 2d 4d 4d 2d 44 44 20 59 59 59 59 2d 4d 4d 2d 44 44 20 64 61 79 73 20 ween.YYYY-MM-DD.YYYY-MM-DD.days.
d820 62 65 74 77 65 65 6e 20 74 77 6f 20 64 61 74 65 73 5c 6e 22 29 3b 00 00 00 43 20 20 20 20 70 72 between.two.dates\n");...C....pr
d840 69 6e 74 66 28 22 2d 2d 63 61 6c 65 6e 64 61 72 2d 66 69 6c 65 20 46 49 4c 45 20 20 20 20 20 20 intf("--calendar-file.FILE......
d860 75 73 65 20 63 75 73 74 6f 6d 20 63 61 6c 65 6e 64 61 72 20 66 69 6c 65 5c 6e 22 29 3b 00 00 00 use.custom.calendar.file\n");...
d880 01 7d 00 00 00 00 00 00 00 21 69 6e 74 20 6d 61 69 6e 28 69 6e 74 20 61 72 67 63 2c 20 63 68 61 .}.......!int.main(int.argc,.cha
d8a0 72 20 2a 2a 61 72 67 76 29 20 7b 00 00 00 14 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 32 30 r.**argv).{........int.year.=.20
d8c0 32 36 3b 00 00 00 29 20 20 20 20 63 68 61 72 20 2a 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 26;...)....char.*calendar_file.=
d8e0 20 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 73 68 6f 77 ."calendar.txt";........int.show
d900 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 20 20 20 20 20 63 68 61 72 20 2a 73 68 6f _year_flag.=.0;........char.*sho
d920 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 21 20 20 20 20 63 68 61 72 20 w_month_arg.=.NULL;...!....char.
d940 2a 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 15 20 20 20 20 *show_length_arg.=.NULL;........
d960 69 6e 74 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 73 74 6f int.now_flag.=.0;........int.sto
d980 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 19 20 20 20 20 69 6e 74 20 61 64 64 5f pwatch_flag.=.0;........int.add_
d9a0 64 61 79 73 5f 76 61 6c 20 3d 20 30 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 days_val.=.0;........char.*betwe
d9c0 65 6e 31 20 3d 20 4e 55 4c 4c 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e en1.=.NULL;........char.*between
d9e0 32 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 2b 20 20 20 20 73 74 61 74 69 63 20 2.=.NULL;...........+....static.
da00 73 74 72 75 63 74 20 6f 70 74 69 6f 6e 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 5b 5d 20 3d 20 7b struct.option.long_options[].=.{
da20 00 00 00 2c 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 ...,........{"year",.required_ar
da40 67 75 6d 65 6e 74 2c 20 30 2c 20 27 79 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 20 7b 22 73 68 gument,.0,.'y'},...+........{"sh
da60 6f 77 2d 79 65 61 72 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 59 27 7d 2c 00 ow-year",.no_argument,.0,.'Y'},.
da80 00 00 32 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6d 6f 6e 74 68 22 2c 20 72 65 71 75 69 72 ..2........{"show-month",.requir
daa0 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6d 27 7d 2c 00 00 00 33 20 20 20 20 20 20 20 ed_argument,.0,.'m'},...3.......
dac0 20 7b 22 73 68 6f 77 2d 6c 65 6e 67 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 .{"show-length",.required_argume
dae0 6e 74 2c 20 30 2c 20 27 6c 27 7d 2c 00 00 00 25 20 20 20 20 20 20 20 20 7b 22 6e 6f 77 22 2c 20 nt,.0,.'l'},...%........{"now",.
db00 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6e 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 no_argument,.0,.'n'},...+.......
db20 20 7b 22 73 74 6f 70 77 61 74 63 68 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 .{"stopwatch",.no_argument,.0,.'
db40 73 27 7d 2c 00 00 00 30 20 20 20 20 20 20 20 20 7b 22 61 64 64 2d 64 61 79 73 22 2c 20 72 65 71 s'},...0........{"add-days",.req
db60 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 61 27 7d 2c 00 00 00 2f 20 20 20 20 uired_argument,.0,.'a'},.../....
db80 20 20 20 20 7b 22 62 65 74 77 65 65 6e 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e ....{"between",.required_argumen
dba0 74 2c 20 30 2c 20 27 62 27 7d 2c 00 00 00 35 20 20 20 20 20 20 20 20 7b 22 63 61 6c 65 6e 64 61 t,.0,.'b'},...5........{"calenda
dbc0 72 2d 66 69 6c 65 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 r-file",.required_argument,.0,.'
dbe0 63 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 68 65 6c 70 22 2c 20 6e 6f 5f 61 72 67 75 c'},...&........{"help",.no_argu
dc00 6d 65 6e 74 2c 20 30 2c 20 27 68 27 7d 2c 00 00 00 14 20 20 20 20 20 20 20 20 7b 30 2c 20 30 2c ment,.0,.'h'},............{0,.0,
dc20 20 30 2c 20 30 7d 00 00 00 06 20 20 20 20 7d 3b 00 00 00 04 20 20 20 20 00 00 00 19 20 20 20 20 .0,.0}........};................
dc40 69 6e 74 20 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 20 3d 20 30 3b 00 00 00 0a 20 20 20 20 69 6e 74 int.option_index.=.0;........int
dc60 20 63 3b 00 00 00 1e 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 .c;........char.*between_args.=.
dc80 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 63 20 20 20 20 77 68 69 6c 65 20 28 28 63 20 3d NULL;...........c....while.((c.=
dca0 20 67 65 74 6f 70 74 5f 6c 6f 6e 67 28 61 72 67 63 2c 20 61 72 67 76 2c 20 22 79 3a 59 3a 6d 3a .getopt_long(argc,.argv,."y:Y:m:
dcc0 6c 3a 6e 73 61 3a 62 3a 63 3a 68 22 2c 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 2c 20 26 6f 70 74 l:nsa:b:c:h",.long_options,.&opt
dce0 69 6f 6e 5f 69 6e 64 65 78 29 29 20 21 3d 20 2d 31 29 20 7b 00 00 00 14 20 20 20 20 20 20 20 20 ion_index)).!=.-1).{............
dd00 73 77 69 74 63 68 20 28 63 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 switch.(c).{................case
dd20 20 27 79 27 3a 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 65 61 72 20 3d 20 .'y':...$................year.=.
dd40 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 atoi(optarg);...................
dd60 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 59 27 3a .break;................case.'Y':
dd80 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c ...#................show_year_fl
dda0 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b ag.=.1;....................break
ddc0 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6d 27 3a 00 00 00 28 20 20 ;................case.'m':...(..
dde0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 6f ..............show_month_arg.=.o
de00 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b ptarg;....................break;
de20 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6c 27 3a 00 00 00 29 20 20 20 ................case.'l':...)...
de40 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 6f .............show_length_arg.=.o
de60 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b ptarg;....................break;
de80 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6e 27 3a 00 00 00 1d 20 20 20 ................case.'n':.......
dea0 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 .............now_flag.=.1;......
dec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 ..............break;............
dee0 20 20 20 20 63 61 73 65 20 27 73 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ....case.'s':...#...............
df00 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 .stopwatch_flag.=.1;............
df20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 ........break;................ca
df40 73 65 20 27 61 27 3a 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 5f 64 se.'a':...,................add_d
df60 61 79 73 5f 76 61 6c 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 20 ays_val.=.atoi(optarg);.........
df80 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 ...........break;...............
dfa0 20 63 61 73 65 20 27 62 27 3a 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 65 .case.'b':...&................be
dfc0 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 tween_args.=.optarg;............
dfe0 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 ........break;................ca
e000 73 65 20 27 63 27 3a 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 65 6e se.'c':...'................calen
e020 64 61 72 5f 66 69 6c 65 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 dar_file.=.optarg;..............
e040 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 ......break;................case
e060 20 27 68 27 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 .'h':...%................print_u
e080 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 sage(argv[0]);..................
e0a0 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 14 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 ..return.0;................defau
e0c0 6c 74 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 lt:...%................print_usa
e0e0 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ge(argv[0]);....................
e100 72 65 74 75 72 6e 20 31 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 return.1;............}........}.
e120 00 00 04 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 62 65 74 77 65 65 6e 5f 61 72 67 73 29 ...............if.(between_args)
e140 20 7b 00 00 00 30 20 20 20 20 20 20 20 20 63 68 61 72 20 2a 73 70 61 63 65 20 3d 20 73 74 72 63 .{...0........char.*space.=.strc
e160 68 72 28 62 65 74 77 65 65 6e 5f 61 72 67 73 2c 20 27 20 27 29 3b 00 00 00 14 20 20 20 20 20 20 hr(between_args,.'.');..........
e180 20 20 69 66 20 28 73 70 61 63 65 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 2a 73 ..if.(space).{................*s
e1a0 70 61 63 65 20 3d 20 27 5c 30 27 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 pace.=.'\0';...$............betw
e1c0 65 65 6e 31 20 3d 20 62 65 74 77 65 65 6e 5f 61 72 67 73 3b 00 00 00 21 20 20 20 20 20 20 20 20 een1.=.between_args;...!........
e1e0 20 20 20 20 62 65 74 77 65 65 6e 32 20 3d 20 73 70 61 63 65 20 2b 20 31 3b 00 00 00 09 20 20 20 ....between2.=.space.+.1;.......
e200 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 36 20 20 20 20 63 .....}........}...........6....c
e220 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 alendar.cal.=.load_calendar(cale
e240 6e 64 61 72 5f 66 69 6c 65 2c 20 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 19 20 20 20 ndar_file,.year);...............
e260 20 69 66 20 28 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 17 20 20 20 20 20 20 .if.(show_year_flag).{..........
e280 20 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 ..show_year(cal);........}......
e2a0 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 20 7b 00 00 00 35 ..else.if.(show_month_arg).{...5
e2c0 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 ........int.month.=.parse_month(
e2e0 63 61 6c 2c 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 3b 00 00 00 1f 20 20 20 20 20 20 20 cal,.show_month_arg);...........
e300 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 29 3b 00 00 00 05 20 20 20 20 .show_month(cal,.month);........
e320 7d 00 00 00 1f 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 }........else.if.(show_length_ar
e340 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 73 74 72 5b 32 g).{............char.month_str[2
e360 30 5d 3b 00 00 00 10 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 3a 20 20 20 20 20 0];............int.day;...:.....
e380 20 20 20 73 73 63 61 6e 66 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 2c 20 22 25 73 20 25 ...sscanf(show_length_arg,."%s.%
e3a0 64 22 2c 20 6d 6f 6e 74 68 5f 73 74 72 2c 20 26 64 61 79 29 3b 00 00 00 30 20 20 20 20 20 20 20 d",.month_str,.&day);...0.......
e3c0 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f .int.month.=.parse_month(cal,.mo
e3e0 6e 74 68 5f 73 74 72 29 3b 00 00 00 29 20 20 20 20 20 20 20 20 73 68 6f 77 5f 64 61 79 5f 6c 65 nth_str);...)........show_day_le
e400 6e 67 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 29 3b 00 00 00 05 20 20 20 20 7d 00 ngth(cal,.month,.day);........}.
e420 00 00 18 20 20 20 20 65 6c 73 65 20 69 66 20 28 6e 6f 77 5f 66 6c 61 67 29 20 7b 00 00 00 1f 20 .......else.if.(now_flag).{.....
e440 20 20 20 20 20 20 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 29 3b 00 00 .......show_current_time(cal);..
e460 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 74 6f 70 77 61 74 63 ......}........else.if.(stopwatc
e480 68 5f 66 6c 61 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 72 75 6e 5f 73 74 6f 70 77 61 74 h_flag).{............run_stopwat
e4a0 63 68 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 21 20 20 20 20 65 6c 73 65 20 69 66 ch(cal);........}...!....else.if
e4c0 20 28 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 21 3d 20 30 29 20 7b 00 00 00 24 20 20 20 20 20 20 .(add_days_val.!=.0).{...$......
e4e0 20 20 61 64 64 5f 64 61 79 73 28 63 61 6c 2c 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 29 3b 00 00 ..add_days(cal,.add_days_val);..
e500 00 05 20 20 20 20 7d 00 00 00 24 20 20 20 20 65 6c 73 65 20 69 66 20 28 62 65 74 77 65 65 6e 31 ......}...$....else.if.(between1
e520 20 26 26 20 62 65 74 77 65 65 6e 32 29 20 7b 00 00 00 2e 20 20 20 20 20 20 20 20 64 61 79 73 5f .&&.between2).{............days_
e540 62 65 74 77 65 65 6e 28 63 61 6c 2c 20 62 65 74 77 65 65 6e 31 2c 20 62 65 74 77 65 65 6e 32 29 between(cal,.between1,.between2)
e560 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0a 20 20 20 20 65 6c 73 65 20 7b 00 00 00 1d 20 20 20 20 ;........}........else.{........
e580 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 05 20 20 20 ....print_usage(argv[0]);.......
e5a0 20 7d 00 00 00 04 20 20 20 20 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 01 7d .}................return.0;....}
e5c0 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 3a 01 00 00 00 00 00 00 01 00 00 00 00 00 00 00 5...............:...............
e5e0 00 00 00 00 00 00 00 00 15 26 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 0c .........&..............5._.....
e600 00 00 00 0e 00 00 00 00 00 00 00 00 00 00 00 0d 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff ................................
e620 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e680 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e6a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e6c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e6e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e740 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 ..............................j.
e780 3d 97 04 01 00 00 00 09 00 f5 18 00 00 01 76 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 20 =.............v.................
e7a0 20 20 20 f5 18 00 00 01 77 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 f3 00 00 00 00 00 ........w.......................
e7c0 00 00 00 00 00 00 01 00 00 00 1e 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 79 65 ...............printf("--show-ye
e7e0 61 72 20 20 20 20 20 20 20 f5 18 00 00 00 f4 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 ar..............................
e800 7c 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 11 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 |............................int
e820 20 74 f5 18 00 00 00 7d 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 .t.....}........................
e840 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 ............................5...
e860 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7c 00 00 00 11 00 00 00 00 00 00 00 ....................|...........
e880 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 7c 00 00 00 11 00 ..........................|.....
e8a0 00 00 00 00 00 00 00 00 00 00 77 00 00 00 1e 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 00 ..........w.....................
e8c0 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 f3 00 00 00 1e 00 00 00 00 00 00 00 00 00 00 00 ................................
e8e0 83 00 00 00 04 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 0f 00 00 00 00 00 00 ................................
e900 f5 18 00 00 00 00 76 01 00 00 04 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 f7 2f ......v......................../
e920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 0d 00 00 ..............4.......5._.......
e940 00 0f 00 00 00 00 00 00 00 00 00 00 00 0e 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 ................................
e960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e980 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e9a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e9c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
e9e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
ea00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
ea20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
ea40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
ea60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
ea80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
eaa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3e 19 ............................j.>.
eac0 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 7b 00 00 00 12 23 69 6e ........................{....#in
eae0 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 clude.<stdio.h>....#include.<std
eb00 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 lib.h>....#include.<string.h>...
eb20 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c .#include.<time.h>....#include.<
eb40 67 65 74 6f 70 74 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 getopt.h>........typedef.struct.
eb60 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 10 20 20 20 20 69 6e 74 20 69 73 {........int.year;........int.is
eb80 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 _leap;........int.days_per_month
eba0 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 31 32 [12];........char.month_names[12
ebc0 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 61 72 3b 00 00 00 00 00 00 00 38 63 61 6c ][10];....}.calendar;.......8cal
ebe0 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 6f 6e 73 74 20 63 68 61 72 20 2a endar.load_calendar(const.char.*
ec00 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 29 20 7b 00 00 00 11 20 20 20 20 63 61 6c filename,.int.year).{........cal
ec20 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 endar.cal;........cal.year.=.yea
ec40 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 30 3b 00 00 00 8e 20 20 r;........cal.is_leap.=.0;......
ec60 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 31 32 5d 20 3d 20 7b 22 6a 61 ..char.*default_names[12].=.{"ja
ec80 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 2c 22 6d 61 72 63 68 22 2c 22 61 70 72 69 6c nuary","february","march","april
eca0 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a 75 6c 79 22 2c 22 61 75 67 75 73 74 22 2c 22 ","may","june","july","august","
ecc0 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 65 72 22 2c 22 6e 6f 76 65 6d 62 65 72 22 2c september","october","november",
ece0 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d "december"};..."....for.(int.i.=
ed00 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 35 20 20 20 20 20 20 20 20 73 74 .0;.i.<.12;.i++).{...5........st
ed20 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 64 65 66 61 75 6c 74 rcpy(cal.month_names[i],.default
ed40 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 20 20 20 20 20 20 69 66 20 28 69 20 3d 3d 20 _names[i]);.../........if.(i.==.
ed60 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 32 38 3b 00 00 1).cal.days_per_month[i].=.28;..
ed80 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 69 20 3d 3d 20 33 20 7c 7c 20 69 20 3d .S........else.if.(i.==.3.||.i.=
eda0 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d 20 31 30 29 20 63 61 6c 2e 64 61 =.5.||.i.==.8.||.i.==.10).cal.da
edc0 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b 00 00 00 28 20 20 20 20 20 20 20 ys_per_month[i].=.30;...(.......
ede0 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 31 .else.cal.days_per_month[i].=.31
ee00 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 49 4c 45 20 2a 66 20 3d 20 66 6f 70 65 ;........}...#....FILE.*f.=.fope
ee20 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 20 20 20 20 69 66 20 28 21 66 29 n(filename,."r");........if.(!f)
ee40 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 20 63 68 61 72 20 6c 69 6e 65 5b 35 31 .return.cal;........char.line[51
ee60 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 67 65 74 73 28 6c 69 6e 65 2c 20 73 69 2];...*....while.(fgets(line,.si
ee80 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 zeof(line),.f)).{...-........if.
eea0 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 22 2c 20 35 29 20 3d 3d 20 30 29 (strncmp(line,."year:",.5).==.0)
eec0 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 3b 00 00 00 29 20 20 20 20 .{................int.y;...)....
eee0 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a 20 25 64 22 2c ........sscanf(line,."year:.%d",
ef00 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 20 21 3d 20 79 65 .&y);...$............if.(y.!=.ye
ef20 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 2e 20 20 ar).continue;............}......
ef40 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 22 ......if.(strncmp(line,."month:"
ef60 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 ,.6).==.0).{................int.
ef80 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 6e 61 6d 65 5b 32 m,.d;................char.name[2
efa0 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 0];...F............sscanf(line,.
efc0 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 25 64 20 6e 61 6d 65 3a 20 25 73 22 2c 20 26 "month:.%d.days:.%d.name:.%s",.&
efe0 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 m,.&d,.name);...$............if.
f000 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 (m.>=.1.&&.m.<=.12).{...,.......
f020 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d .........cal.days_per_month[m-1]
f040 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 .=.d;...3................strcpy(
f060 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 2d 31 5d 2c 20 6e 61 6d 65 29 3b 00 00 00 0d cal.month_names[m-1],.name);....
f080 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 2d 20 20 ............}............}...-..
f0a0 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 22 2c ......if.(strncmp(line,."leap:",
f0c0 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6c .5).==.0).{................int.l
f0e0 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6c ;...)............sscanf(line,."l
f100 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 32 20 20 20 20 20 20 20 20 20 20 20 20 69 66 eap:.%d",.&l);...2............if
f120 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 .(year.==.cal.year).cal.is_leap.
f140 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 =.l;............}........}......
f160 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 ..fclose(f);........return.cal;.
f180 00 00 01 7d 00 00 00 00 00 00 00 2c 69 6e 74 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 65 ...}.......,int.parse_month(cale
f1a0 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 69 6e 70 75 74 29 20 7b 00 00 00 22 20 20 20 20 ndar.cal,.char.*input).{..."....
f1c0 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 for.(int.i.=.0;.i.<.12;.i++).{..
f1e0 00 41 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d 70 28 69 6e 70 75 74 2c 20 63 61 6c 2e .A........if.(strcmp(input,.cal.
f200 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 20 72 65 74 75 72 6e 20 69 20 2b month_names[i]).==.0).return.i.+
f220 20 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 20 72 65 74 75 72 6e 20 61 74 6f 69 28 .1;........}........return.atoi(
f240 69 6e 70 75 74 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3b 69 6e 74 20 64 61 74 65 5f 74 6f 5f input);....}.......;int.date_to_
f260 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f day_of_year(calendar.cal,.int.mo
f280 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 18 20 20 20 20 69 6e 74 20 64 61 79 5f 6f nth,.int.day).{........int.day_o
f2a0 66 5f 79 65 61 72 20 3d 20 30 3b 00 00 00 29 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 f_year.=.0;...)....for.(int.i.=.
f2c0 30 3b 20 69 20 3c 20 6d 6f 6e 74 68 20 2d 20 31 3b 20 69 2b 2b 29 20 7b 00 00 00 2d 20 20 20 20 0;.i.<.month.-.1;.i++).{...-....
f2e0 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f ....day_of_year.+=.cal.days_per_
f300 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 20 64 61 79 5f 6f 66 month[i];........}........day_of
f320 5f 79 65 61 72 20 2b 3d 20 64 61 79 3b 00 00 00 17 20 20 20 20 72 65 74 75 72 6e 20 64 61 79 5f _year.+=.day;........return.day_
f340 6f 66 5f 79 65 61 72 3b 00 00 00 01 7d 00 00 00 00 00 00 00 56 69 6e 74 20 64 61 79 73 5f 62 65 of_year;....}.......Vint.days_be
f360 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 31 2c 20 69 6e 74 20 6d tween_dates(calendar.cal1,.int.m
f380 31 2c 20 69 6e 74 20 64 31 2c 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 32 2c 20 69 6e 74 20 6d 32 1,.int.d1,.calendar.cal2,.int.m2
f3a0 2c 20 69 6e 74 20 64 32 29 20 7b 00 00 00 17 20 20 20 20 69 6e 74 20 79 31 20 3d 20 63 61 6c 31 ,.int.d2).{........int.y1.=.cal1
f3c0 2e 79 65 61 72 3b 00 00 00 17 20 20 20 20 69 6e 74 20 79 32 20 3d 20 63 61 6c 32 2e 79 65 61 72 .year;........int.y2.=.cal2.year
f3e0 3b 00 00 00 31 20 20 20 20 69 6e 74 20 64 6f 79 31 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f ;...1....int.doy1.=.date_to_day_
f400 6f 66 5f 79 65 61 72 28 63 61 6c 31 2c 20 6d 31 2c 20 64 31 29 3b 00 00 00 31 20 20 20 20 69 6e of_year(cal1,.m1,.d1);...1....in
f420 74 20 64 6f 79 32 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c t.doy2.=.date_to_day_of_year(cal
f440 32 2c 20 6d 32 2c 20 64 32 29 3b 00 00 00 04 20 20 20 20 00 00 00 11 20 20 20 20 69 6e 74 20 64 2,.m2,.d2);................int.d
f460 61 79 73 20 3d 20 30 3b 00 00 00 13 20 20 20 20 69 66 20 28 79 31 20 3d 3d 20 79 32 29 20 7b 00 ays.=.0;........if.(y1.==.y2).{.
f480 00 00 1b 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 64 6f 79 32 20 2d 20 64 6f 79 31 3b 00 00 ...........days.=.doy2.-.doy1;..
f4a0 00 19 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 79 32 20 3e 20 79 31 29 20 7b 00 00 00 2c 20 ......}.else.if.(y2.>.y1).{...,.
f4c0 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 73 5f 69 6e 5f 79 31 20 3d 20 33 36 35 20 2b 20 63 61 .......int.days_in_y1.=.365.+.ca
f4e0 6c 31 2e 69 73 5f 6c 65 61 70 3b 00 00 00 2a 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 28 64 l1.is_leap;...*........days.=.(d
f500 61 79 73 5f 69 6e 5f 79 31 20 2d 20 64 6f 79 31 29 20 2b 20 64 6f 79 32 3b 00 00 00 2b 20 20 20 ays_in_y1.-.doy1).+.doy2;...+...
f520 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d 20 79 31 20 2b 20 31 3b 20 79 20 3c 20 79 32 .....for.(int.y.=.y1.+.1;.y.<.y2
f540 3b 20 79 2b 2b 29 20 7b 00 00 00 3d 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 ;.y++).{...=............calendar
f560 20 79 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e .ycal.=.load_calendar("calendar.
f580 74 78 74 22 2c 20 79 29 3b 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 64 61 79 73 20 2b 3d txt",.y);...'............days.+=
f5a0 20 33 36 35 20 2b 20 79 63 61 6c 2e 69 73 5f 6c 65 61 70 3b 00 00 00 09 20 20 20 20 20 20 20 20 .365.+.ycal.is_leap;............
f5c0 7d 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 00 3e 20 20 20 20 20 20 20 20 64 61 79 }........}.else.{...>........day
f5e0 73 20 3d 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 32 2c 20 6d 32 2c s.=.days_between_dates(cal2,.m2,
f600 20 64 32 2c 20 63 61 6c 31 2c 20 6d 31 2c 20 64 31 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 10 .d2,.cal1,.m1,.d1);........}....
f620 20 20 20 20 72 65 74 75 72 6e 20 64 61 79 73 3b 00 00 00 01 7d 00 00 00 00 00 00 00 66 76 6f 69 ....return.days;....}.......fvoi
f640 64 20 73 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 d.show_day_length(calendar.cal,.
f660 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 2c 20 69 6e 74 20 77 65 65 6b 5f 66 6c 61 int.month,.int.day,.int.week_fla
f680 67 2c 20 69 6e 74 20 6d 6f 6e 74 68 5f 66 6c 61 67 2c 20 69 6e 74 20 79 65 61 72 5f 66 6c 61 67 g,.int.month_flag,.int.year_flag
f6a0 29 20 7b 00 00 00 52 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 ).{...R....if.(month.<.1.||.mont
f6c0 68 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 20 7c 7c 20 64 61 79 20 3e 20 63 61 6c 2e 64 h.>.12.||.day.<.1.||.day.>.cal.d
f6e0 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 5d 29 20 7b 00 00 00 21 20 20 20 ays_per_month[month-1]).{...!...
f700 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 64 61 74 65 5c 6e 22 29 3b 00 00 .....printf("invalid.date\n");..
f720 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 ..........return;........}......
f740 20 20 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 6e 6f 77 5f 74 20 3d 20 74 69 6d 65 28 4e 55 ..........time_t.now_t.=.time(NU
f760 4c 4c 29 3b 00 00 00 2a 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6e 6f 77 5f 74 6d 20 3d 20 LL);...*....struct.tm.*now_tm.=.
f780 6c 6f 63 61 6c 74 69 6d 65 28 26 6e 6f 77 5f 74 29 3b 00 00 00 2e 20 20 20 20 69 6e 74 20 63 75 localtime(&now_t);........int.cu
f7a0 72 72 65 6e 74 5f 79 65 61 72 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 rrent_year.=.now_tm->tm_year.+.1
f7c0 39 30 30 3b 00 00 00 2b 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 3d 20 900;...+....int.current_month.=.
f7e0 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 26 20 20 20 20 69 6e 74 20 63 now_tm->tm_mon.+.1;...&....int.c
f800 75 72 72 65 6e 74 5f 64 61 79 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 urrent_day.=.now_tm->tm_mday;...
f820 04 20 20 20 20 00 00 00 47 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 72 65 6e 74 5f 63 61 ........G....calendar.current_ca
f840 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 l.=.load_calendar("calendar.txt"
f860 2c 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 60 20 20 20 20 ,.current_year);...........`....
f880 69 6e 74 20 64 61 79 73 5f 61 67 6f 20 3d 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 int.days_ago.=.days_between_date
f8a0 73 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 2c 20 63 75 72 72 65 6e 74 5f 63 61 6c 2c 20 s(cal,.month,.day,.current_cal,.
f8c0 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 2c 20 63 75 72 72 65 6e 74 5f 64 61 79 29 3b 00 00 00 04 current_month,.current_day);....
f8e0 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3c 20 30 29 20 7b 00 ............if.(days_ago.<.0).{.
f900 00 00 4a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 69 73 20 69 6e 20 74 ..J........printf("%s.%d.is.in.t
f920 68 65 20 66 75 74 75 72 65 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f he.future\n",.cal.month_names[mo
f940 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b nth-1],.day);............return;
f960 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 18 20 20 20 20 69 66 20 28 64 61 79 ........}................if.(day
f980 73 5f 61 67 6f 20 3d 3d 20 30 29 20 7b 00 00 00 43 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 s_ago.==.0).{...C........printf(
f9a0 22 25 73 20 25 64 20 77 61 73 20 74 6f 64 61 79 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e "%s.%d.was.today\n",.cal.month_n
f9c0 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 1f 20 20 20 20 7d 20 65 6c ames[month-1],.day);........}.el
f9e0 73 65 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 31 29 20 7b 00 00 00 47 20 20 20 20 20 se.if.(days_ago.==.1).{...G.....
fa00 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 79 65 73 74 65 72 64 61 79 5c 6e ...printf("%s.%d.was.yesterday\n
fa20 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 ",.cal.month_names[month-1],.day
fa40 29 3b 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 00 18 20 20 20 20 20 20 20 20 69 66 );........}.else.{............if
fa60 20 28 77 65 65 6b 5f 66 6c 61 67 29 20 7b 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 69 6e .(week_flag).{...%............in
fa80 74 20 77 65 65 6b 73 20 3d 20 64 61 79 73 5f 61 67 6f 20 2f 20 37 3b 00 00 00 28 20 20 20 20 20 t.weeks.=.days_ago./.7;...(.....
faa0 20 20 20 20 20 20 20 69 6e 74 20 72 65 6d 5f 64 61 79 73 20 3d 20 64 61 79 73 5f 61 67 6f 20 25 .......int.rem_days.=.days_ago.%
fac0 20 37 3b 00 00 00 88 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 72 65 6d 5f 64 61 79 73 20 .7;................if.(rem_days.
fae0 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 ==.0).printf("%s.%d.was.%d.days.
fb00 61 67 6f 20 77 68 69 63 68 20 77 61 73 20 25 64 20 77 65 65 6b 73 20 61 67 6f 5c 6e 22 2c 20 63 ago.which.was.%d.weeks.ago\n",.c
fb20 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 al.month_names[month-1],.day,.da
fb40 79 73 5f 61 67 6f 2c 20 77 65 65 6b 73 29 3b 00 00 00 90 20 20 20 20 20 20 20 20 20 20 20 20 65 ys_ago,.weeks);................e
fb60 6c 73 65 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 lse.printf("%s.%d.was.%d.days.ag
fb80 6f 20 77 68 69 63 68 20 77 61 73 20 25 64 20 77 65 65 6b 73 20 61 6e 64 20 25 64 20 64 61 79 73 o.which.was.%d.weeks.and.%d.days
fba0 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 .ago\n",.cal.month_names[month-1
fbc0 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 77 65 65 6b 73 2c 20 72 65 6d 5f 64 61 79 ],.day,.days_ago,.weeks,.rem_day
fbe0 73 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 1e 20 20 20 20 20 20 20 20 65 6c 73 65 s);............}............else
fc00 20 69 66 20 28 6d 6f 6e 74 68 5f 66 6c 61 67 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 .if.(month_flag).{..............
fc20 20 20 69 6e 74 20 6d 6f 6e 74 68 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 25 20 20 20 20 20 20 20 ..int.months_ago.=.0;...%.......
fc40 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 .....int.temp_year.=.cal.year;..
fc60 00 23 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 20 6d .#............int.temp_month.=.m
fc80 6f 6e 74 68 3b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 64 61 onth;................int.temp_da
fca0 79 20 3d 20 64 61 79 3b 00 00 00 17 20 20 20 20 20 20 20 20 20 20 20 20 77 68 69 6c 65 20 28 31 y.=.day;................while.(1
fcc0 29 20 7b 00 00 00 54 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f ).{...T................if.(temp_
fce0 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 26 26 20 74 65 6d 70 5f 6d 6f 6e year.==.current_year.&&.temp_mon
fd00 74 68 20 3d 3d 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 29 20 62 72 65 61 6b 3b 00 00 00 51 20 th.==.current_month).break;...Q.
fd20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 64 61 79 20 3e 20 63 75 ...............if.(temp_day.>.cu
fd40 72 72 65 6e 74 5f 64 61 79 20 26 26 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 3d 20 63 75 72 72 65 rrent_day.&&.temp_month.==.curre
fd60 6e 74 5f 6d 6f 6e 74 68 29 20 62 72 65 61 6b 3b 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 nt_month).break;................
fd80 20 20 20 20 74 65 6d 70 5f 6d 6f 6e 74 68 2b 2b 3b 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 ....temp_month++;...&...........
fda0 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 6d 6f 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 00 23 20 .....if.(temp_month.>.12).{...#.
fdc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 20 ...................temp_month.=.
fde0 31 3b 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f 79 1;........................temp_y
fe00 65 61 72 2b 2b 3b 00 00 00 11 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 1d 20 ear++;....................}.....
fe20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 73 5f 61 67 6f 2b 2b 3b 00 00 00 34 ...............months_ago++;...4
fe40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 79 65 61 72 20 3e 20 ................if.(temp_year.>.
fe60 63 75 72 72 65 6e 74 5f 79 65 61 72 29 20 62 72 65 61 6b 3b 00 00 00 53 20 20 20 20 20 20 20 20 current_year).break;...S........
fe80 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 ........if.(temp_year.==.current
fea0 5f 79 65 61 72 20 26 26 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3e 20 63 75 72 72 65 6e 74 5f 6d 6f _year.&&.temp_month.>.current_mo
fec0 6e 74 68 29 20 62 72 65 61 6b 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 89 nth).break;................}....
fee0 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 ............printf("%s.%d.was.%d
ff00 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 77 61 73 20 61 70 70 72 6f 78 69 6d 61 74 65 6c .days.ago.which.was.approximatel
ff20 79 20 25 64 20 6d 6f 6e 74 68 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 y.%d.months.ago\n",.cal.month_na
ff40 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 6d 6f 6e mes[month-1],.day,.days_ago,.mon
ff60 74 68 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 1d 20 20 20 20 20 20 ths_ago);............}..........
ff80 20 20 65 6c 73 65 20 69 66 20 28 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 34 20 20 20 20 20 ..else.if.(year_flag).{...4.....
ffa0 20 20 20 20 20 20 20 69 6e 74 20 79 65 61 72 73 5f 61 67 6f 20 3d 20 63 75 72 72 65 6e 74 5f 79 .......int.years_ago.=.current_y
ffc0 65 61 72 20 2d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 59 20 20 20 20 20 20 20 20 20 20 20 20 69 ear.-.cal.year;...Y............i
ffe0 66 20 28 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 3c 20 6d 6f 6e 74 68 20 7c 7c 20 28 63 75 72 f.(current_month.<.month.||.(cur
10000 72 65 6e 74 5f 6d 6f 6e 74 68 20 3d 3d 20 6d 6f 6e 74 68 20 26 26 20 63 75 72 72 65 6e 74 5f 64 rent_month.==.month.&&.current_d
10020 61 79 20 3c 20 64 61 79 29 29 20 7b 00 00 00 1c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ay.<.day)).{....................
10040 79 65 61 72 73 5f 61 67 6f 2d 2d 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 years_ago--;................}...
10060 2d 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 73 5f 61 67 6f 20 3c 20 30 29 20 -............if.(years_ago.<.0).
10080 79 65 61 72 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 87 20 20 20 20 20 20 20 20 20 20 20 20 70 72 years_ago.=.0;................pr
100a0 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 intf("%s.%d.was.%d.days.ago.whic
100c0 68 20 77 61 73 20 61 70 70 72 6f 78 69 6d 61 74 65 6c 79 20 25 64 20 79 65 61 72 73 20 61 67 6f h.was.approximately.%d.years.ago
100e0 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 \n",.cal.month_names[month-1],.d
10100 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 79 65 61 72 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 ay,.days_ago,.years_ago);.......
10120 20 20 20 20 20 7d 00 00 00 0e 20 20 20 20 20 20 20 20 65 6c 73 65 20 7b 00 00 00 57 20 20 20 20 .....}............else.{...W....
10140 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 ........printf("%s.%d.was.%d.day
10160 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d s.ago\n",.cal.month_names[month-
10180 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 1],.day,.days_ago);............}
101a0 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 73 68 6f 77 5f ........}....}........void.show_
101c0 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 22 20 20 20 20 70 72 69 6e year(calendar.cal).{..."....prin
101e0 74 66 28 22 79 65 61 72 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 tf("year.%d\n",.cal.year);...+..
10200 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 29 20 70 72 69 6e 74 66 28 22 6c 65 61 70 20 ..if.(cal.is_leap).printf("leap.
10220 79 65 61 72 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b year\n");..."....for.(int.i.=.0;
10240 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 45 20 20 20 20 20 20 20 20 70 72 69 6e 74 .i.<.12;.i++).{...E........print
10260 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c f("%s.%d\n",.cal.month_names[i],
10280 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 .cal.days_per_month[i]);........
102a0 7d 00 00 00 01 7d 00 00 00 00 00 00 00 2a 76 6f 69 64 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 }....}.......*void.show_month(ca
102c0 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 29 20 7b 00 00 00 22 20 20 20 20 lendar.cal,.int.month).{..."....
102e0 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 if.(month.<.1.||.month.>.12).{..
10300 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c ."........printf("invalid.month\
10320 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d n");............return;........}
10340 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f ...:....printf("%s.%d\n",.cal.mo
10360 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 nth_names[month-1],.cal.year);..
10380 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 20 6d 6f 20 74 75 20 77 65 20 74 68 20 66 72 20 .%....printf("su.mo.tu.we.th.fr.
103a0 73 61 5c 6e 22 29 3b 00 00 00 17 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 sa\n");........struct.tm.tm.=.{0
103c0 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 };...!....tm.tm_year.=.cal.year.
103e0 2d 20 31 39 30 30 3b 00 00 00 1a 20 20 20 20 74 6d 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 -.1900;........tm.tm_mon.=.month
10400 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e 74 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 00 00 10 .-.1;........tm.tm_mday.=.1;....
10420 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b 00 00 00 1f 20 20 20 20 69 6e 74 20 66 69 72 73 ....mktime(&tm);........int.firs
10440 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 79 3b 00 00 00 36 20 20 20 20 66 6f 72 20 28 t_day.=.tm.tm_wday;...6....for.(
10460 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 72 73 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 int.i.=.0;.i.<.first_day;.i++).p
10480 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 3c 20 20 20 20 66 6f 72 20 28 69 6e 74 20 64 20 rintf("...");...<....for.(int.d.
104a0 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e =.1;.d.<=.cal.days_per_month[mon
104c0 74 68 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 th-1];.d++).{............printf(
104e0 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 20 20 20 20 20 20 20 69 66 20 28 28 66 69 72 73 "%2d.",.d);...3........if.((firs
10500 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 5c 6e 22 t_day.+.d).%.7.==.0).printf("\n"
10520 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b );........}........printf("\n");
10540 00 00 00 01 7d 00 00 00 00 00 00 00 26 76 6f 69 64 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 ....}.......&void.show_current_t
10560 69 6d 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f ime(calendar.cal).{........time_
10580 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 t.t.=.time(NULL);...%....struct.
105a0 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 25 20 20 tm.*local.=.localtime(&t);...%..
105c0 20 20 69 6e 74 20 79 65 61 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 ..int.year.=.local->tm_year.+.19
105e0 30 30 3b 00 00 00 22 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 00;..."....int.month.=.local->tm
10600 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1d 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 6c 6f 63 61 6c _mon.+.1;........int.day.=.local
10620 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1e 20 20 20 20 69 6e 74 20 68 6f 75 72 20 3d 20 6c 6f 63 ->tm_mday;........int.hour.=.loc
10640 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1f 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 20 3d al->tm_hour;........int.minute.=
10660 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 00 00 1f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e .local->tm_min;........int.secon
10680 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 d.=.local->tm_sec;...;....calend
106a0 61 72 20 63 75 72 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 ar.cur_cal.=.load_calendar("cale
106c0 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 3b 00 00 00 67 20 20 20 20 70 72 69 6e 74 66 28 ndar.txt",.year);...g....printf(
106e0 22 25 64 20 25 73 20 25 64 20 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 79 65 61 "%d.%s.%d.%02d:%02d:%02d\n",.yea
10700 72 2c 20 63 75 72 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c r,.cur_cal.month_names[month-1],
10720 20 64 61 79 2c 20 68 6f 75 72 2c 20 6d 69 6e 75 74 65 2c 20 73 65 63 6f 6e 64 29 3b 00 00 00 01 .day,.hour,.minute,.second);....
10740 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 72 75 6e 5f 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 }......."void.run_stopwatch(cale
10760 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 70 72 65 73 73 ndar.cal).{...%....printf("press
10780 20 65 6e 74 65 72 20 74 6f 20 73 74 61 72 74 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 .enter.to.start\n");........getc
107a0 68 61 72 28 29 3b 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 73 74 61 72 74 20 3d 20 74 69 6d har();........time_t.start.=.tim
107c0 65 28 4e 55 4c 4c 29 3b 00 00 00 2c 20 20 20 20 70 72 69 6e 74 66 28 22 72 75 6e 6e 69 6e 67 20 e(NULL);...,....printf("running.
107e0 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 press.enter.to.stop\n");........
10800 67 65 74 63 68 61 72 28 29 3b 00 00 00 1c 20 20 20 20 74 69 6d 65 5f 74 20 65 6e 64 20 3d 20 74 getchar();........time_t.end.=.t
10820 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 1c 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e ime(NULL);........long.diff.=.en
10840 64 20 2d 20 73 74 61 72 74 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 d.-.start;........int.hours.=.di
10860 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 ff./.3600;...%....int.minutes.=.
10880 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 (diff.%.3600)./.60;........int.s
108a0 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 30 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 econds.=.diff.%.60;...8....print
108c0 66 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e f("%02d:%02d:%02d\n",.hours,.min
108e0 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 27 76 6f 69 64 utes,.seconds);....}.......'void
10900 20 61 64 64 5f 64 61 79 73 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 64 61 79 73 .add_days(calendar.cal,.int.days
10920 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 ).{........time_t.t.=.time(NULL)
10940 3b 00 00 00 16 20 20 20 20 74 20 2b 3d 20 64 61 79 73 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 ;........t.+=.days.*.86400;...&.
10960 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 66 75 74 75 72 65 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 ...struct.tm.*future.=.localtime
10980 28 26 74 29 3b 00 00 00 26 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 66 75 74 75 72 65 2d 3e (&t);...&....int.year.=.future->
109a0 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 23 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 tm_year.+.1900;...#....int.month
109c0 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1e 20 20 20 20 69 6e .=.future->tm_mon.+.1;........in
109e0 74 20 64 61 79 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 3b 20 20 20 20 t.day.=.future->tm_mday;...;....
10a00 63 61 6c 65 6e 64 61 72 20 66 75 74 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 calendar.fut_cal.=.load_calendar
10a20 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 3b 00 00 00 5c 20 20 20 20 70 ("calendar.txt",.year);...\....p
10a40 72 69 6e 74 66 28 22 25 64 20 64 61 79 73 20 66 72 6f 6d 20 6e 6f 77 20 69 73 20 25 64 20 25 73 rintf("%d.days.from.now.is.%d.%s
10a60 20 25 64 5c 6e 22 2c 20 64 61 79 73 2c 20 79 65 61 72 2c 20 66 75 74 5f 63 61 6c 2e 6d 6f 6e 74 .%d\n",.days,.year,.fut_cal.mont
10a80 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 01 7d 00 00 00 00 h_names[month-1],.day);....}....
10aa0 00 00 00 43 76 6f 69 64 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 ...Cvoid.days_between_command(ca
10ac0 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 64 61 74 65 31 2c 20 63 68 61 72 20 2a 64 lendar.cal,.char.*date1,.char.*d
10ae0 61 74 65 32 29 20 7b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 31 2c 6d 31 2c 64 31 2c 79 32 2c 6d ate2).{........int.y1,m1,d1,y2,m
10b00 32 2c 64 32 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 61 74 65 31 2c 20 22 25 64 2d 25 2,d2;...-....sscanf(date1,."%d-%
10b20 64 2d 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c 20 26 64 31 29 3b 00 00 00 2d 20 20 20 20 73 73 d-%d",.&y1,.&m1,.&d1);...-....ss
10b40 63 61 6e 66 28 64 61 74 65 32 2c 20 22 25 64 2d 25 64 2d 25 64 22 2c 20 26 79 32 2c 20 26 6d 32 canf(date2,."%d-%d-%d",.&y2,.&m2
10b60 2c 20 26 64 32 29 3b 00 00 00 23 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 74 6d 31 20 3d 20 7b ,.&d2);...#....struct.tm.tm1.=.{
10b80 30 7d 2c 20 74 6d 32 20 3d 20 7b 30 7d 3b 00 00 00 1c 20 20 20 20 74 6d 31 2e 74 6d 5f 79 65 61 0},.tm2.=.{0};........tm1.tm_yea
10ba0 72 20 3d 20 79 31 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 6f 6e r.=.y1.-.1900;........tm1.tm_mon
10bc0 20 3d 20 6d 31 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 64 61 79 20 3d 20 .=.m1.-.1;........tm1.tm_mday.=.
10be0 64 31 3b 00 00 00 1c 20 20 20 20 74 6d 32 2e 74 6d 5f 79 65 61 72 20 3d 20 79 32 20 2d 20 31 39 d1;........tm2.tm_year.=.y2.-.19
10c00 30 30 3b 00 00 00 18 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 32 20 2d 20 31 3b 00 00;........tm2.tm_mon.=.m2.-.1;.
10c20 00 00 15 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 64 61 79 20 3d 20 64 32 3b 00 00 00 20 20 20 20 20 .......tm2.tm_mday.=.d2;........
10c40 74 69 6d 65 5f 74 20 74 69 6d 65 31 20 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 31 29 3b 00 00 00 20 time_t.time1.=.mktime(&tm1);....
10c60 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 32 20 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 32 29 3b ....time_t.time2.=.mktime(&tm2);
10c80 00 00 00 28 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 28 74 69 6d 65 32 20 2d 20 74 69 6d ...(....long.diff.=.(time2.-.tim
10ca0 65 31 29 20 2f 20 38 36 34 30 30 3b 00 00 00 1f 20 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 30 e1)./.86400;........if.(diff.<.0
10cc0 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 64 ).diff.=.-diff;...*....printf("d
10ce0 69 66 66 65 72 65 6e 63 65 20 25 6c 64 20 64 61 79 73 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 00 ifference.%ld.days\n",.diff);...
10d00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 70 72 69 6e 74 5f 75 73 61 67 65 28 63 68 61 72 20 .}........void.print_usage(char.
10d20 2a 70 72 6f 67 29 20 7b 00 00 00 29 20 20 20 20 70 72 69 6e 74 66 28 22 75 73 61 67 65 20 25 73 *prog).{...)....printf("usage.%s
10d40 20 5b 6f 70 74 69 6f 6e 73 5d 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 33 20 20 20 20 70 72 69 .[options]\n",.prog);...3....pri
10d60 6e 74 66 28 22 2d 2d 79 65 61 72 20 59 59 59 59 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 ntf("--year.YYYY...............s
10d80 65 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 49 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 et.year\n");...I....printf("--sh
10da0 6f 77 2d 79 65 61 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 63 61 6c 65 6e ow-year...............show.calen
10dc0 64 61 72 20 66 6f 72 20 63 75 72 72 65 6e 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 35 20 20 20 dar.for.current.year\n");...5...
10de0 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6d 6f 6e 74 68 20 4d 4d 20 6f 72 20 6e 61 6d 65 .printf("--show-month.MM.or.name
10e00 20 20 20 73 68 6f 77 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 4c 20 20 20 20 70 72 69 6e 74 66 ...show.month\n");...L....printf
10e20 28 22 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 6d 6f 6e 74 68 20 64 61 79 5c 22 20 73 68 ("--show-length.\"month.day\".sh
10e40 6f 77 20 68 6f 77 20 6c 6f 6e 67 20 61 67 6f 20 74 68 61 74 20 64 61 74 65 20 77 61 73 5c 6e 22 ow.how.long.ago.that.date.was\n"
10e60 29 3b 00 00 00 49 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 77 65 65 6b 20 20 20 20 20 20 20 20 );...I....printf("--week........
10e80 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 77 65 65 6b 73 20 61 67 6f 20 69 6e 73 74 65 ............show.weeks.ago.inste
10ea0 61 64 20 6f 66 20 64 61 79 73 5c 6e 22 29 3b 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 2d ad.of.days\n");...:....printf("-
10ec0 2d 6d 6f 6e 74 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 6d 6f -month...................show.mo
10ee0 6e 74 68 73 20 61 67 6f 5c 6e 22 29 3b 00 00 00 39 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 79 nths.ago\n");...9....printf("--y
10f00 65 61 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 79 65 61 72 ear....................show.year
10f20 73 20 61 67 6f 5c 6e 22 29 3b 00 00 00 3c 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 6e 6f 77 20 s.ago\n");...<....printf("--now.
10f40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 63 75 72 72 65 6e 74 ....................show.current
10f60 20 74 69 6d 65 5c 6e 22 29 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 74 6f 70 .time\n");...8....printf("--stop
10f80 77 61 74 63 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 75 6e 20 73 74 6f 70 77 61 74 63 watch...............run.stopwatc
10fa0 68 5c 6e 22 29 3b 00 00 00 3e 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 61 64 64 2d 64 61 79 73 h\n");...>....printf("--add-days
10fc0 20 4e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 20 4e 20 64 61 79 73 20 74 6f 20 74 6f .N..............add.N.days.to.to
10fe0 64 61 79 5c 6e 22 29 3b 00 00 00 47 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 62 65 74 77 65 65 day\n");...G....printf("--betwee
11000 6e 20 59 59 59 59 2d 4d 4d 2d 44 44 20 59 59 59 59 2d 4d 4d 2d 44 44 20 64 61 79 73 20 62 65 74 n.YYYY-MM-DD.YYYY-MM-DD.days.bet
11020 77 65 65 6e 20 74 77 6f 20 64 61 74 65 73 5c 6e 22 29 3b 00 00 00 43 20 20 20 20 70 72 69 6e 74 ween.two.dates\n");...C....print
11040 66 28 22 2d 2d 63 61 6c 65 6e 64 61 72 2d 66 69 6c 65 20 46 49 4c 45 20 20 20 20 20 20 75 73 65 f("--calendar-file.FILE......use
11060 20 63 75 73 74 6f 6d 20 63 61 6c 65 6e 64 61 72 20 66 69 6c 65 5c 6e 22 29 3b 00 00 00 01 7d 00 .custom.calendar.file\n");....}.
11080 00 00 00 00 00 00 21 69 6e 74 20 6d 61 69 6e 28 69 6e 74 20 61 72 67 63 2c 20 63 68 61 72 20 2a ......!int.main(int.argc,.char.*
110a0 2a 61 72 67 76 29 20 7b 00 00 00 14 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 32 30 32 36 3b *argv).{........int.year.=.2026;
110c0 00 00 00 29 20 20 20 20 63 68 61 72 20 2a 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 22 63 ...)....char.*calendar_file.=."c
110e0 61 6c 65 6e 64 61 72 2e 74 78 74 22 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 73 68 6f 77 5f 79 65 alendar.txt";........int.show_ye
11100 61 72 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 20 20 20 20 20 63 68 61 72 20 2a 73 68 6f 77 5f 6d ar_flag.=.0;........char.*show_m
11120 6f 6e 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 21 20 20 20 20 63 68 61 72 20 2a 73 68 onth_arg.=.NULL;...!....char.*sh
11140 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 16 20 20 20 20 69 6e 74 ow_length_arg.=.NULL;........int
11160 20 77 65 65 6b 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 .week_flag.=.0;........int.month
11180 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 65 61 72 5f 61 _ago_flag.=.0;........int.year_a
111a0 67 6f 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 15 20 20 20 20 69 6e 74 20 6e 6f 77 5f 66 6c 61 67 go_flag.=.0;........int.now_flag
111c0 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 .=.0;........int.stopwatch_flag.
111e0 3d 20 30 3b 00 00 00 19 20 20 20 20 69 6e 74 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 30 =.0;........int.add_days_val.=.0
11200 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 31 20 3d 20 4e 55 4c 4c 3b 00 ;........char.*between1.=.NULL;.
11220 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 32 20 3d 20 4e 55 4c 4c 3b 00 00 00 .......char.*between2.=.NULL;...
11240 04 20 20 20 20 00 00 00 2b 20 20 20 20 73 74 61 74 69 63 20 73 74 72 75 63 74 20 6f 70 74 69 6f ........+....static.struct.optio
11260 6e 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 5b 5d 20 3d 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 n.long_options[].=.{...,........
11280 7b 22 79 65 61 72 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 {"year",.required_argument,.0,.'
112a0 79 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 79 65 61 72 22 2c 20 6e 6f y'},...+........{"show-year",.no
112c0 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 59 27 7d 2c 00 00 00 32 20 20 20 20 20 20 20 20 7b _argument,.0,.'Y'},...2........{
112e0 22 73 68 6f 77 2d 6d 6f 6e 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c "show-month",.required_argument,
11300 20 30 2c 20 27 6d 27 7d 2c 00 00 00 33 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6c 65 6e 67 .0,.'m'},...3........{"show-leng
11320 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6c 27 7d 2c th",.required_argument,.0,.'l'},
11340 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 77 65 65 6b 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 ...&........{"week",.no_argument
11360 2c 20 30 2c 20 27 77 27 7d 2c 00 00 00 27 20 20 20 20 20 20 20 20 7b 22 6d 6f 6e 74 68 22 2c 20 ,.0,.'w'},...'........{"month",.
11380 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 4d 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 no_argument,.0,.'M'},...&.......
113a0 20 7b 22 79 65 61 72 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 59 27 7d 2c 00 .{"year",.no_argument,.0,.'Y'},.
113c0 00 00 25 20 20 20 20 20 20 20 20 7b 22 6e 6f 77 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 ..%........{"now",.no_argument,.
113e0 30 2c 20 27 6e 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 20 7b 22 73 74 6f 70 77 61 74 63 68 22 0,.'n'},...+........{"stopwatch"
11400 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 73 27 7d 2c 00 00 00 30 20 20 20 20 20 ,.no_argument,.0,.'s'},...0.....
11420 20 20 20 7b 22 61 64 64 2d 64 61 79 73 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e ...{"add-days",.required_argumen
11440 74 2c 20 30 2c 20 27 61 27 7d 2c 00 00 00 2f 20 20 20 20 20 20 20 20 7b 22 62 65 74 77 65 65 6e t,.0,.'a'},.../........{"between
11460 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 62 27 7d 2c 00 00 ",.required_argument,.0,.'b'},..
11480 00 35 20 20 20 20 20 20 20 20 7b 22 63 61 6c 65 6e 64 61 72 2d 66 69 6c 65 22 2c 20 72 65 71 75 .5........{"calendar-file",.requ
114a0 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 63 27 7d 2c 00 00 00 26 20 20 20 20 20 ired_argument,.0,.'c'},...&.....
114c0 20 20 20 7b 22 68 65 6c 70 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 68 27 7d ...{"help",.no_argument,.0,.'h'}
114e0 2c 00 00 00 14 20 20 20 20 20 20 20 20 7b 30 2c 20 30 2c 20 30 2c 20 30 7d 00 00 00 06 20 20 20 ,............{0,.0,.0,.0}.......
11500 20 7d 3b 00 00 00 04 20 20 20 20 00 00 00 19 20 20 20 20 69 6e 74 20 6f 70 74 69 6f 6e 5f 69 6e .};................int.option_in
11520 64 65 78 20 3d 20 30 3b 00 00 00 0a 20 20 20 20 69 6e 74 20 63 3b 00 00 00 1e 20 20 20 20 63 68 dex.=.0;........int.c;........ch
11540 61 72 20 2a 62 65 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 ar.*between_args.=.NULL;........
11560 00 00 00 65 20 20 20 20 77 68 69 6c 65 20 28 28 63 20 3d 20 67 65 74 6f 70 74 5f 6c 6f 6e 67 28 ...e....while.((c.=.getopt_long(
11580 61 72 67 63 2c 20 61 72 67 76 2c 20 22 79 3a 59 3a 6d 3a 6c 3a 77 4d 6e 73 61 3a 62 3a 63 3a 68 argc,.argv,."y:Y:m:l:wMnsa:b:c:h
115a0 22 2c 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 2c 20 26 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 29 29 ",.long_options,.&option_index))
115c0 20 21 3d 20 2d 31 29 20 7b 00 00 00 14 20 20 20 20 20 20 20 20 73 77 69 74 63 68 20 28 63 29 20 .!=.-1).{............switch.(c).
115e0 7b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 79 27 3a 00 00 00 24 20 20 {................case.'y':...$..
11600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 65 61 72 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 ..............year.=.atoi(optarg
11620 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 );....................break;....
11640 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 59 27 3a 00 00 00 23 20 20 20 20 20 20 20 ............case.'Y':...#.......
11660 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 .........show_year_flag.=.1;....
11680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 ................break;..........
116a0 20 20 20 20 20 20 63 61 73 65 20 27 6d 27 3a 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 20 ......case.'m':...(.............
116c0 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 ...show_month_arg.=.optarg;.....
116e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 ...............break;...........
11700 20 20 20 20 20 63 61 73 65 20 27 6c 27 3a 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .....case.'l':...)..............
11720 20 20 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 ..show_length_arg.=.optarg;.....
11740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 ...............break;...........
11760 20 20 20 20 20 63 61 73 65 20 27 77 27 3a 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .....case.'w':..................
11780 20 20 77 65 65 6b 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 ..week_flag.=.1;................
117a0 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 ....break;................case.'
117c0 4d 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 61 67 6f M':...#................month_ago
117e0 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 _flag.=.1;....................br
11800 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6e 27 3a 00 00 00 eak;................case.'n':...
11820 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 31 3b 00 00 .................now_flag.=.1;..
11840 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 ..................break;........
11860 20 20 20 20 20 20 20 20 63 61 73 65 20 27 73 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 ........case.'s':...#...........
11880 20 20 20 20 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 .....stopwatch_flag.=.1;........
118a0 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 ............break;..............
118c0 20 20 63 61 73 65 20 27 61 27 3a 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 ..case.'a':...,................a
118e0 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 dd_days_val.=.atoi(optarg);.....
11900 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 ...............break;...........
11920 20 20 20 20 20 63 61 73 65 20 27 62 27 3a 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .....case.'b':...&..............
11940 20 20 62 65 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 ..between_args.=.optarg;........
11960 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 ............break;..............
11980 20 20 63 61 73 65 20 27 63 27 3a 00 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 ..case.'c':...'................c
119a0 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 alendar_file.=.optarg;..........
119c0 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 ..........break;................
119e0 63 61 73 65 20 27 68 27 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 case.'h':...%................pri
11a00 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 nt_usage(argv[0]);..............
11a20 20 20 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 14 20 20 20 20 20 20 20 20 20 20 20 20 64 ......return.0;................d
11a40 65 66 61 75 6c 74 3a 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 efault:...%................print
11a60 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 _usage(argv[0]);................
11a80 20 20 20 20 72 65 74 75 72 6e 20 31 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 ....return.1;............}......
11aa0 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 62 65 74 77 65 65 6e 5f 61 ..}................if.(between_a
11ac0 72 67 73 29 20 7b 00 00 00 30 20 20 20 20 20 20 20 20 63 68 61 72 20 2a 73 70 61 63 65 20 3d 20 rgs).{...0........char.*space.=.
11ae0 73 74 72 63 68 72 28 62 65 74 77 65 65 6e 5f 61 72 67 73 2c 20 27 20 27 29 3b 00 00 00 14 20 20 strchr(between_args,.'.');......
11b00 20 20 20 20 20 20 69 66 20 28 73 70 61 63 65 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 ......if.(space).{..............
11b20 20 20 2a 73 70 61 63 65 20 3d 20 27 5c 30 27 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 ..*space.=.'\0';...$............
11b40 62 65 74 77 65 65 6e 31 20 3d 20 62 65 74 77 65 65 6e 5f 61 72 67 73 3b 00 00 00 21 20 20 20 20 between1.=.between_args;...!....
11b60 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 32 20 3d 20 73 70 61 63 65 20 2b 20 31 3b 00 00 00 ........between2.=.space.+.1;...
11b80 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 36 20 .........}........}...........6.
11ba0 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 ...calendar.cal.=.load_calendar(
11bc0 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 2c 20 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 calendar_file,.year);...........
11be0 19 20 20 20 20 69 66 20 28 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 17 20 20 .....if.(show_year_flag).{......
11c00 20 20 20 20 20 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 ......show_year(cal);........}..
11c20 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 20 7b ......else.if.(show_month_arg).{
11c40 00 00 00 35 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f ...5........int.month.=.parse_mo
11c60 6e 74 68 28 63 61 6c 2c 20 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 3b 00 00 00 1f 20 20 20 nth(cal,.show_month_arg);.......
11c80 20 20 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 29 3b 00 00 00 05 .....show_month(cal,.month);....
11ca0 20 20 20 20 7d 00 00 00 1f 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6c 65 6e 67 74 ....}........else.if.(show_lengt
11cc0 68 5f 61 72 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 73 h_arg).{............char.month_s
11ce0 74 72 5b 32 30 5d 3b 00 00 00 10 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 3a 20 tr[20];............int.day;...:.
11d00 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 2c 20 22 .......sscanf(show_length_arg,."
11d20 25 73 20 25 64 22 2c 20 6d 6f 6e 74 68 5f 73 74 72 2c 20 26 64 61 79 29 3b 00 00 00 30 20 20 20 %s.%d",.month_str,.&day);...0...
11d40 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c .....int.month.=.parse_month(cal
11d60 2c 20 6d 6f 6e 74 68 5f 73 74 72 29 3b 00 00 00 53 20 20 20 20 20 20 20 20 73 68 6f 77 5f 64 61 ,.month_str);...S........show_da
11d80 79 5f 6c 65 6e 67 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 2c 20 77 65 65 6b 5f 66 y_length(cal,.month,.day,.week_f
11da0 6c 61 67 2c 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c 61 67 2c 20 79 65 61 72 5f 61 67 6f 5f 66 6c lag,.month_ago_flag,.year_ago_fl
11dc0 61 67 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 18 20 20 20 20 65 6c 73 65 20 69 66 20 28 6e 6f ag);........}........else.if.(no
11de0 77 5f 66 6c 61 67 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 73 68 6f 77 5f 63 75 72 72 65 6e w_flag).{............show_curren
11e00 74 5f 74 69 6d 65 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 t_time(cal);........}........els
11e20 65 20 69 66 20 28 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 29 20 7b 00 00 00 1b 20 20 20 20 20 e.if.(stopwatch_flag).{.........
11e40 20 20 20 72 75 6e 5f 73 74 6f 70 77 61 74 63 68 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 ...run_stopwatch(cal);........}.
11e60 00 00 21 20 20 20 20 65 6c 73 65 20 69 66 20 28 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 21 3d 20 ..!....else.if.(add_days_val.!=.
11e80 30 29 20 7b 00 00 00 24 20 20 20 20 20 20 20 20 61 64 64 5f 64 61 79 73 28 63 61 6c 2c 20 61 64 0).{...$........add_days(cal,.ad
11ea0 64 5f 64 61 79 73 5f 76 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 24 20 20 20 20 65 6c 73 d_days_val);........}...$....els
11ec0 65 20 69 66 20 28 62 65 74 77 65 65 6e 31 20 26 26 20 62 65 74 77 65 65 6e 32 29 20 7b 00 00 00 e.if.(between1.&&.between2).{...
11ee0 36 20 20 20 20 20 20 20 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 6........days_between_command(ca
11f00 6c 2c 20 62 65 74 77 65 65 6e 31 2c 20 62 65 74 77 65 65 6e 32 29 3b 00 00 00 05 20 20 20 20 7d l,.between1,.between2);........}
11f20 00 00 00 0a 20 20 20 20 65 6c 73 65 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f ........else.{............print_
11f40 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 usage(argv[0]);........}........
11f60 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 ........return.0;....}5.........
11f80 00 00 00 00 00 00 7b 01 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2c 30 ......{.......................,0
11fa0 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 0e 00 00 00 10 00 00 00 00 00 00 ..............5._...............
11fc0 00 00 00 00 00 0f 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 ................................
11fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
120a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
120c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
120e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6a 00 3e 1b 04 01 00 00 00 0a 00 f5 ....................j.>.........
12140 18 00 00 01 74 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 06 20 20 20 20 20 20 f5 18 00 00 01 ....t...........................
12160 75 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 f3 00 00 00 00 00 00 00 00 00 00 00 01 00 u...............................
12180 00 00 13 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 79 65 61 72 20 f5 18 00 00 00 f4 00 00 00 00 .......printf("--year...........
121a0 00 00 00 00 00 00 00 00 f5 18 00 00 00 7c 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 11 20 20 .............|..................
121c0 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 f5 18 00 00 00 7d 00 00 00 00 00 00 00 00 00 00 00 ..........int.t.....}...........
121e0 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 ................................
12200 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .........5......................
12220 00 7c 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 .|..............................
12240 00 f5 18 00 00 00 00 7c 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 77 00 00 00 13 00 00 00 f9 .......|...............w........
12260 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 f3 00 00 ................................
12280 00 13 00 00 00 00 00 00 00 00 00 00 00 81 00 00 00 06 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 ................................
122a0 00 00 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 74 01 00 00 06 00 00 00 00 00 00 00 00 ...................t............
122c0 00 00 00 0a 00 00 00 01 00 00 00 f7 2f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ca 00 00 00 00 ............/...................
122e0 00 00 00 35 81 5f d0 00 00 00 0f 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 01 00 ...5._..........................
12300 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
123a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
123c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
123e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
12460 00 00 00 00 00 00 00 00 00 6a 00 3e a7 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 .........j.>....................
12480 00 00 00 00 01 7f 00 00 00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 ..........#include.<stdio.h>....
124a0 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 #include.<stdlib.h>....#include.
124c0 3c 73 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 <string.h>....#include.<time.h>.
124e0 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 67 65 74 6f 70 74 2e 68 3e 00 00 00 00 00 00 00 10 74 79 ...#include.<getopt.h>........ty
12500 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 pedef.struct.{........int.year;.
12520 00 00 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 64 .......int.is_leap;........int.d
12540 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 20 6d ays_per_month[12];........char.m
12560 6f 6e 74 68 5f 6e 61 6d 65 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 61 onth_names[12][10];....}.calenda
12580 72 3b 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 r;.......8calendar.load_calendar
125a0 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 29 (const.char.*filename,.int.year)
125c0 20 7b 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 63 .{........calendar.cal;........c
125e0 61 6c 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c 65 al.year.=.year;........cal.is_le
12600 61 70 20 3d 20 30 3b 00 00 00 8e 20 20 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e 61 6d ap.=.0;........char.*default_nam
12620 65 73 5b 31 32 5d 20 3d 20 7b 22 6a 61 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 2c 22 es[12].=.{"january","february","
12640 6d 61 72 63 68 22 2c 22 61 70 72 69 6c 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a 75 6c march","april","may","june","jul
12660 79 22 2c 22 61 75 67 75 73 74 22 2c 22 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 65 72 y","august","september","october
12680 22 2c 22 6e 6f 76 65 6d 62 65 72 22 2c 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 20 20 ","november","december"};..."...
126a0 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 .for.(int.i.=.0;.i.<.12;.i++).{.
126c0 00 00 35 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 ..5........strcpy(cal.month_name
126e0 73 5b 69 5d 2c 20 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 20 20 s[i],.default_names[i]);.../....
12700 20 20 20 20 69 66 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e ....if.(i.==.1).cal.days_per_mon
12720 74 68 5b 69 5d 20 3d 20 32 38 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 th[i].=.28;...S........else.if.(
12740 69 20 3d 3d 20 33 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 i.==.3.||.i.==.5.||.i.==.8.||.i.
12760 3d 3d 20 31 30 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 ==.10).cal.days_per_month[i].=.3
12780 30 3b 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 0;...(........else.cal.days_per_
127a0 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 month[i].=.31;........}...#....F
127c0 49 4c 45 20 2a 66 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 ILE.*f.=.fopen(filename,."r");..
127e0 00 17 20 20 20 20 69 66 20 28 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 ......if.(!f).return.cal;.......
12800 20 63 68 61 72 20 6c 69 6e 65 5b 35 31 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 .char.line[512];...*....while.(f
12820 67 65 74 73 28 6c 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 gets(line,.sizeof(line),.f)).{..
12840 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 65 61 .-........if.(strncmp(line,."yea
12860 72 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 r:",.5).==.0).{................i
12880 6e 74 20 79 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 nt.y;...)............sscanf(line
128a0 2c 20 22 79 65 61 72 3a 20 25 64 22 2c 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 ,."year:.%d",.&y);...$..........
128c0 20 20 69 66 20 28 79 20 21 3d 20 79 65 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 20 20 ..if.(y.!=.year).continue;......
128e0 20 20 20 20 20 20 7d 00 00 00 2e 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c ......}............if.(strncmp(l
12900 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 22 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 20 20 ine,."month:",.6).==.0).{.......
12920 20 20 20 20 20 20 20 20 20 69 6e 74 20 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 .........int.m,.d;..............
12940 20 20 63 68 61 72 20 6e 61 6d 65 5b 32 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 20 20 ..char.name[20];...F............
12960 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 25 64 sscanf(line,."month:.%d.days:.%d
12980 20 6e 61 6d 65 3a 20 25 73 22 2c 20 26 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 20 20 .name:.%s",.&m,.&d,.name);...$..
129a0 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 ..........if.(m.>=.1.&&.m.<=.12)
129c0 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 5f 70 .{...,................cal.days_p
129e0 65 72 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 er_month[m-1].=.d;...3..........
12a00 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 2d 31 ......strcpy(cal.month_names[m-1
12a20 5d 2c 20 6e 61 6d 65 29 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 20 20 ],.name);................}......
12a40 20 20 20 20 20 20 7d 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c ......}...-........if.(strncmp(l
12a60 69 6e 65 2c 20 22 6c 65 61 70 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 ine,."leap:",.5).==.0).{........
12a80 20 20 20 20 20 20 20 20 69 6e 74 20 6c 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 ........int.l;...)............ss
12aa0 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 32 20 canf(line,."leap:.%d",.&l);...2.
12ac0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 ...........if.(year.==.cal.year)
12ae0 20 63 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 .cal.is_leap.=.l;............}..
12b00 00 05 20 20 20 20 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 20 20 ......}........fclose(f);.......
12b20 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2c 69 6e 74 20 70 61 72 .return.cal;....}.......,int.par
12b40 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 69 6e 70 se_month(calendar.cal,.char.*inp
12b60 75 74 29 20 7b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c ut).{..."....for.(int.i.=.0;.i.<
12b80 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 41 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d .12;.i++).{...A........if.(strcm
12ba0 70 28 69 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 p(input,.cal.month_names[i]).==.
12bc0 30 29 20 72 65 74 75 72 6e 20 69 20 2b 20 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 0).return.i.+.1;........}.......
12be0 20 72 65 74 75 72 6e 20 61 74 6f 69 28 69 6e 70 75 74 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 .return.atoi(input);....}.......
12c00 3b 69 6e 74 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 ;int.date_to_day_of_year(calenda
12c20 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 18 r.cal,.int.month,.int.day).{....
12c40 20 20 20 20 69 6e 74 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 3d 20 30 3b 00 00 00 29 20 20 20 20 ....int.day_of_year.=.0;...)....
12c60 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 6d 6f 6e 74 68 20 2d 20 31 3b 20 69 for.(int.i.=.0;.i.<.month.-.1;.i
12c80 2b 2b 29 20 7b 00 00 00 2d 20 20 20 20 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 ++).{...-........day_of_year.+=.
12ca0 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 05 20 20 20 20 7d 00 cal.days_per_month[i];........}.
12cc0 00 00 17 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 64 61 79 3b 00 00 00 17 20 20 .......day_of_year.+=.day;......
12ce0 20 20 72 65 74 75 72 6e 20 64 61 79 5f 6f 66 5f 79 65 61 72 3b 00 00 00 01 7d 00 00 00 00 00 00 ..return.day_of_year;....}......
12d00 00 56 69 6e 74 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 65 6e 64 61 .Vint.days_between_dates(calenda
12d20 72 20 63 61 6c 31 2c 20 69 6e 74 20 6d 31 2c 20 69 6e 74 20 64 31 2c 20 63 61 6c 65 6e 64 61 72 r.cal1,.int.m1,.int.d1,.calendar
12d40 20 63 61 6c 32 2c 20 69 6e 74 20 6d 32 2c 20 69 6e 74 20 64 32 29 20 7b 00 00 00 17 20 20 20 20 .cal2,.int.m2,.int.d2).{........
12d60 69 6e 74 20 79 31 20 3d 20 63 61 6c 31 2e 79 65 61 72 3b 00 00 00 17 20 20 20 20 69 6e 74 20 79 int.y1.=.cal1.year;........int.y
12d80 32 20 3d 20 63 61 6c 32 2e 79 65 61 72 3b 00 00 00 31 20 20 20 20 69 6e 74 20 64 6f 79 31 20 3d 2.=.cal2.year;...1....int.doy1.=
12da0 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 31 2c 20 6d 31 2c 20 64 .date_to_day_of_year(cal1,.m1,.d
12dc0 31 29 3b 00 00 00 31 20 20 20 20 69 6e 74 20 64 6f 79 32 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 1);...1....int.doy2.=.date_to_da
12de0 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 32 2c 20 6d 32 2c 20 64 32 29 3b 00 00 00 04 20 20 20 20 y_of_year(cal2,.m2,.d2);........
12e00 00 00 00 11 20 20 20 20 69 6e 74 20 64 61 79 73 20 3d 20 30 3b 00 00 00 13 20 20 20 20 69 66 20 ........int.days.=.0;........if.
12e20 28 79 31 20 3d 3d 20 79 32 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 64 (y1.==.y2).{............days.=.d
12e40 6f 79 32 20 2d 20 64 6f 79 31 3b 00 00 00 19 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 79 32 oy2.-.doy1;........}.else.if.(y2
12e60 20 3e 20 79 31 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 73 5f 69 6e 5f .>.y1).{...,........int.days_in_
12e80 79 31 20 3d 20 33 36 35 20 2b 20 63 61 6c 31 2e 69 73 5f 6c 65 61 70 3b 00 00 00 2a 20 20 20 20 y1.=.365.+.cal1.is_leap;...*....
12ea0 20 20 20 20 64 61 79 73 20 3d 20 28 64 61 79 73 5f 69 6e 5f 79 31 20 2d 20 64 6f 79 31 29 20 2b ....days.=.(days_in_y1.-.doy1).+
12ec0 20 64 6f 79 32 3b 00 00 00 2b 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d 20 79 .doy2;...+........for.(int.y.=.y
12ee0 31 20 2b 20 31 3b 20 79 20 3c 20 79 32 3b 20 79 2b 2b 29 20 7b 00 00 00 3d 20 20 20 20 20 20 20 1.+.1;.y.<.y2;.y++).{...=.......
12f00 20 20 20 20 20 63 61 6c 65 6e 64 61 72 20 79 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 .....calendar.ycal.=.load_calend
12f20 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 27 20 20 20 20 20 20 ar("calendar.txt",.y);...'......
12f40 20 20 20 20 20 20 64 61 79 73 20 2b 3d 20 33 36 35 20 2b 20 79 63 61 6c 2e 69 73 5f 6c 65 61 70 ......days.+=.365.+.ycal.is_leap
12f60 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 ;............}........}.else.{..
12f80 00 3e 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 .>........days.=.days_between_da
12fa0 74 65 73 28 63 61 6c 32 2c 20 6d 32 2c 20 64 32 2c 20 63 61 6c 31 2c 20 6d 31 2c 20 64 31 29 3b tes(cal2,.m2,.d2,.cal1,.m1,.d1);
12fc0 00 00 00 05 20 20 20 20 7d 00 00 00 10 20 20 20 20 72 65 74 75 72 6e 20 64 61 79 73 3b 00 00 00 ........}........return.days;...
12fe0 01 7d 00 00 00 00 00 00 00 66 76 6f 69 64 20 73 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 .}.......fvoid.show_day_length(c
13000 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 2c alendar.cal,.int.month,.int.day,
13020 20 69 6e 74 20 77 65 65 6b 5f 66 6c 61 67 2c 20 69 6e 74 20 6d 6f 6e 74 68 5f 66 6c 61 67 2c 20 .int.week_flag,.int.month_flag,.
13040 69 6e 74 20 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 52 20 20 20 20 69 66 20 28 6d 6f 6e 74 int.year_flag).{...R....if.(mont
13060 68 20 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 20 7c h.<.1.||.month.>.12.||.day.<.1.|
13080 7c 20 64 61 79 20 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 |.day.>.cal.days_per_month[month
130a0 2d 31 5d 29 20 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 -1]).{...!........printf("invali
130c0 64 20 64 61 74 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 d.date\n");............return;..
130e0 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 6e 6f ......}................time_t.no
13100 77 5f 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2a 20 20 20 20 73 74 72 75 63 74 20 w_t.=.time(NULL);...*....struct.
13120 74 6d 20 2a 6e 6f 77 5f 74 6d 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 6e 6f 77 5f 74 29 3b 00 tm.*now_tm.=.localtime(&now_t);.
13140 00 00 2e 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 3d 20 6e 6f 77 5f 74 6d .......int.current_year.=.now_tm
13160 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 2b 20 20 20 20 69 6e 74 20 63 75 72 ->tm_year.+.1900;...+....int.cur
13180 72 65 6e 74 5f 6d 6f 6e 74 68 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b rent_month.=.now_tm->tm_mon.+.1;
131a0 00 00 00 26 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 64 61 79 20 3d 20 6e 6f 77 5f 74 6d ...&....int.current_day.=.now_tm
131c0 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 04 20 20 20 20 00 00 00 47 20 20 20 20 63 61 6c 65 6e 64 ->tm_mday;...........G....calend
131e0 61 72 20 63 75 72 72 65 6e 74 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 ar.current_cal.=.load_calendar("
13200 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 3b 00 00 00 calendar.txt",.current_year);...
13220 04 20 20 20 20 00 00 00 60 20 20 20 20 69 6e 74 20 64 61 79 73 5f 61 67 6f 20 3d 20 64 61 79 73 ........`....int.days_ago.=.days
13240 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 2c 20 _between_dates(cal,.month,.day,.
13260 63 75 72 72 65 6e 74 5f 63 61 6c 2c 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 2c 20 63 75 72 72 current_cal,.current_month,.curr
13280 65 6e 74 5f 64 61 79 29 3b 00 00 00 04 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 64 61 79 ent_day);................if.(day
132a0 73 5f 61 67 6f 20 3c 20 30 29 20 7b 00 00 00 4a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 s_ago.<.0).{...J........printf("
132c0 25 73 20 25 64 20 69 73 20 69 6e 20 74 68 65 20 66 75 74 75 72 65 5c 6e 22 2c 20 63 61 6c 2e 6d %s.%d.is.in.the.future\n",.cal.m
132e0 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 0f 20 20 onth_names[month-1],.day);......
13300 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 ......return;........}..........
13320 00 18 20 20 20 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 30 29 20 7b 00 00 00 43 20 20 ......if.(days_ago.==.0).{...C..
13340 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 74 6f 64 61 79 5c 6e 22 ......printf("%s.%d.was.today\n"
13360 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 ,.cal.month_names[month-1],.day)
13380 3b 00 00 00 1f 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 ;........}.else.if.(days_ago.==.
133a0 31 29 20 7b 00 00 00 47 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 1).{...G........printf("%s.%d.wa
133c0 73 20 79 65 73 74 65 72 64 61 79 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b s.yesterday\n",.cal.month_names[
133e0 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 month-1],.day);........}.else.{.
13400 00 00 18 20 20 20 20 20 20 20 20 69 66 20 28 77 65 65 6b 5f 66 6c 61 67 29 20 7b 00 00 00 25 20 ...........if.(week_flag).{...%.
13420 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 77 65 65 6b 73 20 3d 20 64 61 79 73 5f 61 67 6f 20 ...........int.weeks.=.days_ago.
13440 2f 20 37 3b 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 72 65 6d 5f 64 61 79 73 /.7;...(............int.rem_days
13460 20 3d 20 64 61 79 73 5f 61 67 6f 20 25 20 37 3b 00 00 00 88 20 20 20 20 20 20 20 20 20 20 20 20 .=.days_ago.%.7;................
13480 69 66 20 28 72 65 6d 5f 64 61 79 73 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 if.(rem_days.==.0).printf("%s.%d
134a0 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 77 61 73 20 25 64 20 77 65 .was.%d.days.ago.which.was.%d.we
134c0 65 6b 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 eks.ago\n",.cal.month_names[mont
134e0 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 77 65 65 6b 73 29 3b 00 00 00 90 h-1],.day,.days_ago,.weeks);....
13500 20 20 20 20 20 20 20 20 20 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 ............else.printf("%s.%d.w
13520 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 77 61 73 20 25 64 20 77 65 65 6b as.%d.days.ago.which.was.%d.week
13540 73 20 61 6e 64 20 25 64 20 64 61 79 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f s.and.%d.days.ago\n",.cal.month_
13560 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 77 names[month-1],.day,.days_ago,.w
13580 65 65 6b 73 2c 20 72 65 6d 5f 64 61 79 73 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 eeks,.rem_days);............}...
135a0 1e 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 6d 6f 6e 74 68 5f 66 6c 61 67 29 20 7b 00 .........else.if.(month_flag).{.
135c0 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 73 5f 61 67 6f 20 3d 20 ...............int.months_ago.=.
135e0 30 3b 00 00 00 25 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 79 65 61 72 20 0;...%............int.temp_year.
13600 3d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 =.cal.year;...#............int.t
13620 65 6d 70 5f 6d 6f 6e 74 68 20 3d 20 6d 6f 6e 74 68 3b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 emp_month.=.month;..............
13640 20 20 69 6e 74 20 74 65 6d 70 5f 64 61 79 20 3d 20 64 61 79 3b 00 00 00 6b 20 20 20 20 20 20 20 ..int.temp_day.=.day;...k.......
13660 20 20 20 20 20 77 68 69 6c 65 20 28 74 65 6d 70 5f 79 65 61 72 20 3c 20 63 75 72 72 65 6e 74 5f .....while.(temp_year.<.current_
13680 79 65 61 72 20 7c 7c 20 28 74 65 6d 70 5f 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 5f 79 65 year.||.(temp_year.==.current_ye
136a0 61 72 20 26 26 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3c 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 ar.&&.temp_month.<.current_month
136c0 29 29 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f 6d 6f 6e )).{....................temp_mon
136e0 74 68 2b 2b 3b 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d th++;...&................if.(tem
13700 70 5f 6d 6f 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 p_month.>.12).{...#.............
13720 20 20 20 20 20 20 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 20 31 3b 00 00 00 20 20 20 20 20 20 20 .......temp_month.=.1;..........
13740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f 79 65 61 72 2b 2b 3b 00 00 00 11 20 20 ..............temp_year++;......
13760 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 ..............}.................
13780 20 20 20 6d 6f 6e 74 68 73 5f 61 67 6f 2b 2b 3b 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 20 ...months_ago++;...4............
137a0 20 20 20 20 69 66 20 28 74 65 6d 70 5f 79 65 61 72 20 3e 20 63 75 72 72 65 6e 74 5f 79 65 61 72 ....if.(temp_year.>.current_year
137c0 29 20 62 72 65 61 6b 3b 00 00 00 53 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 ).break;...S................if.(
137e0 74 65 6d 70 5f 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 26 26 20 74 65 6d temp_year.==.current_year.&&.tem
13800 70 5f 6d 6f 6e 74 68 20 3e 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 29 20 62 72 65 61 6b 3b 00 p_month.>.current_month).break;.
13820 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 65 20 20 20 20 20 20 20 20 20 20 20 20 ...............}...e............
13840 69 66 20 28 74 65 6d 70 5f 64 61 79 20 3e 20 63 75 72 72 65 6e 74 5f 64 61 79 20 26 26 20 74 65 if.(temp_day.>.current_day.&&.te
13860 6d 70 5f 6d 6f 6e 74 68 20 3d 3d 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 26 26 20 74 65 6d mp_month.==.current_month.&&.tem
13880 70 5f 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 20 7b 00 00 00 1d 20 20 20 p_year.==.current_year).{.......
138a0 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 73 5f 61 67 6f 2d 2d 3b 00 00 00 0d 20 20 .............months_ago--;......
138c0 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 89 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 ..........}................print
138e0 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 77 f("%s.%d.was.%d.days.ago.which.w
13900 61 73 20 61 70 70 72 6f 78 69 6d 61 74 65 6c 79 20 25 64 20 6d 6f 6e 74 68 73 20 61 67 6f 5c 6e as.approximately.%d.months.ago\n
13920 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 ",.cal.month_names[month-1],.day
13940 2c 20 64 61 79 73 5f 61 67 6f 2c 20 6d 6f 6e 74 68 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 ,.days_ago,.months_ago);........
13960 20 20 20 20 7d 00 00 00 1d 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 79 65 61 72 5f 66 ....}............else.if.(year_f
13980 6c 61 67 29 20 7b 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 65 61 72 73 5f lag).{...4............int.years_
139a0 61 67 6f 20 3d 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 2d 20 63 61 6c 2e 79 65 61 72 3b 00 00 ago.=.current_year.-.cal.year;..
139c0 00 59 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 .Y............if.(current_month.
139e0 3c 20 6d 6f 6e 74 68 20 7c 7c 20 28 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 3d 3d 20 6d 6f 6e <.month.||.(current_month.==.mon
13a00 74 68 20 26 26 20 63 75 72 72 65 6e 74 5f 64 61 79 20 3c 20 64 61 79 29 29 20 7b 00 00 00 1c 20 th.&&.current_day.<.day)).{.....
13a20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 65 61 72 73 5f 61 67 6f 2d 2d 3b 00 00 00 0d 20 ...............years_ago--;.....
13a40 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 2d 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 ...........}...-............if.(
13a60 79 65 61 72 73 5f 61 67 6f 20 3c 20 30 29 20 79 65 61 72 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 years_ago.<.0).years_ago.=.0;...
13a80 87 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 .............printf("%s.%d.was.%
13aa0 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 77 61 73 20 61 70 70 72 6f 78 69 6d 61 74 65 d.days.ago.which.was.approximate
13ac0 6c 79 20 25 64 20 79 65 61 72 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 ly.%d.years.ago\n",.cal.month_na
13ae0 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 79 65 61 mes[month-1],.day,.days_ago,.yea
13b00 72 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 0e 20 20 20 20 20 20 20 rs_ago);............}...........
13b20 20 65 6c 73 65 20 7b 00 00 00 57 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 .else.{...W............printf("%
13b40 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e s.%d.was.%d.days.ago\n",.cal.mon
13b60 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f th_names[month-1],.day,.days_ago
13b80 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 );............}........}....}...
13ba0 00 00 00 00 1e 76 6f 69 64 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 6c .....void.show_year(calendar.cal
13bc0 29 20 7b 00 00 00 22 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 5c 6e 22 2c 20 63 ).{..."....printf("year.%d\n",.c
13be0 61 6c 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 70 al.year);...+....if.(cal.is_leap
13c00 29 20 70 72 69 6e 74 66 28 22 6c 65 61 70 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 22 20 20 20 20 ).printf("leap.year\n");..."....
13c20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 for.(int.i.=.0;.i.<.12;.i++).{..
13c40 00 45 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e .E........printf("%s.%d\n",.cal.
13c60 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e month_names[i],.cal.days_per_mon
13c80 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 2a 76 6f 69 th[i]);........}....}.......*voi
13ca0 64 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d d.show_month(calendar.cal,.int.m
13cc0 6f 6e 74 68 29 20 7b 00 00 00 22 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c 20 onth).{..."....if.(month.<.1.||.
13ce0 6d 6f 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 month.>.12).{..."........printf(
13d00 22 69 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 "invalid.month\n");............r
13d20 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 25 eturn;........}...:....printf("%
13d40 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 s.%d\n",.cal.month_names[month-1
13d60 5d 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 20 ],.cal.year);...%....printf("su.
13d80 6d 6f 20 74 75 20 77 65 20 74 68 20 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 17 20 20 20 20 73 74 mo.tu.we.th.fr.sa\n");........st
13da0 72 75 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f 79 ruct.tm.tm.=.{0};...!....tm.tm_y
13dc0 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 2d 20 31 39 30 30 3b 00 00 00 1a 20 20 20 20 74 6d ear.=.cal.year.-.1900;........tm
13de0 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e 74 .tm_mon.=.month.-.1;........tm.t
13e00 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 00 00 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b 00 m_mday.=.1;........mktime(&tm);.
13e20 00 00 1f 20 20 20 20 69 6e 74 20 66 69 72 73 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 61 .......int.first_day.=.tm.tm_wda
13e40 79 3b 00 00 00 36 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 69 y;...6....for.(int.i.=.0;.i.<.fi
13e60 72 73 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 3c rst_day;.i++).printf("...");...<
13e80 20 20 20 20 66 6f 72 20 28 69 6e 74 20 64 20 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 79 ....for.(int.d.=.1;.d.<=.cal.day
13ea0 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 1a s_per_month[month-1];.d++).{....
13ec0 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 20 ........printf("%2d.",.d);...3..
13ee0 20 20 20 20 20 20 69 66 20 28 28 66 69 72 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d 3d ......if.((first_day.+.d).%.7.==
13f00 20 30 29 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 20 .0).printf("\n");........}......
13f20 20 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 26 76 6f 69 64 ..printf("\n");....}.......&void
13f40 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 .show_current_time(calendar.cal)
13f60 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b .{........time_t.t.=.time(NULL);
13f80 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 6c ...%....struct.tm.*local.=.local
13fa0 74 69 6d 65 28 26 74 29 3b 00 00 00 25 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 6c 6f 63 61 time(&t);...%....int.year.=.loca
13fc0 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 22 20 20 20 20 69 6e 74 20 6d 6f l->tm_year.+.1900;..."....int.mo
13fe0 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1d 20 20 20 20 nth.=.local->tm_mon.+.1;........
14000 69 6e 74 20 64 61 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1e 20 20 20 int.day.=.local->tm_mday;.......
14020 20 69 6e 74 20 68 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1f 20 .int.hour.=.local->tm_hour;.....
14040 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 00 ...int.minute.=.local->tm_min;..
14060 00 1f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 63 ......int.second.=.local->tm_sec
14080 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 5f 63 61 6c 20 3d 20 6c 6f 61 64 ;...;....calendar.cur_cal.=.load
140a0 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 3b _calendar("calendar.txt",.year);
140c0 00 00 00 67 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 25 73 20 25 64 20 25 30 32 64 3a 25 30 ...g....printf("%d.%s.%d.%02d:%0
140e0 32 64 3a 25 30 32 64 5c 6e 22 2c 20 79 65 61 72 2c 20 63 75 72 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 2d:%02d\n",.year,.cur_cal.month_
14100 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 68 6f 75 72 2c 20 6d 69 6e 75 74 names[month-1],.day,.hour,.minut
14120 65 2c 20 73 65 63 6f 6e 64 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 72 75 6e e,.second);....}......."void.run
14140 5f 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 25 20 20 _stopwatch(calendar.cal).{...%..
14160 20 20 70 72 69 6e 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 61 72 74 5c 6e ..printf("press.enter.to.start\n
14180 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1e 20 20 20 20 74 69 6d ");........getchar();........tim
141a0 65 5f 74 20 73 74 61 72 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2c 20 20 20 20 70 e_t.start.=.time(NULL);...,....p
141c0 72 69 6e 74 66 28 22 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 rintf("running.press.enter.to.st
141e0 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1c 20 20 20 op\n");........getchar();.......
14200 20 74 69 6d 65 5f 74 20 65 6e 64 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 1c 20 20 20 .time_t.end.=.time(NULL);.......
14220 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 20 2d 20 73 74 61 72 74 3b 00 00 00 1c 20 20 20 .long.diff.=.end.-.start;.......
14240 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 20 .int.hours.=.diff./.3600;...%...
14260 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 36 .int.minutes.=.(diff.%.3600)./.6
14280 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 36 0;........int.seconds.=.diff.%.6
142a0 30 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 64 0;...8....printf("%02d:%02d:%02d
142c0 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 00 \n",.hours,.minutes,.seconds);..
142e0 00 01 7d 00 00 00 00 00 00 00 27 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 6c 65 6e 64 61 ..}.......'void.add_days(calenda
14300 72 20 63 61 6c 2c 20 69 6e 74 20 64 61 79 73 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 r.cal,.int.days).{........time_t
14320 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 16 20 20 20 20 74 20 2b 3d 20 64 61 79 .t.=.time(NULL);........t.+=.day
14340 73 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 66 75 74 s.*.86400;...&....struct.tm.*fut
14360 75 72 65 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 26 20 20 20 20 69 6e 74 20 ure.=.localtime(&t);...&....int.
14380 79 65 61 72 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 year.=.future->tm_year.+.1900;..
143a0 00 23 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 6f 6e .#....int.month.=.future->tm_mon
143c0 20 2b 20 31 3b 00 00 00 1e 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 66 75 74 75 72 65 2d 3e 74 .+.1;........int.day.=.future->t
143e0 6d 5f 6d 64 61 79 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 66 75 74 5f 63 61 6c 20 m_mday;...;....calendar.fut_cal.
14400 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 =.load_calendar("calendar.txt",.
14420 79 65 61 72 29 3b 00 00 00 5c 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 64 61 79 73 20 66 72 year);...\....printf("%d.days.fr
14440 6f 6d 20 6e 6f 77 20 69 73 20 25 64 20 25 73 20 25 64 5c 6e 22 2c 20 64 61 79 73 2c 20 79 65 61 om.now.is.%d.%s.%d\n",.days,.yea
14460 72 2c 20 66 75 74 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c r,.fut_cal.month_names[month-1],
14480 20 64 61 79 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 43 76 6f 69 64 20 64 61 79 73 5f 62 65 74 .day);....}.......Cvoid.days_bet
144a0 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 ween_command(calendar.cal,.char.
144c0 2a 64 61 74 65 31 2c 20 63 68 61 72 20 2a 64 61 74 65 32 29 20 7b 00 00 00 1a 20 20 20 20 69 6e *date1,.char.*date2).{........in
144e0 74 20 79 31 2c 6d 31 2c 64 31 2c 79 32 2c 6d 32 2c 64 32 3b 00 00 00 2d 20 20 20 20 73 73 63 61 t.y1,m1,d1,y2,m2,d2;...-....ssca
14500 6e 66 28 64 61 74 65 31 2c 20 22 25 64 2d 25 64 2d 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c 20 nf(date1,."%d-%d-%d",.&y1,.&m1,.
14520 26 64 31 29 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 61 74 65 32 2c 20 22 25 64 2d 25 &d1);...-....sscanf(date2,."%d-%
14540 64 2d 25 64 22 2c 20 26 79 32 2c 20 26 6d 32 2c 20 26 64 32 29 3b 00 00 00 23 20 20 20 20 73 74 d-%d",.&y2,.&m2,.&d2);...#....st
14560 72 75 63 74 20 74 6d 20 74 6d 31 20 3d 20 7b 30 7d 2c 20 74 6d 32 20 3d 20 7b 30 7d 3b 00 00 00 ruct.tm.tm1.=.{0},.tm2.=.{0};...
14580 1c 20 20 20 20 74 6d 31 2e 74 6d 5f 79 65 61 72 20 3d 20 79 31 20 2d 20 31 39 30 30 3b 00 00 00 .....tm1.tm_year.=.y1.-.1900;...
145a0 18 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 31 20 2d 20 31 3b 00 00 00 15 20 20 20 .....tm1.tm_mon.=.m1.-.1;.......
145c0 20 74 6d 31 2e 74 6d 5f 6d 64 61 79 20 3d 20 64 31 3b 00 00 00 1c 20 20 20 20 74 6d 32 2e 74 6d .tm1.tm_mday.=.d1;........tm2.tm
145e0 5f 79 65 61 72 20 3d 20 79 32 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 32 2e 74 6d _year.=.y2.-.1900;........tm2.tm
14600 5f 6d 6f 6e 20 3d 20 6d 32 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 64 61 _mon.=.m2.-.1;........tm2.tm_mda
14620 79 20 3d 20 64 32 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 31 20 3d 20 6d 6b y.=.d2;........time_t.time1.=.mk
14640 74 69 6d 65 28 26 74 6d 31 29 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 32 20 time(&tm1);........time_t.time2.
14660 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 32 29 3b 00 00 00 28 20 20 20 20 6c 6f 6e 67 20 64 69 66 66 =.mktime(&tm2);...(....long.diff
14680 20 3d 20 28 74 69 6d 65 32 20 2d 20 74 69 6d 65 31 29 20 2f 20 38 36 34 30 30 3b 00 00 00 1f 20 .=.(time2.-.time1)./.86400;.....
146a0 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 00 ...if.(diff.<.0).diff.=.-diff;..
146c0 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 64 69 66 66 65 72 65 6e 63 65 20 25 6c 64 20 64 61 79 .*....printf("difference.%ld.day
146e0 73 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 70 72 s\n",.diff);....}........void.pr
14700 69 6e 74 5f 75 73 61 67 65 28 63 68 61 72 20 2a 70 72 6f 67 29 20 7b 00 00 00 29 20 20 20 20 70 int_usage(char.*prog).{...)....p
14720 72 69 6e 74 66 28 22 75 73 61 67 65 20 25 73 20 5b 6f 70 74 69 6f 6e 73 5d 5c 6e 22 2c 20 70 72 rintf("usage.%s.[options]\n",.pr
14740 6f 67 29 3b 00 00 00 33 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 79 65 61 72 20 59 59 59 59 20 og);...3....printf("--year.YYYY.
14760 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 49 20 ..............set.year\n");...I.
14780 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 79 65 61 72 20 20 20 20 20 20 20 20 20 20 ...printf("--show-year..........
147a0 20 20 20 20 20 73 68 6f 77 20 63 61 6c 65 6e 64 61 72 20 66 6f 72 20 63 75 72 72 65 6e 74 20 79 .....show.calendar.for.current.y
147c0 65 61 72 5c 6e 22 29 3b 00 00 00 35 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6d ear\n");...5....printf("--show-m
147e0 6f 6e 74 68 20 4d 4d 20 6f 72 20 6e 61 6d 65 20 20 20 73 68 6f 77 20 6d 6f 6e 74 68 5c 6e 22 29 onth.MM.or.name...show.month\n")
14800 3b 00 00 00 4c 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c ;...L....printf("--show-length.\
14820 22 6d 6f 6e 74 68 20 64 61 79 5c 22 20 73 68 6f 77 20 68 6f 77 20 6c 6f 6e 67 20 61 67 6f 20 74 "month.day\".show.how.long.ago.t
14840 68 61 74 20 64 61 74 65 20 77 61 73 5c 6e 22 29 3b 00 00 00 49 20 20 20 20 70 72 69 6e 74 66 28 hat.date.was\n");...I....printf(
14860 22 2d 2d 77 65 65 6b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 "--week....................show.
14880 77 65 65 6b 73 20 61 67 6f 20 69 6e 73 74 65 61 64 20 6f 66 20 64 61 79 73 5c 6e 22 29 3b 00 00 weeks.ago.instead.of.days\n");..
148a0 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 6d 6f 6e 74 68 73 20 20 20 20 20 20 20 20 20 20 .:....printf("--months..........
148c0 20 20 20 20 20 20 20 20 73 68 6f 77 20 6d 6f 6e 74 68 73 20 61 67 6f 5c 6e 22 29 3b 00 00 00 39 ........show.months.ago\n");...9
148e0 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 79 65 61 72 73 20 20 20 20 20 20 20 20 20 20 20 20 20 ....printf("--years.............
14900 20 20 20 20 20 20 73 68 6f 77 20 79 65 61 72 73 20 61 67 6f 5c 6e 22 29 3b 00 00 00 3c 20 20 20 ......show.years.ago\n");...<...
14920 20 70 72 69 6e 74 66 28 22 2d 2d 6e 6f 77 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .printf("--now..................
14940 20 20 20 73 68 6f 77 20 63 75 72 72 65 6e 74 20 74 69 6d 65 5c 6e 22 29 3b 00 00 00 38 20 20 20 ...show.current.time\n");...8...
14960 20 70 72 69 6e 74 66 28 22 2d 2d 73 74 6f 70 77 61 74 63 68 20 20 20 20 20 20 20 20 20 20 20 20 .printf("--stopwatch............
14980 20 20 20 72 75 6e 20 73 74 6f 70 77 61 74 63 68 5c 6e 22 29 3b 00 00 00 3e 20 20 20 20 70 72 69 ...run.stopwatch\n");...>....pri
149a0 6e 74 66 28 22 2d 2d 61 64 64 2d 64 61 79 73 20 4e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 ntf("--add-days.N..............a
149c0 64 64 20 4e 20 64 61 79 73 20 74 6f 20 74 6f 64 61 79 5c 6e 22 29 3b 00 00 00 47 20 20 20 20 70 dd.N.days.to.today\n");...G....p
149e0 72 69 6e 74 66 28 22 2d 2d 62 65 74 77 65 65 6e 20 59 59 59 59 2d 4d 4d 2d 44 44 20 59 59 59 59 rintf("--between.YYYY-MM-DD.YYYY
14a00 2d 4d 4d 2d 44 44 20 64 61 79 73 20 62 65 74 77 65 65 6e 20 74 77 6f 20 64 61 74 65 73 5c 6e 22 -MM-DD.days.between.two.dates\n"
14a20 29 3b 00 00 00 43 20 20 20 20 70 72 69 6e 74 66 28 22 2d 2d 63 61 6c 65 6e 64 61 72 2d 66 69 6c );...C....printf("--calendar-fil
14a40 65 20 46 49 4c 45 20 20 20 20 20 20 75 73 65 20 63 75 73 74 6f 6d 20 63 61 6c 65 6e 64 61 72 20 e.FILE......use.custom.calendar.
14a60 66 69 6c 65 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 21 69 6e 74 20 6d 61 69 6e 28 69 file\n");....}.......!int.main(i
14a80 6e 74 20 61 72 67 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 76 29 20 7b 00 00 00 14 20 20 20 20 69 nt.argc,.char.**argv).{........i
14aa0 6e 74 20 79 65 61 72 20 3d 20 32 30 32 36 3b 00 00 00 29 20 20 20 20 63 68 61 72 20 2a 63 61 6c nt.year.=.2026;...)....char.*cal
14ac0 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 3b 00 00 00 1b endar_file.=."calendar.txt";....
14ae0 20 20 20 20 69 6e 74 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 20 20 ....int.show_year_flag.=.0;.....
14b00 20 20 20 63 68 61 72 20 2a 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 ...char.*show_month_arg.=.NULL;.
14b20 00 00 21 20 20 20 20 63 68 61 72 20 2a 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 4e ..!....char.*show_length_arg.=.N
14b40 55 4c 4c 3b 00 00 00 16 20 20 20 20 69 6e 74 20 77 65 65 6b 5f 66 6c 61 67 20 3d 20 30 3b 00 00 ULL;........int.week_flag.=.0;..
14b60 00 1b 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 ......int.month_ago_flag.=.0;...
14b80 1a 20 20 20 20 69 6e 74 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 15 20 .....int.year_ago_flag.=.0;.....
14ba0 20 20 20 69 6e 74 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 ...int.now_flag.=.0;........int.
14bc0 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 19 20 20 20 20 69 6e 74 20 61 stopwatch_flag.=.0;........int.a
14be0 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 30 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 dd_days_val.=.0;........char.*be
14c00 74 77 65 65 6e 31 20 3d 20 4e 55 4c 4c 3b 00 00 00 1a 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 tween1.=.NULL;........char.*betw
14c20 65 65 6e 32 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 2b 20 20 20 20 73 74 61 74 een2.=.NULL;...........+....stat
14c40 69 63 20 73 74 72 75 63 74 20 6f 70 74 69 6f 6e 20 6c 6f 6e 67 5f 6f 70 74 69 6f 6e 73 5b 5d 20 ic.struct.option.long_options[].
14c60 3d 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 22 2c 20 72 65 71 75 69 72 65 64 =.{...,........{"year",.required
14c80 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 79 27 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 20 7b _argument,.0,.'y'},...+........{
14ca0 22 73 68 6f 77 2d 79 65 61 72 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 59 27 "show-year",.no_argument,.0,.'Y'
14cc0 7d 2c 00 00 00 32 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6d 6f 6e 74 68 22 2c 20 72 65 71 },...2........{"show-month",.req
14ce0 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6d 27 7d 2c 00 00 00 33 20 20 20 20 uired_argument,.0,.'m'},...3....
14d00 20 20 20 20 7b 22 73 68 6f 77 2d 6c 65 6e 67 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 ....{"show-length",.required_arg
14d20 75 6d 65 6e 74 2c 20 30 2c 20 27 6c 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 77 65 65 ument,.0,.'l'},...&........{"wee
14d40 6b 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 77 27 7d 2c 00 00 00 28 20 20 20 k",.no_argument,.0,.'w'},...(...
14d60 20 20 20 20 20 7b 22 6d 6f 6e 74 68 73 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 .....{"months",.no_argument,.0,.
14d80 27 4d 27 7d 2c 00 00 00 27 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 73 22 2c 20 6e 6f 5f 61 72 'M'},...'........{"years",.no_ar
14da0 67 75 6d 65 6e 74 2c 20 30 2c 20 27 72 27 7d 2c 00 00 00 25 20 20 20 20 20 20 20 20 7b 22 6e 6f gument,.0,.'r'},...%........{"no
14dc0 77 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6e 27 7d 2c 00 00 00 2b 20 20 20 w",.no_argument,.0,.'n'},...+...
14de0 20 20 20 20 20 7b 22 73 74 6f 70 77 61 74 63 68 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 .....{"stopwatch",.no_argument,.
14e00 30 2c 20 27 73 27 7d 2c 00 00 00 30 20 20 20 20 20 20 20 20 7b 22 61 64 64 2d 64 61 79 73 22 2c 0,.'s'},...0........{"add-days",
14e20 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 61 27 7d 2c 00 00 00 2f .required_argument,.0,.'a'},.../
14e40 20 20 20 20 20 20 20 20 7b 22 62 65 74 77 65 65 6e 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 ........{"between",.required_arg
14e60 75 6d 65 6e 74 2c 20 30 2c 20 27 62 27 7d 2c 00 00 00 35 20 20 20 20 20 20 20 20 7b 22 63 61 6c ument,.0,.'b'},...5........{"cal
14e80 65 6e 64 61 72 2d 66 69 6c 65 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 endar-file",.required_argument,.
14ea0 30 2c 20 27 63 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 68 65 6c 70 22 2c 20 6e 6f 5f 0,.'c'},...&........{"help",.no_
14ec0 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 68 27 7d 2c 00 00 00 14 20 20 20 20 20 20 20 20 7b 30 argument,.0,.'h'},............{0
14ee0 2c 20 30 2c 20 30 2c 20 30 7d 00 00 00 06 20 20 20 20 7d 3b 00 00 00 04 20 20 20 20 00 00 00 19 ,.0,.0,.0}........};............
14f00 20 20 20 20 69 6e 74 20 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 20 3d 20 30 3b 00 00 00 0a 20 20 20 ....int.option_index.=.0;.......
14f20 20 69 6e 74 20 63 3b 00 00 00 1e 20 20 20 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 5f 61 72 67 .int.c;........char.*between_arg
14f40 73 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 6a 20 20 20 20 77 68 69 6c 65 20 28 s.=.NULL;...........j....while.(
14f60 28 63 20 3d 20 67 65 74 6f 70 74 5f 6c 6f 6e 67 28 61 72 67 63 2c 20 61 72 67 76 2c 20 22 79 3a (c.=.getopt_long(argc,.argv,."y:
14f80 59 3a 6d 3a 6c 3a 77 4d 20 72 20 6e 20 73 20 61 3a 62 3a 63 3a 68 22 2c 20 6c 6f 6e 67 5f 6f 70 Y:m:l:wM.r.n.s.a:b:c:h",.long_op
14fa0 74 69 6f 6e 73 2c 20 26 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 29 29 20 21 3d 20 2d 31 29 20 7b 00 tions,.&option_index)).!=.-1).{.
14fc0 00 00 14 20 20 20 20 20 20 20 20 73 77 69 74 63 68 20 28 63 29 20 7b 00 00 00 15 20 20 20 20 20 ...........switch.(c).{.........
14fe0 20 20 20 20 20 20 20 63 61 73 65 20 27 79 27 3a 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 .......case.'y':...$............
15000 20 20 20 20 79 65 61 72 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 ....year.=.atoi(optarg);........
15020 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 ............break;..............
15040 20 20 63 61 73 65 20 27 59 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 ..case.'Y':...#................s
15060 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 how_year_flag.=.1;..............
15080 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 ......break;................case
150a0 20 27 6d 27 3a 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f .'m':...(................show_mo
150c0 6e 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 nth_arg.=.optarg;...............
150e0 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 .....break;................case.
15100 27 6c 27 3a 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6c 65 6e 'l':...)................show_len
15120 67 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 gth_arg.=.optarg;...............
15140 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 .....break;................case.
15160 27 77 27 3a 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 77 65 65 6b 5f 66 6c 61 'w':....................week_fla
15180 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b g.=.1;....................break;
151a0 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 4d 27 3a 00 00 00 23 20 20 20 ................case.'M':...#...
151c0 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 31 3b .............month_ago_flag.=.1;
151e0 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 ....................break;......
15200 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 72 27 3a 00 00 00 22 20 20 20 20 20 20 20 20 20 ..........case.'r':...".........
15220 20 20 20 20 20 20 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 .......year_ago_flag.=.1;.......
15240 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 .............break;.............
15260 20 20 20 63 61 73 65 20 27 6e 27 3a 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ...case.'n':....................
15280 6e 6f 77 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 now_flag.=.1;...................
152a0 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 73 27 3a .break;................case.'s':
152c0 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 6f 70 77 61 74 63 68 5f 66 6c ...#................stopwatch_fl
152e0 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b ag.=.1;....................break
15300 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 61 27 3a 00 00 00 2c 20 20 ;................case.'a':...,..
15320 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 61 74 6f ..............add_days_val.=.ato
15340 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 i(optarg);....................br
15360 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 62 27 3a 00 00 00 eak;................case.'b':...
15380 26 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 &................between_args.=.
153a0 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b optarg;....................break
153c0 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 63 27 3a 00 00 00 27 20 20 ;................case.'c':...'..
153e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 6f 70 ..............calendar_file.=.op
15400 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 targ;....................break;.
15420 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 68 27 3a 00 00 00 25 20 20 20 20 ...............case.'h':...%....
15440 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 ............print_usage(argv[0])
15460 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 30 3b 00 00 ;....................return.0;..
15480 00 14 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 3a 00 00 00 25 20 20 20 20 20 20 ..............default:...%......
154a0 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 ..........print_usage(argv[0]);.
154c0 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 31 3b 00 00 00 09 ...................return.1;....
154e0 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 17 20 20 ........}........}..............
15500 20 20 69 66 20 28 62 65 74 77 65 65 6e 5f 61 72 67 73 29 20 7b 00 00 00 30 20 20 20 20 20 20 20 ..if.(between_args).{...0.......
15520 20 63 68 61 72 20 2a 73 70 61 63 65 20 3d 20 73 74 72 63 68 72 28 62 65 74 77 65 65 6e 5f 61 72 .char.*space.=.strchr(between_ar
15540 67 73 2c 20 27 20 27 29 3b 00 00 00 14 20 20 20 20 20 20 20 20 69 66 20 28 73 70 61 63 65 29 20 gs,.'.');............if.(space).
15560 7b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 2a 73 70 61 63 65 20 3d 20 27 5c 30 27 3b 00 {................*space.=.'\0';.
15580 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 31 20 3d 20 62 65 74 77 65 65 ..$............between1.=.betwee
155a0 6e 5f 61 72 67 73 3b 00 00 00 21 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 32 20 n_args;...!............between2.
155c0 3d 20 73 70 61 63 65 20 2b 20 31 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 =.space.+.1;............}.......
155e0 20 7d 00 00 00 04 20 20 20 20 00 00 00 36 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 20 3d .}...........6....calendar.cal.=
15600 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 2c 20 79 65 .load_calendar(calendar_file,.ye
15620 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 19 20 20 20 20 69 66 20 28 73 68 6f 77 5f 79 65 61 ar);................if.(show_yea
15640 72 5f 66 6c 61 67 29 20 7b 00 00 00 17 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 65 61 72 28 63 r_flag).{............show_year(c
15660 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 68 al);........}........else.if.(sh
15680 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 20 7b 00 00 00 35 20 20 20 20 20 20 20 20 69 6e 74 20 6d ow_month_arg).{...5........int.m
156a0 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 73 68 6f 77 5f 6d 6f 6e onth.=.parse_month(cal,.show_mon
156c0 74 68 5f 61 72 67 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 th_arg);............show_month(c
156e0 61 6c 2c 20 6d 6f 6e 74 68 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1f 20 20 20 20 65 6c 73 65 al,.month);........}........else
15700 20 69 66 20 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 29 20 7b 00 00 00 1b 20 20 20 20 20 .if.(show_length_arg).{.........
15720 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 73 74 72 5b 32 30 5d 3b 00 00 00 10 20 20 20 20 20 20 ...char.month_str[20];..........
15740 20 20 69 6e 74 20 64 61 79 3b 00 00 00 3a 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 73 68 6f ..int.day;...:........sscanf(sho
15760 77 5f 6c 65 6e 67 74 68 5f 61 72 67 2c 20 22 25 73 20 25 64 22 2c 20 6d 6f 6e 74 68 5f 73 74 72 w_length_arg,."%s.%d",.month_str
15780 2c 20 26 64 61 79 29 3b 00 00 00 30 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 ,.&day);...0........int.month.=.
157a0 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 5f 73 74 72 29 3b 00 00 00 53 parse_month(cal,.month_str);...S
157c0 20 20 20 20 20 20 20 20 73 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c 2c 20 6d 6f 6e ........show_day_length(cal,.mon
157e0 74 68 2c 20 64 61 79 2c 20 77 65 65 6b 5f 66 6c 61 67 2c 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c th,.day,.week_flag,.month_ago_fl
15800 61 67 2c 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 18 ag,.year_ago_flag);........}....
15820 20 20 20 20 65 6c 73 65 20 69 66 20 28 6e 6f 77 5f 66 6c 61 67 29 20 7b 00 00 00 1f 20 20 20 20 ....else.if.(now_flag).{........
15840 20 20 20 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 29 3b 00 00 00 05 20 ....show_current_time(cal);.....
15860 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 74 6f 70 77 61 74 63 68 5f 66 ...}........else.if.(stopwatch_f
15880 6c 61 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 72 75 6e 5f 73 74 6f 70 77 61 74 63 68 28 lag).{............run_stopwatch(
158a0 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 21 20 20 20 20 65 6c 73 65 20 69 66 20 28 61 cal);........}...!....else.if.(a
158c0 64 64 5f 64 61 79 73 5f 76 61 6c 20 21 3d 20 30 29 20 7b 00 00 00 24 20 20 20 20 20 20 20 20 61 dd_days_val.!=.0).{...$........a
158e0 64 64 5f 64 61 79 73 28 63 61 6c 2c 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 29 3b 00 00 00 05 20 dd_days(cal,.add_days_val);.....
15900 20 20 20 7d 00 00 00 24 20 20 20 20 65 6c 73 65 20 69 66 20 28 62 65 74 77 65 65 6e 31 20 26 26 ...}...$....else.if.(between1.&&
15920 20 62 65 74 77 65 65 6e 32 29 20 7b 00 00 00 36 20 20 20 20 20 20 20 20 64 61 79 73 5f 62 65 74 .between2).{...6........days_bet
15940 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 6c 2c 20 62 65 74 77 65 65 6e 31 2c 20 62 65 74 77 ween_command(cal,.between1,.betw
15960 65 65 6e 32 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0a 20 20 20 20 65 6c 73 65 20 7b 00 00 00 een2);........}........else.{...
15980 1d 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 5d 29 3b 00 00 .........print_usage(argv[0]);..
159a0 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 0d 20 20 20 20 72 65 74 75 72 6e 20 30 3b ......}................return.0;
159c0 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 7f 01 00 00 00 00 00 00 01 00 00 ....}5..........................
159e0 00 00 00 00 00 00 00 00 00 00 00 00 00 c2 30 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f ..............0..............5._
15a00 d0 00 00 00 10 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 01 00 00 00 00 00 00 00 ................................
15a20 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15a40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15a60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15a80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15aa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15ac0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15ae0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15b00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15b20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15b40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15b60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15b80 00 00 00 6a 00 3e a8 04 01 00 00 00 0b 00 f5 18 00 00 00 f4 00 00 00 00 00 00 00 00 00 00 00 01 ...j.>..........................
15ba0 00 00 00 1c 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 ........printf("..%s.--show-leng
15bc0 f5 18 00 00 00 f5 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 7c 00 00 00 00 00 00 00 00 .......................|........
15be0 00 00 00 01 00 00 00 1b 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 79 65 61 ....................int.temp_yea
15c00 72 20 3d f5 18 00 00 00 7d 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 r.=.....}.......................
15c20 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 .............................5..
15c40 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7c 00 00 00 1b 00 00 00 00 00 00 .....................|..........
15c60 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 7c 00 00 00 1b ...........................|....
15c80 00 00 00 00 00 00 00 00 00 00 00 78 00 00 00 1c 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 ...........x....................
15ca0 00 00 00 ff 0f 00 00 00 00 00 00 f5 18 00 00 00 00 f4 00 00 00 1c 00 00 00 00 00 00 00 00 00 00 ................................
15cc0 00 89 00 00 00 01 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b3 0f 00 00 00 00 00 ................................
15ce0 00 35 81 5f d0 00 00 00 11 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 01 00 00 00 .5._............................
15d00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15e00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15e20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15e40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
15e60 00 00 00 00 00 00 00 6a 00 3f 87 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 .......j.?......................
15e80 00 00 01 7e 00 00 00 12 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 00 00 00 13 23 69 ...~....#include.<stdio.h>....#i
15ea0 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 00 00 00 13 23 69 6e 63 6c 75 64 65 20 3c 73 nclude.<stdlib.h>....#include.<s
15ec0 74 72 69 6e 67 2e 68 3e 00 00 00 11 23 69 6e 63 6c 75 64 65 20 3c 74 69 6d 65 2e 68 3e 00 00 00 tring.h>....#include.<time.h>...
15ee0 13 23 69 6e 63 6c 75 64 65 20 3c 67 65 74 6f 70 74 2e 68 3e 00 00 00 00 00 00 00 10 74 79 70 65 .#include.<getopt.h>........type
15f00 64 65 66 20 73 74 72 75 63 74 20 7b 00 00 00 0d 20 20 20 20 69 6e 74 20 79 65 61 72 3b 00 00 00 def.struct.{........int.year;...
15f20 10 20 20 20 20 69 6e 74 20 69 73 5f 6c 65 61 70 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 64 61 79 .....int.is_leap;........int.day
15f40 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 31 32 5d 3b 00 00 00 1d 20 20 20 20 63 68 61 72 20 6d 6f 6e s_per_month[12];........char.mon
15f60 74 68 5f 6e 61 6d 65 73 5b 31 32 5d 5b 31 30 5d 3b 00 00 00 0b 7d 20 63 61 6c 65 6e 64 61 72 3b th_names[12][10];....}.calendar;
15f80 00 00 00 00 00 00 00 38 63 61 6c 65 6e 64 61 72 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 .......8calendar.load_calendar(c
15fa0 6f 6e 73 74 20 63 68 61 72 20 2a 66 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 79 65 61 72 29 20 7b onst.char.*filename,.int.year).{
15fc0 00 00 00 11 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 61 6c 3b 00 00 00 14 20 20 20 20 63 61 6c ........calendar.cal;........cal
15fe0 2e 79 65 61 72 20 3d 20 79 65 61 72 3b 00 00 00 14 20 20 20 20 63 61 6c 2e 69 73 5f 6c 65 61 70 .year.=.year;........cal.is_leap
16000 20 3d 20 30 3b 00 00 00 8e 20 20 20 20 63 68 61 72 20 2a 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 .=.0;........char.*default_names
16020 5b 31 32 5d 20 3d 20 7b 22 6a 61 6e 75 61 72 79 22 2c 22 66 65 62 72 75 61 72 79 22 2c 22 6d 61 [12].=.{"january","february","ma
16040 72 63 68 22 2c 22 61 70 72 69 6c 22 2c 22 6d 61 79 22 2c 22 6a 75 6e 65 22 2c 22 6a 75 6c 79 22 rch","april","may","june","july"
16060 2c 22 61 75 67 75 73 74 22 2c 22 73 65 70 74 65 6d 62 65 72 22 2c 22 6f 63 74 6f 62 65 72 22 2c ,"august","september","october",
16080 22 6e 6f 76 65 6d 62 65 72 22 2c 22 64 65 63 65 6d 62 65 72 22 7d 3b 00 00 00 22 20 20 20 20 66 "november","december"};..."....f
160a0 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 00 00 or.(int.i.=.0;.i.<.12;.i++).{...
160c0 35 20 20 20 20 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 5........strcpy(cal.month_names[
160e0 69 5d 2c 20 64 65 66 61 75 6c 74 5f 6e 61 6d 65 73 5b 69 5d 29 3b 00 00 00 2f 20 20 20 20 20 20 i],.default_names[i]);.../......
16100 20 20 69 66 20 28 69 20 3d 3d 20 31 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 ..if.(i.==.1).cal.days_per_month
16120 5b 69 5d 20 3d 20 32 38 3b 00 00 00 53 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 69 20 [i].=.28;...S........else.if.(i.
16140 3d 3d 20 33 20 7c 7c 20 69 20 3d 3d 20 35 20 7c 7c 20 69 20 3d 3d 20 38 20 7c 7c 20 69 20 3d 3d ==.3.||.i.==.5.||.i.==.8.||.i.==
16160 20 31 30 29 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 20 3d 20 33 30 3b .10).cal.days_per_month[i].=.30;
16180 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f ...(........else.cal.days_per_mo
161a0 6e 74 68 5b 69 5d 20 3d 20 33 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 23 20 20 20 20 46 49 4c nth[i].=.31;........}...#....FIL
161c0 45 20 2a 66 20 3d 20 66 6f 70 65 6e 28 66 69 6c 65 6e 61 6d 65 2c 20 22 72 22 29 3b 00 00 00 17 E.*f.=.fopen(filename,."r");....
161e0 20 20 20 20 69 66 20 28 21 66 29 20 72 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 13 20 20 20 20 63 ....if.(!f).return.cal;........c
16200 68 61 72 20 6c 69 6e 65 5b 35 31 32 5d 3b 00 00 00 2a 20 20 20 20 77 68 69 6c 65 20 28 66 67 65 har.line[512];...*....while.(fge
16220 74 73 28 6c 69 6e 65 2c 20 73 69 7a 65 6f 66 28 6c 69 6e 65 29 2c 20 66 29 29 20 7b 00 00 00 2d ts(line,.sizeof(line),.f)).{...-
16240 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e 65 2c 20 22 79 65 61 72 3a ........if.(strncmp(line,."year:
16260 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 ",.5).==.0).{................int
16280 20 79 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 6e 66 28 6c 69 6e 65 2c 20 .y;...)............sscanf(line,.
162a0 22 79 65 61 72 3a 20 25 64 22 2c 20 26 79 29 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 "year:.%d",.&y);...$............
162c0 69 66 20 28 79 20 21 3d 20 79 65 61 72 29 20 63 6f 6e 74 69 6e 75 65 3b 00 00 00 09 20 20 20 20 if.(y.!=.year).continue;........
162e0 20 20 20 20 7d 00 00 00 2e 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e ....}............if.(strncmp(lin
16300 65 2c 20 22 6d 6f 6e 74 68 3a 22 2c 20 36 29 20 3d 3d 20 30 29 20 7b 00 00 00 15 20 20 20 20 20 e,."month:",.6).==.0).{.........
16320 20 20 20 20 20 20 20 69 6e 74 20 6d 2c 20 64 3b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 .......int.m,.d;................
16340 63 68 61 72 20 6e 61 6d 65 5b 32 30 5d 3b 00 00 00 46 20 20 20 20 20 20 20 20 20 20 20 20 73 73 char.name[20];...F............ss
16360 63 61 6e 66 28 6c 69 6e 65 2c 20 22 6d 6f 6e 74 68 3a 20 25 64 20 64 61 79 73 3a 20 25 64 20 6e canf(line,."month:.%d.days:.%d.n
16380 61 6d 65 3a 20 25 73 22 2c 20 26 6d 2c 20 26 64 2c 20 6e 61 6d 65 29 3b 00 00 00 24 20 20 20 20 ame:.%s",.&m,.&d,.name);...$....
163a0 20 20 20 20 20 20 20 20 69 66 20 28 6d 20 3e 3d 20 31 20 26 26 20 6d 20 3c 3d 20 31 32 29 20 7b ........if.(m.>=.1.&&.m.<=.12).{
163c0 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 ...,................cal.days_per
163e0 5f 6d 6f 6e 74 68 5b 6d 2d 31 5d 20 3d 20 64 3b 00 00 00 33 20 20 20 20 20 20 20 20 20 20 20 20 _month[m-1].=.d;...3............
16400 20 20 20 20 73 74 72 63 70 79 28 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 2d 31 5d 2c ....strcpy(cal.month_names[m-1],
16420 20 6e 61 6d 65 29 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 00 00 09 20 20 20 20 .name);................}........
16440 20 20 20 20 7d 00 00 00 2d 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 6e 63 6d 70 28 6c 69 6e ....}...-........if.(strncmp(lin
16460 65 2c 20 22 6c 65 61 70 3a 22 2c 20 35 29 20 3d 3d 20 30 29 20 7b 00 00 00 12 20 20 20 20 20 20 e,."leap:",.5).==.0).{..........
16480 20 20 20 20 20 20 69 6e 74 20 6c 3b 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 73 73 63 61 ......int.l;...)............ssca
164a0 6e 66 28 6c 69 6e 65 2c 20 22 6c 65 61 70 3a 20 25 64 22 2c 20 26 6c 29 3b 00 00 00 32 20 20 20 nf(line,."leap:.%d",.&l);...2...
164c0 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 20 3d 3d 20 63 61 6c 2e 79 65 61 72 29 20 63 .........if.(year.==.cal.year).c
164e0 61 6c 2e 69 73 5f 6c 65 61 70 20 3d 20 6c 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 al.is_leap.=.l;............}....
16500 20 20 20 20 7d 00 00 00 0e 20 20 20 20 66 63 6c 6f 73 65 28 66 29 3b 00 00 00 0f 20 20 20 20 72 ....}........fclose(f);........r
16520 65 74 75 72 6e 20 63 61 6c 3b 00 00 00 01 7d 00 00 00 00 00 00 00 2c 69 6e 74 20 70 61 72 73 65 eturn.cal;....}.......,int.parse
16540 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 20 2a 69 6e 70 75 74 _month(calendar.cal,.char.*input
16560 29 20 7b 00 00 00 22 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 ).{..."....for.(int.i.=.0;.i.<.1
16580 32 3b 20 69 2b 2b 29 20 7b 00 00 00 41 20 20 20 20 20 20 20 20 69 66 20 28 73 74 72 63 6d 70 28 2;.i++).{...A........if.(strcmp(
165a0 69 6e 70 75 74 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 29 20 3d 3d 20 30 29 input,.cal.month_names[i]).==.0)
165c0 20 72 65 74 75 72 6e 20 69 20 2b 20 31 3b 00 00 00 05 20 20 20 20 7d 00 00 00 17 20 20 20 20 72 .return.i.+.1;........}........r
165e0 65 74 75 72 6e 20 61 74 6f 69 28 69 6e 70 75 74 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 3b 69 eturn.atoi(input);....}.......;i
16600 6e 74 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 nt.date_to_day_of_year(calendar.
16620 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 29 20 7b 00 00 00 18 20 20 cal,.int.month,.int.day).{......
16640 20 20 69 6e 74 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 3d 20 30 3b 00 00 00 29 20 20 20 20 66 6f ..int.day_of_year.=.0;...)....fo
16660 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 6d 6f 6e 74 68 20 2d 20 31 3b 20 69 2b 2b r.(int.i.=.0;.i.<.month.-.1;.i++
16680 29 20 7b 00 00 00 2d 20 20 20 20 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 63 61 ).{...-........day_of_year.+=.ca
166a0 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 69 5d 3b 00 00 00 05 20 20 20 20 7d 00 00 00 l.days_per_month[i];........}...
166c0 17 20 20 20 20 64 61 79 5f 6f 66 5f 79 65 61 72 20 2b 3d 20 64 61 79 3b 00 00 00 17 20 20 20 20 .....day_of_year.+=.day;........
166e0 72 65 74 75 72 6e 20 64 61 79 5f 6f 66 5f 79 65 61 72 3b 00 00 00 01 7d 00 00 00 00 00 00 00 56 return.day_of_year;....}.......V
16700 69 6e 74 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 65 6e 64 61 72 20 int.days_between_dates(calendar.
16720 63 61 6c 31 2c 20 69 6e 74 20 6d 31 2c 20 69 6e 74 20 64 31 2c 20 63 61 6c 65 6e 64 61 72 20 63 cal1,.int.m1,.int.d1,.calendar.c
16740 61 6c 32 2c 20 69 6e 74 20 6d 32 2c 20 69 6e 74 20 64 32 29 20 7b 00 00 00 17 20 20 20 20 69 6e al2,.int.m2,.int.d2).{........in
16760 74 20 79 31 20 3d 20 63 61 6c 31 2e 79 65 61 72 3b 00 00 00 17 20 20 20 20 69 6e 74 20 79 32 20 t.y1.=.cal1.year;........int.y2.
16780 3d 20 63 61 6c 32 2e 79 65 61 72 3b 00 00 00 31 20 20 20 20 69 6e 74 20 64 6f 79 31 20 3d 20 64 =.cal2.year;...1....int.doy1.=.d
167a0 61 74 65 5f 74 6f 5f 64 61 79 5f 6f 66 5f 79 65 61 72 28 63 61 6c 31 2c 20 6d 31 2c 20 64 31 29 ate_to_day_of_year(cal1,.m1,.d1)
167c0 3b 00 00 00 31 20 20 20 20 69 6e 74 20 64 6f 79 32 20 3d 20 64 61 74 65 5f 74 6f 5f 64 61 79 5f ;...1....int.doy2.=.date_to_day_
167e0 6f 66 5f 79 65 61 72 28 63 61 6c 32 2c 20 6d 32 2c 20 64 32 29 3b 00 00 00 04 20 20 20 20 00 00 of_year(cal2,.m2,.d2);..........
16800 00 11 20 20 20 20 69 6e 74 20 64 61 79 73 20 3d 20 30 3b 00 00 00 13 20 20 20 20 69 66 20 28 79 ......int.days.=.0;........if.(y
16820 31 20 3d 3d 20 79 32 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 64 6f 79 1.==.y2).{............days.=.doy
16840 32 20 2d 20 64 6f 79 31 3b 00 00 00 19 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 79 32 20 3e 2.-.doy1;........}.else.if.(y2.>
16860 20 79 31 29 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 73 5f 69 6e 5f 79 31 .y1).{...,........int.days_in_y1
16880 20 3d 20 33 36 35 20 2b 20 63 61 6c 31 2e 69 73 5f 6c 65 61 70 3b 00 00 00 2a 20 20 20 20 20 20 .=.365.+.cal1.is_leap;...*......
168a0 20 20 64 61 79 73 20 3d 20 28 64 61 79 73 5f 69 6e 5f 79 31 20 2d 20 64 6f 79 31 29 20 2b 20 64 ..days.=.(days_in_y1.-.doy1).+.d
168c0 6f 79 32 3b 00 00 00 2b 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 6e 74 20 79 20 3d 20 79 31 20 oy2;...+........for.(int.y.=.y1.
168e0 2b 20 31 3b 20 79 20 3c 20 79 32 3b 20 79 2b 2b 29 20 7b 00 00 00 3d 20 20 20 20 20 20 20 20 20 +.1;.y.<.y2;.y++).{...=.........
16900 20 20 20 63 61 6c 65 6e 64 61 72 20 79 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 ...calendar.ycal.=.load_calendar
16920 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 29 3b 00 00 00 27 20 20 20 20 20 20 20 20 ("calendar.txt",.y);...'........
16940 20 20 20 20 64 61 79 73 20 2b 3d 20 33 36 35 20 2b 20 79 63 61 6c 2e 69 73 5f 6c 65 61 70 3b 00 ....days.+=.365.+.ycal.is_leap;.
16960 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 00 3e ...........}........}.else.{...>
16980 20 20 20 20 20 20 20 20 64 61 79 73 20 3d 20 64 61 79 73 5f 62 65 74 77 65 65 6e 5f 64 61 74 65 ........days.=.days_between_date
169a0 73 28 63 61 6c 32 2c 20 6d 32 2c 20 64 32 2c 20 63 61 6c 31 2c 20 6d 31 2c 20 64 31 29 3b 00 00 s(cal2,.m2,.d2,.cal1,.m1,.d1);..
169c0 00 05 20 20 20 20 7d 00 00 00 10 20 20 20 20 72 65 74 75 72 6e 20 64 61 79 73 3b 00 00 00 01 7d ......}........return.days;....}
169e0 00 00 00 00 00 00 00 66 76 6f 69 64 20 73 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c .......fvoid.show_day_length(cal
16a00 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 6d 6f 6e 74 68 2c 20 69 6e 74 20 64 61 79 2c 20 69 endar.cal,.int.month,.int.day,.i
16a20 6e 74 20 77 65 65 6b 5f 66 6c 61 67 2c 20 69 6e 74 20 6d 6f 6e 74 68 5f 66 6c 61 67 2c 20 69 6e nt.week_flag,.int.month_flag,.in
16a40 74 20 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 52 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 t.year_flag).{...R....if.(month.
16a60 3c 20 31 20 7c 7c 20 6d 6f 6e 74 68 20 3e 20 31 32 20 7c 7c 20 64 61 79 20 3c 20 31 20 7c 7c 20 <.1.||.month.>.12.||.day.<.1.||.
16a80 64 61 79 20 3e 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 day.>.cal.days_per_month[month-1
16aa0 5d 29 20 7b 00 00 00 21 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 69 6e 76 61 6c 69 64 20 ]).{...!........printf("invalid.
16ac0 64 61 74 65 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 date\n");............return;....
16ae0 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 1e 20 20 20 20 74 69 6d 65 5f 74 20 6e 6f 77 5f ....}................time_t.now_
16b00 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2a 20 20 20 20 73 74 72 75 63 74 20 74 6d t.=.time(NULL);...*....struct.tm
16b20 20 2a 6e 6f 77 5f 74 6d 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 6e 6f 77 5f 74 29 3b 00 00 00 .*now_tm.=.localtime(&now_t);...
16b40 2e 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 3d 20 6e 6f 77 5f 74 6d 2d 3e .....int.current_year.=.now_tm->
16b60 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 2b 20 20 20 20 69 6e 74 20 63 75 72 72 65 tm_year.+.1900;...+....int.curre
16b80 6e 74 5f 6d 6f 6e 74 68 20 3d 20 6e 6f 77 5f 74 6d 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 nt_month.=.now_tm->tm_mon.+.1;..
16ba0 00 26 20 20 20 20 69 6e 74 20 63 75 72 72 65 6e 74 5f 64 61 79 20 3d 20 6e 6f 77 5f 74 6d 2d 3e .&....int.current_day.=.now_tm->
16bc0 74 6d 5f 6d 64 61 79 3b 00 00 00 04 20 20 20 20 00 00 00 47 20 20 20 20 63 61 6c 65 6e 64 61 72 tm_mday;...........G....calendar
16be0 20 63 75 72 72 65 6e 74 5f 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 .current_cal.=.load_calendar("ca
16c00 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 3b 00 00 00 04 20 lendar.txt",.current_year);.....
16c20 20 20 20 00 00 00 60 20 20 20 20 69 6e 74 20 64 61 79 73 5f 61 67 6f 20 3d 20 64 61 79 73 5f 62 ......`....int.days_ago.=.days_b
16c40 65 74 77 65 65 6e 5f 64 61 74 65 73 28 63 61 6c 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 2c 20 63 75 etween_dates(cal,.month,.day,.cu
16c60 72 72 65 6e 74 5f 63 61 6c 2c 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 2c 20 63 75 72 72 65 6e rrent_cal,.current_month,.curren
16c80 74 5f 64 61 79 29 3b 00 00 00 04 20 20 20 20 00 00 00 17 20 20 20 20 69 66 20 28 64 61 79 73 5f t_day);................if.(days_
16ca0 61 67 6f 20 3c 20 30 29 20 7b 00 00 00 4a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 ago.<.0).{...J........printf("%s
16cc0 20 25 64 20 69 73 20 69 6e 20 74 68 65 20 66 75 74 75 72 65 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e .%d.is.in.the.future\n",.cal.mon
16ce0 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 0f 20 20 20 20 th_names[month-1],.day);........
16d00 20 20 20 20 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 18 ....return;........}............
16d20 20 20 20 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 30 29 20 7b 00 00 00 43 20 20 20 20 ....if.(days_ago.==.0).{...C....
16d40 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 74 6f 64 61 79 5c 6e 22 2c 20 ....printf("%s.%d.was.today\n",.
16d60 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 cal.month_names[month-1],.day);.
16d80 00 00 1f 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 64 61 79 73 5f 61 67 6f 20 3d 3d 20 31 29 .......}.else.if.(days_ago.==.1)
16da0 20 7b 00 00 00 47 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 .{...G........printf("%s.%d.was.
16dc0 79 65 73 74 65 72 64 61 79 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f yesterday\n",.cal.month_names[mo
16de0 6e 74 68 2d 31 5d 2c 20 64 61 79 29 3b 00 00 00 0c 20 20 20 20 7d 20 65 6c 73 65 20 7b 00 00 00 nth-1],.day);........}.else.{...
16e00 18 20 20 20 20 20 20 20 20 69 66 20 28 77 65 65 6b 5f 66 6c 61 67 29 20 7b 00 00 00 25 20 20 20 .........if.(week_flag).{...%...
16e20 20 20 20 20 20 20 20 20 20 69 6e 74 20 77 65 65 6b 73 20 3d 20 64 61 79 73 5f 61 67 6f 20 2f 20 .........int.weeks.=.days_ago./.
16e40 37 3b 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 72 65 6d 5f 64 61 79 73 20 3d 7;...(............int.rem_days.=
16e60 20 64 61 79 73 5f 61 67 6f 20 25 20 37 3b 00 00 00 83 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .days_ago.%.7;................if
16e80 20 28 72 65 6d 5f 64 61 79 73 20 3d 3d 20 30 29 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 .(rem_days.==.0).printf("%s.%d.w
16ea0 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 69 73 20 25 64 20 77 65 65 6b 73 as.%d.days.ago.which.is.%d.weeks
16ec0 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 \n",.cal.month_names[month-1],.d
16ee0 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 77 65 65 6b 73 29 3b 00 00 00 8b 20 20 20 20 20 20 20 ay,.days_ago,.weeks);...........
16f00 20 20 20 20 20 65 6c 73 65 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 .....else.printf("%s.%d.was.%d.d
16f20 61 79 73 20 61 67 6f 20 77 68 69 63 68 20 69 73 20 25 64 20 77 65 65 6b 73 20 61 6e 64 20 25 64 ays.ago.which.is.%d.weeks.and.%d
16f40 20 64 61 79 73 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d .days\n",.cal.month_names[month-
16f60 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 77 65 65 6b 73 2c 20 72 65 6d 5f 64 61 1],.day,.days_ago,.weeks,.rem_da
16f80 79 73 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 1e 20 20 20 20 20 20 20 20 65 6c 73 ys);............}............els
16fa0 65 20 69 66 20 28 6d 6f 6e 74 68 5f 66 6c 61 67 29 20 7b 00 00 00 1f 20 20 20 20 20 20 20 20 20 e.if.(month_flag).{.............
16fc0 20 20 20 69 6e 74 20 6d 6f 6e 74 68 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 25 20 20 20 20 20 20 ...int.months_ago.=.0;...%......
16fe0 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 3b 00 ......int.temp_year.=.cal.year;.
17000 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 20 ..#............int.temp_month.=.
17020 6d 6f 6e 74 68 3b 00 00 00 1f 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 64 month;................int.temp_d
17040 61 79 20 3d 20 64 61 79 3b 00 00 00 6b 20 20 20 20 20 20 20 20 20 20 20 20 77 68 69 6c 65 20 28 ay.=.day;...k............while.(
17060 74 65 6d 70 5f 79 65 61 72 20 3c 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 7c 7c 20 28 74 65 6d temp_year.<.current_year.||.(tem
17080 70 5f 79 65 61 72 20 3d 3d 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 26 26 20 74 65 6d 70 5f 6d p_year.==.current_year.&&.temp_m
170a0 6f 6e 74 68 20 3c 20 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 29 29 20 7b 00 00 00 1d 20 20 20 20 onth.<.current_month)).{........
170c0 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f 6d 6f 6e 74 68 2b 2b 3b 00 00 00 26 20 20 20 ............temp_month++;...&...
170e0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 6d 6f 6e 74 68 20 3e 20 31 32 .............if.(temp_month.>.12
17100 29 20 7b 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 6d 70 5f ).{...#....................temp_
17120 6d 6f 6e 74 68 20 3d 20 31 3b 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 month.=.1;......................
17140 20 20 74 65 6d 70 5f 79 65 61 72 2b 2b 3b 00 00 00 11 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..temp_year++;..................
17160 20 20 7d 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 73 5f 61 67 ..}....................months_ag
17180 6f 2b 2b 3b 00 00 00 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 o++;...4................if.(temp
171a0 5f 79 65 61 72 20 3e 20 63 75 72 72 65 6e 74 5f 79 65 61 72 29 20 62 72 65 61 6b 3b 00 00 00 53 _year.>.current_year).break;...S
171c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 79 65 61 72 20 3d 3d ................if.(temp_year.==
171e0 20 63 75 72 72 65 6e 74 5f 79 65 61 72 20 26 26 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3e 20 63 75 .current_year.&&.temp_month.>.cu
17200 72 72 65 6e 74 5f 6d 6f 6e 74 68 29 20 62 72 65 61 6b 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 rrent_month).break;.............
17220 20 20 20 7d 00 00 00 65 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 74 65 6d 70 5f 64 61 79 ...}...e............if.(temp_day
17240 20 3e 20 63 75 72 72 65 6e 74 5f 64 61 79 20 26 26 20 74 65 6d 70 5f 6d 6f 6e 74 68 20 3d 3d 20 .>.current_day.&&.temp_month.==.
17260 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 26 26 20 74 65 6d 70 5f 79 65 61 72 20 3d 3d 20 63 75 current_month.&&.temp_year.==.cu
17280 72 72 65 6e 74 5f 79 65 61 72 29 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 rrent_year).{...................
172a0 20 6d 6f 6e 74 68 73 5f 61 67 6f 2d 2d 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d 00 .months_ago--;................}.
172c0 00 00 2f 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 73 5f 61 67 6f 20 3c 20 ../............if.(months_ago.<.
172e0 30 29 20 6d 6f 6e 74 68 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 76 20 20 20 20 20 20 20 20 20 20 0).months_ago.=.0;...v..........
17300 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 ..printf("%s.%d.was.%d.days.ago.
17320 77 68 69 63 68 20 69 73 20 25 64 20 6d 6f 6e 74 68 73 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 which.is.%d.months\n",.cal.month
17340 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 _names[month-1],.day,.days_ago,.
17360 6d 6f 6e 74 68 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 1d 20 20 20 months_ago);............}.......
17380 20 20 20 20 20 65 6c 73 65 20 69 66 20 28 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 34 20 20 .....else.if.(year_flag).{...4..
173a0 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 79 65 61 72 73 5f 61 67 6f 20 3d 20 63 75 72 72 65 6e ..........int.years_ago.=.curren
173c0 74 5f 79 65 61 72 20 2d 20 63 61 6c 2e 79 65 61 72 3b 00 00 00 59 20 20 20 20 20 20 20 20 20 20 t_year.-.cal.year;...Y..........
173e0 20 20 69 66 20 28 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 3c 20 6d 6f 6e 74 68 20 7c 7c 20 28 ..if.(current_month.<.month.||.(
17400 63 75 72 72 65 6e 74 5f 6d 6f 6e 74 68 20 3d 3d 20 6d 6f 6e 74 68 20 26 26 20 63 75 72 72 65 6e current_month.==.month.&&.curren
17420 74 5f 64 61 79 20 3c 20 64 61 79 29 29 20 7b 00 00 00 1c 20 20 20 20 20 20 20 20 20 20 20 20 20 t_day.<.day)).{.................
17440 20 20 20 79 65 61 72 73 5f 61 67 6f 2d 2d 3b 00 00 00 0d 20 20 20 20 20 20 20 20 20 20 20 20 7d ...years_ago--;................}
17460 00 00 00 2d 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 79 65 61 72 73 5f 61 67 6f 20 3c 20 ...-............if.(years_ago.<.
17480 30 29 20 79 65 61 72 73 5f 61 67 6f 20 3d 20 30 3b 00 00 00 74 20 20 20 20 20 20 20 20 20 20 20 0).years_ago.=.0;...t...........
174a0 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 20 77 .printf("%s.%d.was.%d.days.ago.w
174c0 68 69 63 68 20 69 73 20 25 64 20 79 65 61 72 73 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e hich.is.%d.years\n",.cal.month_n
174e0 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 6f 2c 20 79 65 ames[month-1],.day,.days_ago,.ye
17500 61 72 73 5f 61 67 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 0e 20 20 20 20 20 20 ars_ago);............}..........
17520 20 20 65 6c 73 65 20 7b 00 00 00 57 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 ..else.{...W............printf("
17540 25 73 20 25 64 20 77 61 73 20 25 64 20 64 61 79 73 20 61 67 6f 5c 6e 22 2c 20 63 61 6c 2e 6d 6f %s.%d.was.%d.days.ago\n",.cal.mo
17560 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 64 61 79 73 5f 61 67 nth_names[month-1],.day,.days_ag
17580 6f 29 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 o);............}........}....}..
175a0 00 00 00 00 00 1e 76 6f 69 64 20 73 68 6f 77 5f 79 65 61 72 28 63 61 6c 65 6e 64 61 72 20 63 61 ......void.show_year(calendar.ca
175c0 6c 29 20 7b 00 00 00 22 20 20 20 20 70 72 69 6e 74 66 28 22 79 65 61 72 20 25 64 5c 6e 22 2c 20 l).{..."....printf("year.%d\n",.
175e0 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 2b 20 20 20 20 69 66 20 28 63 61 6c 2e 69 73 5f 6c 65 61 cal.year);...+....if.(cal.is_lea
17600 70 29 20 70 72 69 6e 74 66 28 22 6c 65 61 70 20 79 65 61 72 5c 6e 22 29 3b 00 00 00 22 20 20 20 p).printf("leap.year\n");..."...
17620 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 31 32 3b 20 69 2b 2b 29 20 7b 00 .for.(int.i.=.0;.i.<.12;.i++).{.
17640 00 00 45 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c ..E........printf("%s.%d\n",.cal
17660 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 69 5d 2c 20 63 61 6c 2e 64 61 79 73 5f 70 65 72 5f 6d 6f .month_names[i],.cal.days_per_mo
17680 6e 74 68 5b 69 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 01 7d 00 00 00 00 00 00 00 2a 76 6f nth[i]);........}....}.......*vo
176a0 69 64 20 73 68 6f 77 5f 6d 6f 6e 74 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 69 6e 74 20 id.show_month(calendar.cal,.int.
176c0 6d 6f 6e 74 68 29 20 7b 00 00 00 22 20 20 20 20 69 66 20 28 6d 6f 6e 74 68 20 3c 20 31 20 7c 7c month).{..."....if.(month.<.1.||
176e0 20 6d 6f 6e 74 68 20 3e 20 31 32 29 20 7b 00 00 00 22 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 .month.>.12).{..."........printf
17700 28 22 69 6e 76 61 6c 69 64 20 6d 6f 6e 74 68 5c 6e 22 29 3b 00 00 00 0f 20 20 20 20 20 20 20 20 ("invalid.month\n");............
17720 72 65 74 75 72 6e 3b 00 00 00 05 20 20 20 20 7d 00 00 00 3a 20 20 20 20 70 72 69 6e 74 66 28 22 return;........}...:....printf("
17740 25 73 20 25 64 5c 6e 22 2c 20 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d %s.%d\n",.cal.month_names[month-
17760 31 5d 2c 20 63 61 6c 2e 79 65 61 72 29 3b 00 00 00 25 20 20 20 20 70 72 69 6e 74 66 28 22 73 75 1],.cal.year);...%....printf("su
17780 20 6d 6f 20 74 75 20 77 65 20 74 68 20 66 72 20 73 61 5c 6e 22 29 3b 00 00 00 17 20 20 20 20 73 .mo.tu.we.th.fr.sa\n");........s
177a0 74 72 75 63 74 20 74 6d 20 74 6d 20 3d 20 7b 30 7d 3b 00 00 00 21 20 20 20 20 74 6d 2e 74 6d 5f truct.tm.tm.=.{0};...!....tm.tm_
177c0 79 65 61 72 20 3d 20 63 61 6c 2e 79 65 61 72 20 2d 20 31 39 30 30 3b 00 00 00 1a 20 20 20 20 74 year.=.cal.year.-.1900;........t
177e0 6d 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 6f 6e 74 68 20 2d 20 31 3b 00 00 00 13 20 20 20 20 74 6d 2e m.tm_mon.=.month.-.1;........tm.
17800 74 6d 5f 6d 64 61 79 20 3d 20 31 3b 00 00 00 10 20 20 20 20 6d 6b 74 69 6d 65 28 26 74 6d 29 3b tm_mday.=.1;........mktime(&tm);
17820 00 00 00 1f 20 20 20 20 69 6e 74 20 66 69 72 73 74 5f 64 61 79 20 3d 20 74 6d 2e 74 6d 5f 77 64 ........int.first_day.=.tm.tm_wd
17840 61 79 3b 00 00 00 36 20 20 20 20 66 6f 72 20 28 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 66 ay;...6....for.(int.i.=.0;.i.<.f
17860 69 72 73 74 5f 64 61 79 3b 20 69 2b 2b 29 20 70 72 69 6e 74 66 28 22 20 20 20 22 29 3b 00 00 00 irst_day;.i++).printf("...");...
17880 3c 20 20 20 20 66 6f 72 20 28 69 6e 74 20 64 20 3d 20 31 3b 20 64 20 3c 3d 20 63 61 6c 2e 64 61 <....for.(int.d.=.1;.d.<=.cal.da
178a0 79 73 5f 70 65 72 5f 6d 6f 6e 74 68 5b 6d 6f 6e 74 68 2d 31 5d 3b 20 64 2b 2b 29 20 7b 00 00 00 ys_per_month[month-1];.d++).{...
178c0 1a 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 32 64 20 22 2c 20 64 29 3b 00 00 00 33 20 .........printf("%2d.",.d);...3.
178e0 20 20 20 20 20 20 20 69 66 20 28 28 66 69 72 73 74 5f 64 61 79 20 2b 20 64 29 20 25 20 37 20 3d .......if.((first_day.+.d).%.7.=
17900 3d 20 30 29 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 11 20 =.0).printf("\n");........}.....
17920 20 20 20 70 72 69 6e 74 66 28 22 5c 6e 22 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 26 76 6f 69 ...printf("\n");....}.......&voi
17940 64 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 65 6e 64 61 72 20 63 61 6c d.show_current_time(calendar.cal
17960 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 ).{........time_t.t.=.time(NULL)
17980 3b 00 00 00 25 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 6c 6f 63 61 6c 20 3d 20 6c 6f 63 61 ;...%....struct.tm.*local.=.loca
179a0 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 25 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 6c 6f 63 ltime(&t);...%....int.year.=.loc
179c0 61 6c 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 00 00 22 20 20 20 20 69 6e 74 20 6d al->tm_year.+.1900;..."....int.m
179e0 6f 6e 74 68 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 6f 6e 20 2b 20 31 3b 00 00 00 1d 20 20 20 onth.=.local->tm_mon.+.1;.......
17a00 20 69 6e 74 20 64 61 79 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 64 61 79 3b 00 00 00 1e 20 20 .int.day.=.local->tm_mday;......
17a20 20 20 69 6e 74 20 68 6f 75 72 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 68 6f 75 72 3b 00 00 00 1f ..int.hour.=.local->tm_hour;....
17a40 20 20 20 20 69 6e 74 20 6d 69 6e 75 74 65 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 6d 69 6e 3b 00 ....int.minute.=.local->tm_min;.
17a60 00 00 1f 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 20 3d 20 6c 6f 63 61 6c 2d 3e 74 6d 5f 73 65 .......int.second.=.local->tm_se
17a80 63 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 63 75 72 5f 63 61 6c 20 3d 20 6c 6f 61 c;...;....calendar.cur_cal.=.loa
17aa0 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c 20 79 65 61 72 29 d_calendar("calendar.txt",.year)
17ac0 3b 00 00 00 67 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 25 73 20 25 64 20 25 30 32 64 3a 25 ;...g....printf("%d.%s.%d.%02d:%
17ae0 30 32 64 3a 25 30 32 64 5c 6e 22 2c 20 79 65 61 72 2c 20 63 75 72 5f 63 61 6c 2e 6d 6f 6e 74 68 02d:%02d\n",.year,.cur_cal.month
17b00 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d 2c 20 64 61 79 2c 20 68 6f 75 72 2c 20 6d 69 6e 75 _names[month-1],.day,.hour,.minu
17b20 74 65 2c 20 73 65 63 6f 6e 64 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 22 76 6f 69 64 20 72 75 te,.second);....}......."void.ru
17b40 6e 5f 73 74 6f 70 77 61 74 63 68 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 29 20 7b 00 00 00 25 20 n_stopwatch(calendar.cal).{...%.
17b60 20 20 20 70 72 69 6e 74 66 28 22 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 74 61 72 74 5c ...printf("press.enter.to.start\
17b80 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1e 20 20 20 20 74 69 n");........getchar();........ti
17ba0 6d 65 5f 74 20 73 74 61 72 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 2c 20 20 20 20 me_t.start.=.time(NULL);...,....
17bc0 70 72 69 6e 74 66 28 22 72 75 6e 6e 69 6e 67 20 70 72 65 73 73 20 65 6e 74 65 72 20 74 6f 20 73 printf("running.press.enter.to.s
17be0 74 6f 70 5c 6e 22 29 3b 00 00 00 0e 20 20 20 20 67 65 74 63 68 61 72 28 29 3b 00 00 00 1c 20 20 top\n");........getchar();......
17c00 20 20 74 69 6d 65 5f 74 20 65 6e 64 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 1c 20 20 ..time_t.end.=.time(NULL);......
17c20 20 20 6c 6f 6e 67 20 64 69 66 66 20 3d 20 65 6e 64 20 2d 20 73 74 61 72 74 3b 00 00 00 1c 20 20 ..long.diff.=.end.-.start;......
17c40 20 20 69 6e 74 20 68 6f 75 72 73 20 3d 20 64 69 66 66 20 2f 20 33 36 30 30 3b 00 00 00 25 20 20 ..int.hours.=.diff./.3600;...%..
17c60 20 20 69 6e 74 20 6d 69 6e 75 74 65 73 20 3d 20 28 64 69 66 66 20 25 20 33 36 30 30 29 20 2f 20 ..int.minutes.=.(diff.%.3600)./.
17c80 36 30 3b 00 00 00 1c 20 20 20 20 69 6e 74 20 73 65 63 6f 6e 64 73 20 3d 20 64 69 66 66 20 25 20 60;........int.seconds.=.diff.%.
17ca0 36 30 3b 00 00 00 38 20 20 20 20 70 72 69 6e 74 66 28 22 25 30 32 64 3a 25 30 32 64 3a 25 30 32 60;...8....printf("%02d:%02d:%02
17cc0 64 5c 6e 22 2c 20 68 6f 75 72 73 2c 20 6d 69 6e 75 74 65 73 2c 20 73 65 63 6f 6e 64 73 29 3b 00 d\n",.hours,.minutes,.seconds);.
17ce0 00 00 01 7d 00 00 00 00 00 00 00 27 76 6f 69 64 20 61 64 64 5f 64 61 79 73 28 63 61 6c 65 6e 64 ...}.......'void.add_days(calend
17d00 61 72 20 63 61 6c 2c 20 69 6e 74 20 64 61 79 73 29 20 7b 00 00 00 1a 20 20 20 20 74 69 6d 65 5f ar.cal,.int.days).{........time_
17d20 74 20 74 20 3d 20 74 69 6d 65 28 4e 55 4c 4c 29 3b 00 00 00 16 20 20 20 20 74 20 2b 3d 20 64 61 t.t.=.time(NULL);........t.+=.da
17d40 79 73 20 2a 20 38 36 34 30 30 3b 00 00 00 26 20 20 20 20 73 74 72 75 63 74 20 74 6d 20 2a 66 75 ys.*.86400;...&....struct.tm.*fu
17d60 74 75 72 65 20 3d 20 6c 6f 63 61 6c 74 69 6d 65 28 26 74 29 3b 00 00 00 26 20 20 20 20 69 6e 74 ture.=.localtime(&t);...&....int
17d80 20 79 65 61 72 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 79 65 61 72 20 2b 20 31 39 30 30 3b 00 .year.=.future->tm_year.+.1900;.
17da0 00 00 23 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 66 75 74 75 72 65 2d 3e 74 6d 5f 6d 6f ..#....int.month.=.future->tm_mo
17dc0 6e 20 2b 20 31 3b 00 00 00 1e 20 20 20 20 69 6e 74 20 64 61 79 20 3d 20 66 75 74 75 72 65 2d 3e n.+.1;........int.day.=.future->
17de0 74 6d 5f 6d 64 61 79 3b 00 00 00 3b 20 20 20 20 63 61 6c 65 6e 64 61 72 20 66 75 74 5f 63 61 6c tm_mday;...;....calendar.fut_cal
17e00 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 22 63 61 6c 65 6e 64 61 72 2e 74 78 74 22 2c .=.load_calendar("calendar.txt",
17e20 20 79 65 61 72 29 3b 00 00 00 5c 20 20 20 20 70 72 69 6e 74 66 28 22 25 64 20 64 61 79 73 20 66 .year);...\....printf("%d.days.f
17e40 72 6f 6d 20 6e 6f 77 20 69 73 20 25 64 20 25 73 20 25 64 5c 6e 22 2c 20 64 61 79 73 2c 20 79 65 rom.now.is.%d.%s.%d\n",.days,.ye
17e60 61 72 2c 20 66 75 74 5f 63 61 6c 2e 6d 6f 6e 74 68 5f 6e 61 6d 65 73 5b 6d 6f 6e 74 68 2d 31 5d ar,.fut_cal.month_names[month-1]
17e80 2c 20 64 61 79 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 43 76 6f 69 64 20 64 61 79 73 5f 62 65 ,.day);....}.......Cvoid.days_be
17ea0 74 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 6c 65 6e 64 61 72 20 63 61 6c 2c 20 63 68 61 72 tween_command(calendar.cal,.char
17ec0 20 2a 64 61 74 65 31 2c 20 63 68 61 72 20 2a 64 61 74 65 32 29 20 7b 00 00 00 1a 20 20 20 20 69 .*date1,.char.*date2).{........i
17ee0 6e 74 20 79 31 2c 6d 31 2c 64 31 2c 79 32 2c 6d 32 2c 64 32 3b 00 00 00 2d 20 20 20 20 73 73 63 nt.y1,m1,d1,y2,m2,d2;...-....ssc
17f00 61 6e 66 28 64 61 74 65 31 2c 20 22 25 64 2d 25 64 2d 25 64 22 2c 20 26 79 31 2c 20 26 6d 31 2c anf(date1,."%d-%d-%d",.&y1,.&m1,
17f20 20 26 64 31 29 3b 00 00 00 2d 20 20 20 20 73 73 63 61 6e 66 28 64 61 74 65 32 2c 20 22 25 64 2d .&d1);...-....sscanf(date2,."%d-
17f40 25 64 2d 25 64 22 2c 20 26 79 32 2c 20 26 6d 32 2c 20 26 64 32 29 3b 00 00 00 23 20 20 20 20 73 %d-%d",.&y2,.&m2,.&d2);...#....s
17f60 74 72 75 63 74 20 74 6d 20 74 6d 31 20 3d 20 7b 30 7d 2c 20 74 6d 32 20 3d 20 7b 30 7d 3b 00 00 truct.tm.tm1.=.{0},.tm2.=.{0};..
17f80 00 1c 20 20 20 20 74 6d 31 2e 74 6d 5f 79 65 61 72 20 3d 20 79 31 20 2d 20 31 39 30 30 3b 00 00 ......tm1.tm_year.=.y1.-.1900;..
17fa0 00 18 20 20 20 20 74 6d 31 2e 74 6d 5f 6d 6f 6e 20 3d 20 6d 31 20 2d 20 31 3b 00 00 00 15 20 20 ......tm1.tm_mon.=.m1.-.1;......
17fc0 20 20 74 6d 31 2e 74 6d 5f 6d 64 61 79 20 3d 20 64 31 3b 00 00 00 1c 20 20 20 20 74 6d 32 2e 74 ..tm1.tm_mday.=.d1;........tm2.t
17fe0 6d 5f 79 65 61 72 20 3d 20 79 32 20 2d 20 31 39 30 30 3b 00 00 00 18 20 20 20 20 74 6d 32 2e 74 m_year.=.y2.-.1900;........tm2.t
18000 6d 5f 6d 6f 6e 20 3d 20 6d 32 20 2d 20 31 3b 00 00 00 15 20 20 20 20 74 6d 32 2e 74 6d 5f 6d 64 m_mon.=.m2.-.1;........tm2.tm_md
18020 61 79 20 3d 20 64 32 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 31 20 3d 20 6d ay.=.d2;........time_t.time1.=.m
18040 6b 74 69 6d 65 28 26 74 6d 31 29 3b 00 00 00 20 20 20 20 20 74 69 6d 65 5f 74 20 74 69 6d 65 32 ktime(&tm1);........time_t.time2
18060 20 3d 20 6d 6b 74 69 6d 65 28 26 74 6d 32 29 3b 00 00 00 28 20 20 20 20 6c 6f 6e 67 20 64 69 66 .=.mktime(&tm2);...(....long.dif
18080 66 20 3d 20 28 74 69 6d 65 32 20 2d 20 74 69 6d 65 31 29 20 2f 20 38 36 34 30 30 3b 00 00 00 1f f.=.(time2.-.time1)./.86400;....
180a0 20 20 20 20 69 66 20 28 64 69 66 66 20 3c 20 30 29 20 64 69 66 66 20 3d 20 2d 64 69 66 66 3b 00 ....if.(diff.<.0).diff.=.-diff;.
180c0 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 64 69 66 66 65 72 65 6e 63 65 20 25 6c 64 20 64 61 ..*....printf("difference.%ld.da
180e0 79 73 5c 6e 22 2c 20 64 69 66 66 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 1e 76 6f 69 64 20 70 ys\n",.diff);....}........void.p
18100 72 69 6e 74 5f 75 73 61 67 65 28 63 68 61 72 20 2a 70 72 6f 67 29 20 7b 00 00 00 20 20 20 20 20 rint_usage(char.*prog).{........
18120 70 72 69 6e 74 66 28 22 75 73 61 67 65 20 65 78 61 6d 70 6c 65 73 3a 5c 6e 22 29 3b 00 00 00 35 printf("usage.examples:\n");...5
18140 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c ....printf("..%s.--show-length.\
18160 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 3c 20 20 20 20 70 72 69 "april.6\"\n",.prog);...<....pri
18180 6e 74 66 28 22 20 20 25 73 20 2d 2d 77 65 65 6b 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c ntf("..%s.--week.--show-length.\
181a0 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 3e 20 20 20 20 70 72 69 "april.6\"\n",.prog);...>....pri
181c0 6e 74 66 28 22 20 20 25 73 20 2d 2d 6d 6f 6e 74 68 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 ntf("..%s.--months.--show-length
181e0 20 5c 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 3d 20 20 20 20 70 .\"april.6\"\n",.prog);...=....p
18200 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 79 65 61 72 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 rintf("..%s.--years.--show-lengt
18220 68 20 5c 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 21 20 20 20 20 h.\"april.6\"\n",.prog);...!....
18240 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 6e 6f 77 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 printf("..%s.--now\n",.prog);...
18260 27 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 68 6f 77 2d 79 65 61 72 5c 6e 22 '....printf("..%s.--show-year\n"
18280 2c 20 70 72 6f 67 29 3b 00 00 00 2e 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 ,.prog);........printf("..%s.--s
182a0 68 6f 77 2d 6d 6f 6e 74 68 20 6d 61 72 63 68 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 27 20 20 how-month.march\n",.prog);...'..
182c0 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 74 6f 70 77 61 74 63 68 5c 6e 22 2c 20 70 ..printf("..%s.--stopwatch\n",.p
182e0 72 6f 67 29 3b 00 00 00 2a 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 61 64 64 2d rog);...*....printf("..%s.--add-
18300 64 61 79 73 20 31 30 30 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 3b 20 20 20 20 70 72 69 6e 74 days.100\n",.prog);...;....print
18320 66 28 22 20 20 25 73 20 2d 2d 62 65 74 77 65 65 6e 20 32 30 32 34 2d 30 31 2d 30 31 20 32 30 32 f("..%s.--between.2024-01-01.202
18340 35 2d 30 31 2d 30 31 5c 6e 22 2c 20 70 72 6f 67 29 3b 00 00 00 01 7d 00 00 00 00 00 00 00 21 69 5-01-01\n",.prog);....}.......!i
18360 6e 74 20 6d 61 69 6e 28 69 6e 74 20 61 72 67 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 76 29 20 7b nt.main(int.argc,.char.**argv).{
18380 00 00 00 14 20 20 20 20 69 6e 74 20 79 65 61 72 20 3d 20 32 30 32 36 3b 00 00 00 29 20 20 20 20 ........int.year.=.2026;...)....
183a0 63 68 61 72 20 2a 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 20 3d 20 22 63 61 6c 65 6e 64 61 72 2e char.*calendar_file.=."calendar.
183c0 74 78 74 22 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 txt";........int.show_year_flag.
183e0 3d 20 30 3b 00 00 00 20 20 20 20 20 63 68 61 72 20 2a 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 =.0;........char.*show_month_arg
18400 20 3d 20 4e 55 4c 4c 3b 00 00 00 21 20 20 20 20 63 68 61 72 20 2a 73 68 6f 77 5f 6c 65 6e 67 74 .=.NULL;...!....char.*show_lengt
18420 68 5f 61 72 67 20 3d 20 4e 55 4c 4c 3b 00 00 00 16 20 20 20 20 69 6e 74 20 77 65 65 6b 5f 66 6c h_arg.=.NULL;........int.week_fl
18440 61 67 20 3d 20 30 3b 00 00 00 1b 20 20 20 20 69 6e 74 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c 61 ag.=.0;........int.month_ago_fla
18460 67 20 3d 20 30 3b 00 00 00 1a 20 20 20 20 69 6e 74 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 20 g.=.0;........int.year_ago_flag.
18480 3d 20 30 3b 00 00 00 15 20 20 20 20 69 6e 74 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 =.0;........int.now_flag.=.0;...
184a0 1b 20 20 20 20 69 6e 74 20 73 74 6f 70 77 61 74 63 68 5f 66 6c 61 67 20 3d 20 30 3b 00 00 00 19 .....int.stopwatch_flag.=.0;....
184c0 20 20 20 20 69 6e 74 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 3d 20 30 3b 00 00 00 1a 20 20 20 ....int.add_days_val.=.0;.......
184e0 20 63 68 61 72 20 2a 62 65 74 77 65 65 6e 31 20 3d 20 4e 55 4c 4c 3b 00 00 00 1a 20 20 20 20 63 .char.*between1.=.NULL;........c
18500 68 61 72 20 2a 62 65 74 77 65 65 6e 32 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 har.*between2.=.NULL;...........
18520 2b 20 20 20 20 73 74 61 74 69 63 20 73 74 72 75 63 74 20 6f 70 74 69 6f 6e 20 6c 6f 6e 67 5f 6f +....static.struct.option.long_o
18540 70 74 69 6f 6e 73 5b 5d 20 3d 20 7b 00 00 00 2c 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 22 2c ptions[].=.{...,........{"year",
18560 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 79 27 7d 2c 00 00 00 2b .required_argument,.0,.'y'},...+
18580 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 79 65 61 72 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e ........{"show-year",.no_argumen
185a0 74 2c 20 30 2c 20 27 59 27 7d 2c 00 00 00 32 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6d 6f t,.0,.'Y'},...2........{"show-mo
185c0 6e 74 68 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6d 27 7d nth",.required_argument,.0,.'m'}
185e0 2c 00 00 00 33 20 20 20 20 20 20 20 20 7b 22 73 68 6f 77 2d 6c 65 6e 67 74 68 22 2c 20 72 65 71 ,...3........{"show-length",.req
18600 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6c 27 7d 2c 00 00 00 26 20 20 20 20 uired_argument,.0,.'l'},...&....
18620 20 20 20 20 7b 22 77 65 65 6b 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 77 27 ....{"week",.no_argument,.0,.'w'
18640 7d 2c 00 00 00 28 20 20 20 20 20 20 20 20 7b 22 6d 6f 6e 74 68 73 22 2c 20 6e 6f 5f 61 72 67 75 },...(........{"months",.no_argu
18660 6d 65 6e 74 2c 20 30 2c 20 27 4d 27 7d 2c 00 00 00 27 20 20 20 20 20 20 20 20 7b 22 79 65 61 72 ment,.0,.'M'},...'........{"year
18680 73 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 72 27 7d 2c 00 00 00 25 20 20 20 s",.no_argument,.0,.'r'},...%...
186a0 20 20 20 20 20 7b 22 6e 6f 77 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 6e 27 .....{"now",.no_argument,.0,.'n'
186c0 7d 2c 00 00 00 2b 20 20 20 20 20 20 20 20 7b 22 73 74 6f 70 77 61 74 63 68 22 2c 20 6e 6f 5f 61 },...+........{"stopwatch",.no_a
186e0 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 73 27 7d 2c 00 00 00 30 20 20 20 20 20 20 20 20 7b 22 61 rgument,.0,.'s'},...0........{"a
18700 64 64 2d 64 61 79 73 22 2c 20 72 65 71 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 dd-days",.required_argument,.0,.
18720 27 61 27 7d 2c 00 00 00 2f 20 20 20 20 20 20 20 20 7b 22 62 65 74 77 65 65 6e 22 2c 20 72 65 71 'a'},.../........{"between",.req
18740 75 69 72 65 64 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 62 27 7d 2c 00 00 00 35 20 20 20 20 uired_argument,.0,.'b'},...5....
18760 20 20 20 20 7b 22 63 61 6c 65 6e 64 61 72 2d 66 69 6c 65 22 2c 20 72 65 71 75 69 72 65 64 5f 61 ....{"calendar-file",.required_a
18780 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 63 27 7d 2c 00 00 00 26 20 20 20 20 20 20 20 20 7b 22 68 rgument,.0,.'c'},...&........{"h
187a0 65 6c 70 22 2c 20 6e 6f 5f 61 72 67 75 6d 65 6e 74 2c 20 30 2c 20 27 68 27 7d 2c 00 00 00 14 20 elp",.no_argument,.0,.'h'},.....
187c0 20 20 20 20 20 20 20 7b 30 2c 20 30 2c 20 30 2c 20 30 7d 00 00 00 06 20 20 20 20 7d 3b 00 00 00 .......{0,.0,.0,.0}........};...
187e0 04 20 20 20 20 00 00 00 19 20 20 20 20 69 6e 74 20 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 20 3d 20 .............int.option_index.=.
18800 30 3b 00 00 00 0a 20 20 20 20 69 6e 74 20 63 3b 00 00 00 1e 20 20 20 20 63 68 61 72 20 2a 62 65 0;........int.c;........char.*be
18820 74 77 65 65 6e 5f 61 72 67 73 20 3d 20 4e 55 4c 4c 3b 00 00 00 04 20 20 20 20 00 00 00 66 20 20 tween_args.=.NULL;...........f..
18840 20 20 77 68 69 6c 65 20 28 28 63 20 3d 20 67 65 74 6f 70 74 5f 6c 6f 6e 67 28 61 72 67 63 2c 20 ..while.((c.=.getopt_long(argc,.
18860 61 72 67 76 2c 20 22 79 3a 59 3a 6d 3a 6c 3a 77 4d 72 6e 73 61 3a 62 3a 63 3a 68 22 2c 20 6c 6f argv,."y:Y:m:l:wMrnsa:b:c:h",.lo
18880 6e 67 5f 6f 70 74 69 6f 6e 73 2c 20 26 6f 70 74 69 6f 6e 5f 69 6e 64 65 78 29 29 20 21 3d 20 2d ng_options,.&option_index)).!=.-
188a0 31 29 20 7b 00 00 00 14 20 20 20 20 20 20 20 20 73 77 69 74 63 68 20 28 63 29 20 7b 00 00 00 15 1).{............switch.(c).{....
188c0 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 79 27 3a 00 00 00 24 20 20 20 20 20 20 20 ............case.'y':...$.......
188e0 20 20 20 20 20 20 20 20 20 79 65 61 72 20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 .........year.=.atoi(optarg);...
18900 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 .................break;.........
18920 20 20 20 20 20 20 20 63 61 73 65 20 27 59 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 .......case.'Y':...#............
18940 20 20 20 20 73 68 6f 77 5f 79 65 61 72 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 ....show_year_flag.=.1;.........
18960 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 ...........break;...............
18980 20 63 61 73 65 20 27 6d 27 3a 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 .case.'m':...(................sh
189a0 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 ow_month_arg.=.optarg;..........
189c0 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 ..........break;................
189e0 63 61 73 65 20 27 6c 27 3a 00 00 00 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f case.'l':...)................sho
18a00 77 5f 6c 65 6e 67 74 68 5f 61 72 67 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 w_length_arg.=.optarg;..........
18a20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 ..........break;................
18a40 63 61 73 65 20 27 77 27 3a 00 00 00 1e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 77 65 65 case.'w':....................wee
18a60 6b 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 k_flag.=.1;....................b
18a80 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 4d 27 3a 00 00 reak;................case.'M':..
18aa0 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 6f 6e 74 68 5f 61 67 6f 5f 66 6c 61 67 .#................month_ago_flag
18ac0 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 .=.1;....................break;.
18ae0 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 72 27 3a 00 00 00 22 20 20 20 20 ...............case.'r':..."....
18b00 20 20 20 20 20 20 20 20 20 20 20 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 20 3d 20 31 3b 00 00 ............year_ago_flag.=.1;..
18b20 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 ..................break;........
18b40 20 20 20 20 20 20 20 20 63 61 73 65 20 27 6e 27 3a 00 00 00 1d 20 20 20 20 20 20 20 20 20 20 20 ........case.'n':...............
18b60 20 20 20 20 20 6e 6f 77 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 .....now_flag.=.1;..............
18b80 20 20 20 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 ......break;................case
18ba0 20 27 73 27 3a 00 00 00 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 6f 70 77 61 74 .'s':...#................stopwat
18bc0 63 68 5f 66 6c 61 67 20 3d 20 31 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ch_flag.=.1;....................
18be0 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 61 27 3a 00 break;................case.'a':.
18c00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 ..,................add_days_val.
18c20 3d 20 61 74 6f 69 28 6f 70 74 61 72 67 29 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 =.atoi(optarg);.................
18c40 20 20 20 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 62 ...break;................case.'b
18c60 27 3a 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 5f 61 72 ':...&................between_ar
18c80 67 73 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 gs.=.optarg;....................
18ca0 62 72 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 63 27 3a 00 break;................case.'c':.
18cc0 00 00 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 65 6e 64 61 72 5f 66 69 6c 65 ..'................calendar_file
18ce0 20 3d 20 6f 70 74 61 72 67 3b 00 00 00 16 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 .=.optarg;....................br
18d00 65 61 6b 3b 00 00 00 15 20 20 20 20 20 20 20 20 20 20 20 20 63 61 73 65 20 27 68 27 3a 00 00 00 eak;................case.'h':...
18d20 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 %................print_usage(arg
18d40 76 5b 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e v[0]);....................return
18d60 20 30 3b 00 00 00 14 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 3a 00 00 00 25 20 .0;................default:...%.
18d80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b ...............print_usage(argv[
18da0 30 5d 29 3b 00 00 00 19 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 31 0]);....................return.1
18dc0 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 ;............}........}.........
18de0 00 00 17 20 20 20 20 69 66 20 28 62 65 74 77 65 65 6e 5f 61 72 67 73 29 20 7b 00 00 00 30 20 20 .......if.(between_args).{...0..
18e00 20 20 20 20 20 20 63 68 61 72 20 2a 73 70 61 63 65 20 3d 20 73 74 72 63 68 72 28 62 65 74 77 65 ......char.*space.=.strchr(betwe
18e20 65 6e 5f 61 72 67 73 2c 20 27 20 27 29 3b 00 00 00 14 20 20 20 20 20 20 20 20 69 66 20 28 73 70 en_args,.'.');............if.(sp
18e40 61 63 65 29 20 7b 00 00 00 1a 20 20 20 20 20 20 20 20 20 20 20 20 2a 73 70 61 63 65 20 3d 20 27 ace).{................*space.=.'
18e60 5c 30 27 3b 00 00 00 24 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 65 65 6e 31 20 3d 20 62 \0';...$............between1.=.b
18e80 65 74 77 65 65 6e 5f 61 72 67 73 3b 00 00 00 21 20 20 20 20 20 20 20 20 20 20 20 20 62 65 74 77 etween_args;...!............betw
18ea0 65 65 6e 32 20 3d 20 73 70 61 63 65 20 2b 20 31 3b 00 00 00 09 20 20 20 20 20 20 20 20 7d 00 00 een2.=.space.+.1;............}..
18ec0 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 36 20 20 20 20 63 61 6c 65 6e 64 61 72 20 ......}...........6....calendar.
18ee0 63 61 6c 20 3d 20 6c 6f 61 64 5f 63 61 6c 65 6e 64 61 72 28 63 61 6c 65 6e 64 61 72 5f 66 69 6c cal.=.load_calendar(calendar_fil
18f00 65 2c 20 79 65 61 72 29 3b 00 00 00 04 20 20 20 20 00 00 00 19 20 20 20 20 69 66 20 28 73 68 6f e,.year);................if.(sho
18f20 77 5f 79 65 61 72 5f 66 6c 61 67 29 20 7b 00 00 00 17 20 20 20 20 20 20 20 20 73 68 6f 77 5f 79 w_year_flag).{............show_y
18f40 65 61 72 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 ear(cal);........}........else.i
18f60 66 20 28 73 68 6f 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 20 7b 00 00 00 35 20 20 20 20 20 20 20 20 f.(show_month_arg).{...5........
18f80 69 6e 74 20 6d 6f 6e 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 73 68 6f int.month.=.parse_month(cal,.sho
18fa0 77 5f 6d 6f 6e 74 68 5f 61 72 67 29 3b 00 00 00 1f 20 20 20 20 20 20 20 20 73 68 6f 77 5f 6d 6f w_month_arg);............show_mo
18fc0 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 1f 20 20 20 nth(cal,.month);........}.......
18fe0 20 65 6c 73 65 20 69 66 20 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 29 20 7b 00 00 00 1b .else.if.(show_length_arg).{....
19000 20 20 20 20 20 20 20 20 63 68 61 72 20 6d 6f 6e 74 68 5f 73 74 72 5b 32 30 5d 3b 00 00 00 10 20 ........char.month_str[20];.....
19020 20 20 20 20 20 20 20 69 6e 74 20 64 61 79 3b 00 00 00 3a 20 20 20 20 20 20 20 20 73 73 63 61 6e .......int.day;...:........sscan
19040 66 28 73 68 6f 77 5f 6c 65 6e 67 74 68 5f 61 72 67 2c 20 22 25 73 20 25 64 22 2c 20 6d 6f 6e 74 f(show_length_arg,."%s.%d",.mont
19060 68 5f 73 74 72 2c 20 26 64 61 79 29 3b 00 00 00 30 20 20 20 20 20 20 20 20 69 6e 74 20 6d 6f 6e h_str,.&day);...0........int.mon
19080 74 68 20 3d 20 70 61 72 73 65 5f 6d 6f 6e 74 68 28 63 61 6c 2c 20 6d 6f 6e 74 68 5f 73 74 72 29 th.=.parse_month(cal,.month_str)
190a0 3b 00 00 00 53 20 20 20 20 20 20 20 20 73 68 6f 77 5f 64 61 79 5f 6c 65 6e 67 74 68 28 63 61 6c ;...S........show_day_length(cal
190c0 2c 20 6d 6f 6e 74 68 2c 20 64 61 79 2c 20 77 65 65 6b 5f 66 6c 61 67 2c 20 6d 6f 6e 74 68 5f 61 ,.month,.day,.week_flag,.month_a
190e0 67 6f 5f 66 6c 61 67 2c 20 79 65 61 72 5f 61 67 6f 5f 66 6c 61 67 29 3b 00 00 00 05 20 20 20 20 go_flag,.year_ago_flag);........
19100 7d 00 00 00 18 20 20 20 20 65 6c 73 65 20 69 66 20 28 6e 6f 77 5f 66 6c 61 67 29 20 7b 00 00 00 }........else.if.(now_flag).{...
19120 1f 20 20 20 20 20 20 20 20 73 68 6f 77 5f 63 75 72 72 65 6e 74 5f 74 69 6d 65 28 63 61 6c 29 3b .........show_current_time(cal);
19140 00 00 00 05 20 20 20 20 7d 00 00 00 1e 20 20 20 20 65 6c 73 65 20 69 66 20 28 73 74 6f 70 77 61 ........}........else.if.(stopwa
19160 74 63 68 5f 66 6c 61 67 29 20 7b 00 00 00 1b 20 20 20 20 20 20 20 20 72 75 6e 5f 73 74 6f 70 77 tch_flag).{............run_stopw
19180 61 74 63 68 28 63 61 6c 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 21 20 20 20 20 65 6c 73 65 20 atch(cal);........}...!....else.
191a0 69 66 20 28 61 64 64 5f 64 61 79 73 5f 76 61 6c 20 21 3d 20 30 29 20 7b 00 00 00 24 20 20 20 20 if.(add_days_val.!=.0).{...$....
191c0 20 20 20 20 61 64 64 5f 64 61 79 73 28 63 61 6c 2c 20 61 64 64 5f 64 61 79 73 5f 76 61 6c 29 3b ....add_days(cal,.add_days_val);
191e0 00 00 00 05 20 20 20 20 7d 00 00 00 24 20 20 20 20 65 6c 73 65 20 69 66 20 28 62 65 74 77 65 65 ........}...$....else.if.(betwee
19200 6e 31 20 26 26 20 62 65 74 77 65 65 6e 32 29 20 7b 00 00 00 36 20 20 20 20 20 20 20 20 64 61 79 n1.&&.between2).{...6........day
19220 73 5f 62 65 74 77 65 65 6e 5f 63 6f 6d 6d 61 6e 64 28 63 61 6c 2c 20 62 65 74 77 65 65 6e 31 2c s_between_command(cal,.between1,
19240 20 62 65 74 77 65 65 6e 32 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 0a 20 20 20 20 65 6c 73 65 .between2);........}........else
19260 20 7b 00 00 00 1d 20 20 20 20 20 20 20 20 70 72 69 6e 74 5f 75 73 61 67 65 28 61 72 67 76 5b 30 .{............print_usage(argv[0
19280 5d 29 3b 00 00 00 05 20 20 20 20 7d 00 00 00 04 20 20 20 20 00 00 00 0d 20 20 20 20 72 65 74 75 ]);........}................retu
192a0 72 6e 20 30 3b 00 00 00 01 7d 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 7e 01 00 00 00 00 rn.0;....}5...............~.....
192c0 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ac 2f 00 00 00 00 00 00 01 00 00 00 00 00 .................../............
192e0 00 00 35 81 5f d0 00 00 00 12 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 01 00 00 ..5._...........................
19300 00 00 00 00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
193a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
193c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
193e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19460 00 00 00 00 00 00 00 00 6a 00 3f 88 04 01 00 00 00 0c 00 f5 18 00 00 00 f5 00 00 00 00 00 00 00 ........j.?.....................
19480 00 00 00 00 01 00 00 00 12 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d f5 18 00 00 00 .............printf("..%s.-.....
194a0 f6 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 7c 00 00 00 00 00 00 00 00 00 00 00 01 00 ..................|.............
194c0 00 00 1b 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 74 65 6d 70 5f 79 65 61 72 20 3d f5 18 ...............int.temp_year.=..
194e0 00 00 00 7d 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...}............................
19500 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 ........................5.......
19520 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7c 00 00 00 1b 00 00 00 00 00 00 00 00 00 00 00 ................|...............
19540 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 00 00 00 00 7c 00 00 00 1b 00 00 00 00 00 ......................|.........
19560 00 00 00 00 00 00 79 00 00 00 12 00 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 0f ......y.........................
19580 00 00 00 00 00 00 f5 18 00 00 00 00 f5 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 88 00 00 00 ................................
195a0 01 00 00 00 f8 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 0f 00 00 00 00 00 00 35 81 5f d0 ....................w.......5._.
195c0 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 f5 00 00 00 00 00 00 00 00 ................................
195e0 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19680 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
196a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
196c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
196e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
19720 00 f5 00 00 00 27 00 00 00 00 00 00 00 f8 00 00 00 27 00 00 00 00 00 00 00 56 00 00 00 27 00 00 .....'...........'.......V...'..
19740 00 00 6a 00 40 21 04 01 00 00 00 0d 00 f5 18 00 00 00 f7 00 00 00 f9 00 00 00 00 00 00 00 01 00 ..j.@!..........................
19760 00 00 3d 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 79 65 61 72 73 20 2d 2d 73 68 ..=....printf("..%s.--years.--sh
19780 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b ow-length.\"april.6\"\n",.prog);
197a0 f5 18 00 00 00 f6 00 00 00 f8 00 00 00 00 00 00 00 01 00 00 00 3e 20 20 20 20 70 72 69 6e 74 66 .....................>....printf
197c0 28 22 20 20 25 73 20 2d 2d 6d 6f 6e 74 68 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 ("..%s.--months.--show-length.\"
197e0 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b f5 18 00 00 00 f5 00 00 00 f7 00 00 april.6\"\n",.prog);............
19800 00 00 00 00 00 01 00 00 00 3c 20 20 20 20 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 77 65 65 .........<....printf("..%s.--wee
19820 6b 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 61 70 72 69 6c 20 36 5c 22 5c 6e 22 2c 20 k.--show-length.\"april.6\"\n",.
19840 70 72 6f 67 29 3b f5 18 00 00 00 f4 00 00 00 f6 00 00 01 7e 00 00 00 01 00 00 00 35 20 20 20 20 prog);.............~.......5....
19860 70 72 69 6e 74 66 28 22 20 20 25 73 20 2d 2d 73 68 6f 77 2d 6c 65 6e 67 74 68 20 5c 22 61 70 72 printf("..%s.--show-length.\"apr
19880 69 6c 20 36 5c 22 5c 6e 22 2c 20 70 72 6f 67 29 3b 35 81 f5 18 00 00 00 00 f4 00 00 00 27 00 00 il.6\"\n",.prog);5...........'..
198a0 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 d7 1f 00 00 00 00 00 00 01 00 00 00 00 00 00 ................................
198c0 00 01 00 00 00 00 00 00 00 f5 18 00 00 00 00 f5 00 00 00 2e 00 00 00 00 00 00 00 01 00 00 00 00 ................................
198e0 00 00 00 01 00 00 00 14 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 f5 ................................
19900 18 00 00 00 00 f6 00 00 00 30 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 53 20 00 .........0...................S..
19920 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 f5 18 00 00 00 00 f7 00 00 00 2f .............................../
19940 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 91 20 00 00 00 00 00 00 01 00 00 00 00 ................................
19960 00 00 00 01 00 00 00 00 00 00 00 35 81 e7 aa ...........5...