File: moon.bat

package info (click to toggle)
gcal 4.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,952 kB
  • sloc: ansic: 98,660; sh: 8,454; perl: 2,088; awk: 1,531; makefile: 614; sed: 166
file content (177 lines) | stat: -rw-r--r-- 5,459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
@echo off
::  $Id: moon.bat 0.07 2000/01/12 00:00:07 tom Exp $
::
::  moon.bat:  Uses `moon1.awk' and `moon2.awk' for displaying the dates
::               at which the next Full Moon and New Moon phases take place,
::               plus some additionally information about today's date.
::
::             Usage: moon --help
::             Usage: moon [more Gcal options...]
::
::  MS-DOS solution.
::
::  Needs `gcal' and `gawk' for processing!
::
::  Copyright (c) 2000  Thomas Esken      <esken@uni-muenster.de>
::                      Im Hagenfeld 84
::                      D-48147 M"unster
::                      GERMANY
::
::  This software doesn't claim completeness, correctness or usability.
::  On principle I will not be liable for ANY damages or losses (implicit
::  or explicit), which result from using or handling my software.
::  If you use this software, you agree without any exception to this
::  agreement, which binds you LEGALLY !!
::
::  This program is free software; you can redistribute it and/or modify
::  it under the terms of the `GNU General Public License' as published by
::  the `Free Software Foundation'; either version 3, or (at your option)
::  any later version.
::
::  You should have received a copy of the `GNU General Public License'
::  along with this program; if not, write to the:
::
::
::
:: Basically used programs, set these environment variables properly!
::
set _=gcal
set oldgcalpath=%gcalpath%
set gcalpath=.
set -=gawk
set oldawkpath=%awkpath%
set awkpath=.;c:\dos

::
:: Generic file names, set these environment variables properly!
::
set myname=%0
set mydefaultname=moon
::
:: Input file names, set these environment variables properly!
::
set awkscript1=%mydefaultname%1.awk
set awkscript2=%mydefaultname%2.awk
::
if ""%1 == "" goto next0
if %1 == --help goto usage
if %1 == --HELP goto usage
if %1 == --hel goto usage
if %1 == --HEL goto usage
if %1 == --he goto usage
if %1 == --HE goto usage
if %1 == --h goto usage
if %1 == --H goto usage
if %1 == -h goto usage
if %1 == -H goto usage
if %1 == /h goto usage
if %1 == /H goto usage
if %1 == -? goto usage
if %1 == /? goto usage
if %1 == ? goto usage
::
:next0
if exist %awkscript1% goto next1
echo %0: error: file `%awkscript1%' is missing
goto eof
::
:next1
if exist %awkscript2% goto start
echo %0: error: file `%awkscript2%' is missing
goto eof
::
:start
::
:: Prints some information about today's day.
::
echo 0@t %%-_ : Today is %%K , %%1%%n%%2 (J.D. %%3%%j%%4, DOY %%3%%N %%4, CW %%1%%k %%2).>$$$mtxt
%_% %1 %2 %3 -f$$$mtxt -QUx
del $$$*>NUL:
::
:: Prints today's Moon phase.
::
%_% %1 %2 %3 -fNUL: -QUx -# "0@t %%-\_ : The Moon phase is %%1%%O %%2."
::
:: Prints date of next Full Moon phase.
::
set moon_marker=@
%_% %1 %2 %3 -fNUL: -QUx -# "0 %%O" -I%moon_marker%>NUL:
if errorlevel 1 goto fm1:
%_% %1 %2 %3 -fNUL: -QUx -# "0@t %%-\_ : Today (%%n) is Full Moon."
:fm1
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O" -I%moon_marker%>NUL:
if errorlevel 1 goto fm2:
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O">$$$moon
%-% -f%awkscript1% -vmoon=full $$$moon>$$$mres
goto fm-result
:fm2
%_% %1 %2 %3 -fNUL: -QUx -# "0 %%M  %%>04*Y">$$$date
%-% -f%awkscript2% $$$date>$$$@date
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O">$$$moon
%_% %1 %2 %3 -fNUL: -QUxm @$$$@date -# "0*d1#999 %%O">>$$$moon
%-% -f%awkscript1% -vmoon=full $$$moon>$$$mres
:fm-result
echo 0@t %%-_ : Next Full Moon is on %%1%%n+$f%%2 (%%3in $f $t%%4).>$$$mtxt
%_% %1 %2 %3 -f$$$mtxt @$$$mres -QUx
del $$$moon>NUL:
::
:: Prints date of next New Moon phase.
::
set moon_marker=!
%_% %1 %2 %3 -fNUL: -QUx -# "0 %%O" -I%moon_marker%>NUL:
if errorlevel 1 goto nm1:
%_% %1 %2 %3 -fNUL: -QUx -# "0@t %%-\_ : Today (%%n) is New Moon."
:nm1
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O" -I%moon_marker%>NUL:
if errorlevel 1 goto nm2:
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O">$$$moon
%-% -f%awkscript1% -vmoon=new $$$moon>$$$mres
goto nm-result
:nm2
if exist $$$date goto nm3
%_% %1 %2 %3 -fNUL: -QUx -# "0 %%M  %%>04*Y">$$$date
%-% -f%awkscript2% $$$date>$$$@date
:nm3
%_% %1 %2 %3 -fNUL: -QUxm+ -# "0*d1#999 %%O">$$$moon
%_% %1 %2 %3 -fNUL: -QUxm @$$$@date -# "0*d1#999 %%O">>$$$moon
%-% -f%awkscript1% -vmoon=new $$$moon>$$$mres
:nm-result
echo 0@t %%-_ : Next New Moon is on %%1%%n+$f%%2 (%%3in $f $t%%4).>$$$mtxt
%_% %1 %2 %3 -f$$$mtxt @$$$mres -QUx
del $$$*>NUL:
set moon_marker=
::
:: Prints the number of days until New Year's Day of next year.
::
%_% %1 %2 %3 -fNUL: -QUxy -# "00001231 $d=%%d">$$$mdays
echo $d++>>$$$mdays
echo 0 %%-_ : Only %%1$d%%2 days remaining until %%3%%n+$d%%4 (J.D. %%3%%j+$d%%4).>>$$$mdays
%_% %1 %2 %3 -f$$$mdays -QUx
del $$$*>NUL:
::
:: Prints the number of days until New Year's Day 3000.
::
echo 30000101 %%-_ : Only %%1%%d%%2 days remaining until %%3%%n%%4 (J.D. %%3%%j%%4).>$$$mtxt
%_% %1 %2 %3 -f$$$mtxt -QUx -u 1 3000
del $$$*>NUL:
goto eof
::
:usage
echo %myname%: Displays the dates at which the next Full Moon and
echo %myname%: New Moon phases take place, plus some additionally
echo %myname%: information about today's date.
echo %myname%:
echo usage: %myname%  [more Gcal options...]
::
:eof
::
set awkscript2=
set awkscript1=
set mydefaultname=
set myname=
set awkpath=%oldawkpath%
set oldawkpath=
set -=
set gcalpath=%oldgcalpath%
set oldgcalpath=
set _=