---
 wmsun/Makefile |  18 +--
 wmsun/wmSun.1  |  47 -------
 wmsun/wmSun.c  | 401 ---------------------------------------------------------
 wmsun/wmsun.1  |  47 +++++++
 wmsun/wmsun.c  | 401 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 457 insertions(+), 457 deletions(-)
 delete mode 100644 wmsun/wmSun.1
 delete mode 100644 wmsun/wmSun.c
 create mode 100644 wmsun/wmsun.1
 create mode 100644 wmsun/wmsun.c

diff --git a/wmsun/Makefile b/wmsun/Makefile
index 81f0f67..20e26a6 100644
--- a/wmsun/Makefile
+++ b/wmsun/Makefile
@@ -16,26 +16,26 @@ LIBS   = -lXpm -lX11 -lXext -lm
 #
 # LIBS   = -lXpm -lX11 -lXext -lsocket
 
-OBJS   = wmSun.o SunRise.o wmgeneral/wmgeneral.o
+OBJS   = wmsun.o SunRise.o wmgeneral/wmgeneral.o
 
 .c.o:
        $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $*.o
 
-all:   wmSun.o wmSun
+all:   wmsun.o wmsun
 
-wmSun.o: wmSun_master.xpm wmSun_mask.xbm
+wmsun.o: wmSun_master.xpm wmSun_mask.xbm
 
-wmSun: $(OBJS)
-       $(CC) $(LDFLAGS) -o wmSun $^ $(LIBS)
+wmsun: $(OBJS)
+       $(CC) $(LDFLAGS) -o wmsun $^ $(LIBS)
 
 clean:
        for i in $(OBJS) ; do \
                rm -f $$i; \
        done
-       rm -f wmSun
+       rm -f wmsun
 
-install:: wmSun
+install:: wmsun
        $(INSTALL) -d $(DESTDIR)$(BINDIR)
-       $(INSTALL) wmSun $(DESTDIR)$(BINDIR)
+       $(INSTALL) wmsun $(DESTDIR)$(BINDIR)
        $(INSTALL) -d $(DESTDIR)$(MANDIR)
-       $(INSTALL) -m 644 wmSun.1 $(DESTDIR)$(MANDIR)
+       $(INSTALL) -m 644 wmsun.1 $(DESTDIR)$(MANDIR)
diff --git a/wmsun/wmSun.1 b/wmsun/wmSun.1
deleted file mode 100644
index 33cbd88..0000000
--- a/wmsun/wmSun.1
+++ /dev/null
@@ -1,47 +0,0 @@
-.TH WMSUN 1 "5 January 1999"
-.SH NAME
-WMSUN \- Dockable WindowMaker SunRise/SunSet App
-.SH SYNOPSIS
-.B wmSun [OPTIONS]
-.SH DESCRIPTION
-.PP
-wmSun displays the current day's Sun Rise and Set Times. You must enter your
-LAtitude and Longitude correctly for it to work.
-.SH OPTIONS
-.TP
-.B \-h
-Display list of command-line options.
-.TP
-.B \-display <display>
-Use an alternate X Display.
-.TP
-.B \-geometry <geometry>
-Set window geometry.
-.TP
-.B \-lat <Latitude>
-Set latitude of observer.
-.TP
-.B \-lon <Longitude>
-Set longitude of observer.
-.TP
-.B \-td <UT - LT>
-Set the difference beteeen UT and LT. Useful when you want to show the
-Sunrise/Sunset at a remote lat/lon without resetting your clock.
-.TP
-.B \-12
-Use 12-hour clock.
-.TP
-.B \-date <yyyymmdd>
-Set the date to show sunrise/sunset for.
-.SH EXAMPLES
-.TP
-.B wmSun -lon 106.3 -lat 35.9
-this would display rise/set times at Los Alamos in local time.
-.TP
-.B wmSun -lat 19.58 -lon 155.92 -td 10
-this would display rise/set times in Kona, Hawaii in local time (in winter -- 
you need to
-take into account daylight savings at other times of the year).
-.SH BUGS
-Who knows? (Let me know if you find any).
-.SH AUTHOR
-Michael G. Henderson <[email protected]>
diff --git a/wmsun/wmSun.c b/wmsun/wmSun.c
deleted file mode 100644
index a0ad31b..0000000
--- a/wmsun/wmSun.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- *
- *     wmSun-1.03 (C) 1999 Mike Henderson ([email protected])
- *
- *             - Shows Sun Rise/Set Times....
- *
- *
- *
- *
- *
- *     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 2, or (at your option)
- *     any later version.
- *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program (see the file COPYING); if not, write to the
- *     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- *      Boston, MA  02111-1307, USA
- *
- *      Things TODO:
- *                  - clean up code!
- *                  - support for 8-bit displays.
- *                  - more detailed documentation.
- *                  - eclipses?
- *                  - add buttons to play will date and lat lon...
- *                    Could be something like this;
- *                       First click brings up buttons to change date.
- *                       Second click brings up buttons to change lat/lon.
- *                       Third goes back to display
- *                       Set time delay to go back to display if user doesnt 
do it...
- *
- *
- *
- *
- *
- *      Changes:
- *
- *     Version 1.03 - released February 4, 1999.
- *                     cosmetic for AfterStep users. removed spurious black 
line at RHS edge an mask.
- *
- *
- *     Version 1.02 - released January 12, 1999.
- *                    Added support for User-specified date and Time 
difference so that
- *                    you can have the display be correct in local time even 
for remote
- *                     lat/lons. (I am in Hawaii right now. I dont want to 
reset the time on
- *                     my laptop, so with these new options I can still get 
the correct
- *                     local times of rise/set. Sunset is awesome here in 
Kona!!! And the calcs
- *                     seem to be quite good -- it's a good test here because 
the Sun sets over
- *                     the Pacific (no mountains are in the way)).
- *
- *     Version 1.01 - released January 6, 1999.
- *                     Fixed stupid bug in Date change montior.
- *
- *     Version 1.0 - released January 5, 1999.
- *
- *
- */
-
-
-
-
-
-/*
- *   Includes
- */
-#define _POSIX_C_SOURCE 1
-#include <stdio.h>
-#include <math.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <X11/X.h>
-#include <X11/xpm.h>
-#include "wmgeneral/wmgeneral.h"
-#include "wmSun_master.xpm"
-#include "wmSun_mask.xbm"
-
-
-
-/*
- *  Delay between refreshes (in microseconds)
- */
-#define DELAY 10000L
-#define WMSUN_VERSION "1.03"
-
-#define DegPerRad       57.29577951308232087680
-#define RadPerDeg        0.01745329251994329576
-
-
-
-
-
-void ParseCMDLine(int argc, char *argv[]);
-void pressEvent(XButtonEvent *xev);
-void SunRise(int year, int month, int day, double LocalHour, double *UTRise,
-       double *UTSet);
-
-int    ToggleWindow = 0;
-int    nMAX = 1;
-int    Flag = 1;
-int    UseUserTimeDiff = 0;
-int    UseUserDate = 0;
-long   UserDate;
-double         Glat, Glon, SinGlat, CosGlat, TimeZone, UserTimeDiff;
-int    TwelveHour = 0;
-
-
-int    xDigit[11] = {8, 18, 27, 37, 46, 55, 64, 74, 83, 92, 102};
-
-
-
-
-/*
- *   main
- */
-int main(int argc, char *argv[]) {
-
-
-
-
-
-    struct tm          *GMTTime, *LocalTime;
-    XEvent             event;
-    int                        n;
-    int                Year, Month, OldLocalDayOfMonth;
-    int                        LocalDayOfMonth,        DayOfMonth;
-    long               CurrentLocalTime, CurrentGMTTime, date;
-    double             UT, val, LTRise, LTSet, LocalHour, hour24();
-    int                        H, M;
-
-
-
-
-
-
-    /*
-     *  Parse any command line arguments.
-     */
-    Glat = Glon = 0.0;
-    ParseCMDLine(argc, argv);
-    Glat *= RadPerDeg; SinGlat = sin( Glat ); CosGlat = cos( Glat );
-
-
-
-    openXwindow(argc, argv, wmSun_master, (char *)wmSun_mask_bits, 
wmSun_mask_width, wmSun_mask_height);
-
-
-
-
-
-    /*
-     *  Loop until we die
-     */
-    n = 32000;
-    OldLocalDayOfMonth = -999;
-    while(1) {
-
-
-       if (Flag) {
-           n = 32000;
-           Flag = 0;
-       }
-
-
-
-
-       /*
-        *  The Moon Ephemeris calculations are somewhat costly (the Moon is 
one of the most
-        *  difficult objects to compute position for). So only process every 
nMAXth cycle of this
-        *  loop. We run outer loop it faster to catch expose events, button 
presses, etc...
-        *
-        */
-       if (n>nMAX){
-           struct tm result;
-
-           n = 0;
-           nMAX = 1000;
-
-
-           CurrentGMTTime = time(CurrentTime);
-           GMTTime = gmtime_r(&CurrentGMTTime, &result);
-           DayOfMonth = GMTTime->tm_mday;
-
-           UT = GMTTime->tm_hour + GMTTime->tm_min/60.0 + 
GMTTime->tm_sec/3600.0;
-           Year = GMTTime->tm_year+1900;
-           Month = GMTTime->tm_mon+1;
-
-
-           CurrentLocalTime = CurrentGMTTime;
-           LocalTime = localtime_r(&CurrentLocalTime, &result);
-           LocalDayOfMonth = LocalTime->tm_mday;
-
-           if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){
-
-               Flag = 0;
-
-               if (UseUserDate){
-                   date =  UserDate;
-                   Year = date/10000;
-                   date -= Year*10000;
-                   Month = date/100;
-                   date -= Month*100;
-                   DayOfMonth = date;
-                   date = UserDate;
-               } else {
-                   date = Year*10000 + Month*100 + DayOfMonth;
-               }
-               LocalHour = LocalTime->tm_hour + LocalTime->tm_min/60.0 + 
LocalTime->tm_sec/3600.0;
-               TimeZone = (UseUserTimeDiff) ? UserTimeDiff : UT - LocalHour;
-
-               /*
-                *  Clear Plotting area
-                */
-               copyXPMArea(65, 5, 54, 54, 5, 5);
-
-
-
-               /*
-                *  Compute Sun Rise/Set Times in Local Time
-                */
-               SunRise(Year, Month, DayOfMonth, LocalHour, &LTRise, &LTSet);
-
-               if (LTRise > 0.0){
-                   val = LTRise;
-                   H = (int)val; val = (val-H)*60.0;
-                   if (TwelveHour) {
-                       H = H % 12;
-                       if (H == 0)
-                           H = 12;
-                   }
-                   M = (int)val;
-                   copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 13);
-                   copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 13);
-                   copyXPMArea(xDigit[10],   75, 3, 6, 17+15, 15);
-                   copyXPMArea(xDigit[M/10], 73, 7, 9, 17+19, 13);
-                   copyXPMArea(xDigit[M%10], 73, 7, 9, 17+26, 13);
-               } else {
-                   copyXPMArea(10, 84, 28, 7, 19, 15);
-               }
-
-
-               if (LTSet > 0.0){
-                   val = LTSet;
-                   H = (int)val; val = (val-H)*60.0;
-                   if (TwelveHour) {
-                       H = H % 12;
-                       if (H == 0)
-                           H = 12;
-                   }
-                   M = (int)val;
-                   copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 40);
-                   copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 40);
-                   copyXPMArea(xDigit[10],   75, 3, 6, 17+15, 42);
-                   copyXPMArea(xDigit[M/10], 73, 7, 9, 17+19, 40);
-                   copyXPMArea(xDigit[M%10], 73, 7, 9, 17+26, 40);
-               } else {
-                   copyXPMArea(10, 84, 28, 7, 19, 40);
-               }
-
-           }
-
-           OldLocalDayOfMonth = LocalDayOfMonth;
-
-
-       } else {
-
-           /*
-            *  Update the counter.
-            */
-           ++n;
-
-       }
-
-
-
-
-
-
-
-
-       /*
-        *   Process any pending X events.
-        */
-        while(XPending(display)){
-            XNextEvent(display, &event);
-            switch(event.type){
-                case Expose:
-                        RedrawWindow();
-                        break;
-                case ButtonPress:
-                        pressEvent(&event.xbutton);
-                        break;
-                case ButtonRelease:
-                        break;
-            }
-        }
-
-
-
-
-
-
-       /*
-        *  Redraw and wait for next update
-        */
-       RedrawWindow();
-       usleep(DELAY);
-
-
-     }
-
-
-
-}
-
-
-
-
-
-
-
-
-/*
- *   ParseCMDLine()
- */
-void ParseCMDLine(int argc, char *argv[]) {
-
-    int  i;
-
-    for (i = 1; i < argc; i++) {
-
-        if (!strcmp(argv[i], "-display")){
-
-           ++i;
-
-        } else if (!strcmp(argv[i], "-geometry")){
-
-           ++i;
-
-        } else if (!strcmp(argv[i], "-lat")){
-
-           Glat = atof(argv[++i]);
-
-        } else if (!strcmp(argv[i], "-lon")){
-
-           Glon = atof(argv[++i]);
-
-        } else if (!strcmp(argv[i], "-td")){
-
-           UseUserTimeDiff = 1;
-           UserTimeDiff = atof(argv[++i]);
-
-        } else if (!strcmp(argv[i], "-date")){
-
-           UseUserDate = 1;
-           UserDate = atoi(argv[++i]);
-
-       } else if (!strcmp(argv[i], "-12")){
-
-           TwelveHour = 1;
-
-       } else {
-           printf("\nwmSun version: %s\n", WMSUN_VERSION);
-           printf("\nusage: wmSun [-display <Display>] [-lat <Latitude>] [-lon 
<Longitude>] [-h]\n\n");
-           printf("\t-display <Display>\tUse alternate X display.\n");
-           printf("\t-geometry <Geometry>\tSet window geometry.\n");
-           printf("\t-lat <Latitude>\t\tObservers Latitude. Positive to the 
west.\n");
-           printf("\t-lon <Longitude>\tObservers Longitude.\n");
-           printf("\t-td <Delta Time>\tUser defined difference between UT an 
LT (hrs).\n");
-           printf("\t-12\t\t\tUse 12-hour clock.\n");
-           printf("\t-h\t\t\tDisplay help screen.\n\n");
-           exit(1);
-       }
-    }
-
-}
-
-
-/*
- *  This routine handles button presses. Clicking in the window
- *  toggles the display.
- *
- */
-void pressEvent(XButtonEvent *xev){
-
-   (void) xev;
-   ++ToggleWindow;
-   if (ToggleWindow > 4) ToggleWindow = 0;
-   Flag = 1;
-
-   return;
-
-}
-
diff --git a/wmsun/wmsun.1 b/wmsun/wmsun.1
new file mode 100644
index 0000000..33cbd88
--- /dev/null
+++ b/wmsun/wmsun.1
@@ -0,0 +1,47 @@
+.TH WMSUN 1 "5 January 1999"
+.SH NAME
+WMSUN \- Dockable WindowMaker SunRise/SunSet App
+.SH SYNOPSIS
+.B wmSun [OPTIONS]
+.SH DESCRIPTION
+.PP
+wmSun displays the current day's Sun Rise and Set Times. You must enter your
+LAtitude and Longitude correctly for it to work.
+.SH OPTIONS
+.TP
+.B \-h
+Display list of command-line options.
+.TP
+.B \-display <display>
+Use an alternate X Display.
+.TP
+.B \-geometry <geometry>
+Set window geometry.
+.TP
+.B \-lat <Latitude>
+Set latitude of observer.
+.TP
+.B \-lon <Longitude>
+Set longitude of observer.
+.TP
+.B \-td <UT - LT>
+Set the difference beteeen UT and LT. Useful when you want to show the
+Sunrise/Sunset at a remote lat/lon without resetting your clock.
+.TP
+.B \-12
+Use 12-hour clock.
+.TP
+.B \-date <yyyymmdd>
+Set the date to show sunrise/sunset for.
+.SH EXAMPLES
+.TP
+.B wmSun -lon 106.3 -lat 35.9
+this would display rise/set times at Los Alamos in local time.
+.TP
+.B wmSun -lat 19.58 -lon 155.92 -td 10
+this would display rise/set times in Kona, Hawaii in local time (in winter -- 
you need to
+take into account daylight savings at other times of the year).
+.SH BUGS
+Who knows? (Let me know if you find any).
+.SH AUTHOR
+Michael G. Henderson <[email protected]>
diff --git a/wmsun/wmsun.c b/wmsun/wmsun.c
new file mode 100644
index 0000000..16038e5
--- /dev/null
+++ b/wmsun/wmsun.c
@@ -0,0 +1,401 @@
+/*
+ *
+ *     wmSun-1.03 (C) 1999 Mike Henderson ([email protected])
+ *
+ *             - Shows Sun Rise/Set Times....
+ *
+ *
+ *
+ *
+ *
+ *     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 2, or (at your option)
+ *     any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program (see the file COPYING); if not, write to the
+ *     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ *      Boston, MA  02111-1307, USA
+ *
+ *      Things TODO:
+ *                  - clean up code!
+ *                  - support for 8-bit displays.
+ *                  - more detailed documentation.
+ *                  - eclipses?
+ *                  - add buttons to play will date and lat lon...
+ *                    Could be something like this;
+ *                       First click brings up buttons to change date.
+ *                       Second click brings up buttons to change lat/lon.
+ *                       Third goes back to display
+ *                       Set time delay to go back to display if user doesnt 
do it...
+ *
+ *
+ *
+ *
+ *
+ *      Changes:
+ *
+ *     Version 1.03 - released February 4, 1999.
+ *                     cosmetic for AfterStep users. removed spurious black 
line at RHS edge an mask.
+ *
+ *
+ *     Version 1.02 - released January 12, 1999.
+ *                    Added support for User-specified date and Time 
difference so that
+ *                    you can have the display be correct in local time even 
for remote
+ *                     lat/lons. (I am in Hawaii right now. I dont want to 
reset the time on
+ *                     my laptop, so with these new options I can still get 
the correct
+ *                     local times of rise/set. Sunset is awesome here in 
Kona!!! And the calcs
+ *                     seem to be quite good -- it's a good test here because 
the Sun sets over
+ *                     the Pacific (no mountains are in the way)).
+ *
+ *     Version 1.01 - released January 6, 1999.
+ *                     Fixed stupid bug in Date change montior.
+ *
+ *     Version 1.0 - released January 5, 1999.
+ *
+ *
+ */
+
+
+
+
+
+/*
+ *   Includes
+ */
+#define _POSIX_C_SOURCE 1
+#include <stdio.h>
+#include <math.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <X11/X.h>
+#include <X11/xpm.h>
+#include "wmgeneral/wmgeneral.h"
+#include "wmSun_master.xpm"
+#include "wmSun_mask.xbm"
+
+
+
+/*
+ *  Delay between refreshes (in microseconds)
+ */
+#define DELAY 10000L
+#define WMSUN_VERSION "1.03"
+
+#define DegPerRad       57.29577951308232087680
+#define RadPerDeg        0.01745329251994329576
+
+
+
+
+
+void ParseCMDLine(int argc, char *argv[]);
+void pressEvent(XButtonEvent *xev);
+void SunRise(int year, int month, int day, double LocalHour, double *UTRise,
+       double *UTSet);
+
+int    ToggleWindow = 0;
+int    nMAX = 1;
+int    Flag = 1;
+int    UseUserTimeDiff = 0;
+int    UseUserDate = 0;
+long   UserDate;
+double         Glat, Glon, SinGlat, CosGlat, TimeZone, UserTimeDiff;
+int    TwelveHour = 0;
+
+
+int    xDigit[11] = {8, 18, 27, 37, 46, 55, 64, 74, 83, 92, 102};
+
+
+
+
+/*
+ *   main
+ */
+int main(int argc, char *argv[]) {
+
+
+
+
+
+    struct tm          *GMTTime, *LocalTime;
+    XEvent             event;
+    int                        n;
+    int                Year, Month, OldLocalDayOfMonth;
+    int                        LocalDayOfMonth,        DayOfMonth;
+    long               CurrentLocalTime, CurrentGMTTime, date;
+    double             UT, val, LTRise, LTSet, LocalHour, hour24();
+    int                        H, M;
+
+
+
+
+
+
+    /*
+     *  Parse any command line arguments.
+     */
+    Glat = Glon = 0.0;
+    ParseCMDLine(argc, argv);
+    Glat *= RadPerDeg; SinGlat = sin( Glat ); CosGlat = cos( Glat );
+
+
+
+    openXwindow(argc, argv, wmSun_master, (char *)wmSun_mask_bits, 
wmSun_mask_width, wmSun_mask_height);
+
+
+
+
+
+    /*
+     *  Loop until we die
+     */
+    n = 32000;
+    OldLocalDayOfMonth = -999;
+    while(1) {
+
+
+       if (Flag) {
+           n = 32000;
+           Flag = 0;
+       }
+
+
+
+
+       /*
+        *  The Moon Ephemeris calculations are somewhat costly (the Moon is 
one of the most
+        *  difficult objects to compute position for). So only process every 
nMAXth cycle of this
+        *  loop. We run outer loop it faster to catch expose events, button 
presses, etc...
+        *
+        */
+       if (n>nMAX){
+           struct tm result;
+
+           n = 0;
+           nMAX = 1000;
+
+
+           CurrentGMTTime = time(CurrentTime);
+           GMTTime = gmtime_r(&CurrentGMTTime, &result);
+           DayOfMonth = GMTTime->tm_mday;
+
+           UT = GMTTime->tm_hour + GMTTime->tm_min/60.0 + 
GMTTime->tm_sec/3600.0;
+           Year = GMTTime->tm_year+1900;
+           Month = GMTTime->tm_mon+1;
+
+
+           CurrentLocalTime = CurrentGMTTime;
+           LocalTime = localtime_r(&CurrentLocalTime, &result);
+           LocalDayOfMonth = LocalTime->tm_mday;
+
+           if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){
+
+               Flag = 0;
+
+               if (UseUserDate){
+                   date =  UserDate;
+                   Year = date/10000;
+                   date -= Year*10000;
+                   Month = date/100;
+                   date -= Month*100;
+                   DayOfMonth = date;
+                   date = UserDate;
+               } else {
+                   date = Year*10000 + Month*100 + DayOfMonth;
+               }
+               LocalHour = LocalTime->tm_hour + LocalTime->tm_min/60.0 + 
LocalTime->tm_sec/3600.0;
+               TimeZone = (UseUserTimeDiff) ? UserTimeDiff : UT - LocalHour;
+
+               /*
+                *  Clear Plotting area
+                */
+               copyXPMArea(65, 5, 54, 54, 5, 5);
+
+
+
+               /*
+                *  Compute Sun Rise/Set Times in Local Time
+                */
+               SunRise(Year, Month, DayOfMonth, LocalHour, &LTRise, &LTSet);
+
+               if (LTRise > 0.0){
+                   val = LTRise;
+                   H = (int)val; val = (val-H)*60.0;
+                   if (TwelveHour) {
+                       H = H % 12;
+                       if (H == 0)
+                           H = 12;
+                   }
+                   M = (int)val;
+                   copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 13);
+                   copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 13);
+                   copyXPMArea(xDigit[10],   75, 3, 6, 17+15, 15);
+                   copyXPMArea(xDigit[M/10], 73, 7, 9, 17+19, 13);
+                   copyXPMArea(xDigit[M%10], 73, 7, 9, 17+26, 13);
+               } else {
+                   copyXPMArea(10, 84, 28, 7, 19, 15);
+               }
+
+
+               if (LTSet > 0.0){
+                   val = LTSet;
+                   H = (int)val; val = (val-H)*60.0;
+                   if (TwelveHour) {
+                       H = H % 12;
+                       if (H == 0)
+                           H = 12;
+                   }
+                   M = (int)val;
+                   copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 40);
+                   copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 40);
+                   copyXPMArea(xDigit[10],   75, 3, 6, 17+15, 42);
+                   copyXPMArea(xDigit[M/10], 73, 7, 9, 17+19, 40);
+                   copyXPMArea(xDigit[M%10], 73, 7, 9, 17+26, 40);
+               } else {
+                   copyXPMArea(10, 84, 28, 7, 19, 40);
+               }
+
+           }
+
+           OldLocalDayOfMonth = LocalDayOfMonth;
+
+
+       } else {
+
+           /*
+            *  Update the counter.
+            */
+           ++n;
+
+       }
+
+
+
+
+
+
+
+
+       /*
+        *   Process any pending X events.
+        */
+        while(XPending(display)){
+            XNextEvent(display, &event);
+            switch(event.type){
+                case Expose:
+                        RedrawWindow();
+                        break;
+                case ButtonPress:
+                        pressEvent(&event.xbutton);
+                        break;
+                case ButtonRelease:
+                        break;
+            }
+        }
+
+
+
+
+
+
+       /*
+        *  Redraw and wait for next update
+        */
+       RedrawWindow();
+       usleep(DELAY);
+
+
+     }
+
+
+
+}
+
+
+
+
+
+
+
+
+/*
+ *   ParseCMDLine()
+ */
+void ParseCMDLine(int argc, char *argv[]) {
+
+    int  i;
+
+    for (i = 1; i < argc; i++) {
+
+        if (!strcmp(argv[i], "-display")){
+
+           ++i;
+
+        } else if (!strcmp(argv[i], "-geometry")){
+
+           ++i;
+
+        } else if (!strcmp(argv[i], "-lat")){
+
+           Glat = atof(argv[++i]);
+
+        } else if (!strcmp(argv[i], "-lon")){
+
+           Glon = atof(argv[++i]);
+
+        } else if (!strcmp(argv[i], "-td")){
+
+           UseUserTimeDiff = 1;
+           UserTimeDiff = atof(argv[++i]);
+
+        } else if (!strcmp(argv[i], "-date")){
+
+           UseUserDate = 1;
+           UserDate = atoi(argv[++i]);
+
+       } else if (!strcmp(argv[i], "-12")){
+
+           TwelveHour = 1;
+
+       } else {
+           printf("\nwmSun version: %s\n", WMSUN_VERSION);
+           printf("\nusage: wmsun [-display <Display>] [-lat <Latitude>] [-lon 
<Longitude>] [-h]\n\n");
+           printf("\t-display <Display>\tUse alternate X display.\n");
+           printf("\t-geometry <Geometry>\tSet window geometry.\n");
+           printf("\t-lat <Latitude>\t\tObservers Latitude. Positive to the 
west.\n");
+           printf("\t-lon <Longitude>\tObservers Longitude.\n");
+           printf("\t-td <Delta Time>\tUser defined difference between UT an 
LT (hrs).\n");
+           printf("\t-12\t\t\tUse 12-hour clock.\n");
+           printf("\t-h\t\t\tDisplay help screen.\n\n");
+           exit(1);
+       }
+    }
+
+}
+
+
+/*
+ *  This routine handles button presses. Clicking in the window
+ *  toggles the display.
+ *
+ */
+void pressEvent(XButtonEvent *xev){
+
+   (void) xev;
+   ++ToggleWindow;
+   if (ToggleWindow > 4) ToggleWindow = 0;
+   Flag = 1;
+
+   return;
+
+}
+
-- 
2.1.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to