wmsun (1.03+1-2) 01_all_previous_diff.diff

Summary

 wmSun/Makefile  |   10 +++++-----
 wmSun/SunRise.c |   13 +++++++------
 wmSun/wmSun.c   |   31 ++++++++++++++++++++-----------
 3 files changed, 32 insertions(+), 22 deletions(-)

    
download this patch

Patch contents

Description: This is all previous diff
=========================================================================
diff -ur wmSun-1.03_orig/wmSun/Makefile wmsun-1.03_debian/wmSun/Makefile
--- wmSun-1.03_orig/wmSun/Makefile	1999-01-06 03:28:39.000000000 +0100
+++ wmsun-1.03_debian/wmSun/Makefile	2009-11-02 11:27:31.000000000 +0100
@@ -1,5 +1,5 @@
 CC     = gcc
-CFLAGS = -O2 -Wall
+# CFLAGS = -O2 -Wall
 INCDIR = -I/usr/X11R6/include/X11
 DESTDIR= /usr/X11R6
 LIBDIR = -L/usr/X11R6/lib
@@ -22,14 +22,14 @@
 
 
 .c.o:
-	$(CC) $(COPTS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR)
+	$(CC) $(CFLAGS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR)
 
 
 all:	wmSun.o wmSun
 
 wmSun.o: wmSun_master.xpm wmSun_mask.xbm 
 wmSun:	$(OBJS) 
-	$(CC) $(COPTS) $(SYSTEM) -lm -o wmSun $^ $(INCDIR) $(LIBDIR) $(LIBS)
+	$(CC) $(CFLAGS) $(SYSTEM) -lm -o wmSun $^ $(INCDIR) $(LIBDIR) $(LIBS)
 
 clean:
 	for i in $(OBJS) ; do \
@@ -38,6 +38,6 @@
 	rm -f wmSun
 
 install:: wmSun
-	install -s -m 0755 wmSun $(DESTDIR)/bin
-	install    -m 0644 wmSun.1 $(DESTDIR)/man/man1 
+	install -D -m 0755 wmSun   $(DESTDIR)/usr/bin/wmSun
+	install -D -m 0644 wmSun.1 $(DESTDIR)/usr/share/man/man1/wmSun.1
 
diff -ur wmSun-1.03_orig/wmSun/SunRise.c wmsun-1.03_debian/wmSun/SunRise.c
--- wmSun-1.03_orig/wmSun/SunRise.c	1999-01-05 23:39:06.000000000 +0100
+++ wmsun-1.03_debian/wmSun/SunRise.c	2009-11-02 11:27:31.000000000 +0100
@@ -10,8 +10,9 @@
 double    sinEPS = 0.39778;
 double    P2  = 6.283185307;
 
+int Interp(double, double, double, double*, double*, double*, double*, int*);
 
-SunRise(int year, int month, int day, double LocalHour, double *UTRise, double *UTSet){
+void SunRise(int year, int month, int day, double LocalHour, double *UTRise, double *UTSet){
 
     double	UT, ym, y0, yp, SinH0;
     double	xe, ye, z1, z2, SinH(), hour24();
@@ -80,7 +81,7 @@
 }
 
 
-UTTohhmm(double UT, int *h, int *m){
+void UTTohhmm(double UT, int *h, int *m){
 
 
     if (UT < 0.0) {
@@ -98,7 +99,7 @@
 
 
 
-Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1, double *z2, int *nz){
+int Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1, double *z2, int *nz){
 
     double	a, b, c, d, dx;
 
@@ -129,8 +130,8 @@
 
 double SinH(int year, int month, int day, double UT){
 
-    double	TU0, TU, TU2, TU3, LambdaMoon, BetaMoon, R, AGE, frac(), jd();
-    double	RA_Sun, DEC_Sun, T0, gmst, lmst, Tau, epsilon;
+    double	TU0, TU, TU2, TU3, frac(), jd();
+    double	RA_Sun, DEC_Sun, gmst, lmst, Tau;
     double	M, DL, L, SL, X, Y, Z, RHO;
     
 
@@ -176,7 +177,7 @@
 int ny, nm, nd;
 double UT;
 {
-        double A, B, C, D, JD, MJD, day;
+        double A, B, C, D, JD, day;
 
         day = nd + UT/24.0;
 
diff -ur wmSun-1.03_orig/wmSun/wmSun.c wmsun-1.03_debian/wmSun/wmSun.c
--- wmSun-1.03_orig/wmSun/wmSun.c	1999-02-04 18:43:09.000000000 +0100
+++ wmsun-1.03_debian/wmSun/wmSun.c	2009-11-02 11:27:31.000000000 +0100
@@ -86,7 +86,7 @@
 /* 
  *  Delay between refreshes (in microseconds) 
  */
-#define DELAY 10000L
+#define DELAY 1000000L
 #define WMSUN_VERSION "1.03"
 
 #define DegPerRad       57.29577951308232087680
@@ -95,6 +95,7 @@
 
 
 
+void SunRise(int, int, int, double, double*, double*);
 
 void ParseCMDLine(int argc, char *argv[]);
 void pressEvent(XButtonEvent *xev);
@@ -125,14 +126,14 @@
 
     struct tm		*GMTTime, *LocalTime;
     XEvent		event;
-    int			i, n, k, j, ImageNumber;
-    int 		Year, Month, DayOfWeek, OldLocalDayOfMonth;
+    int			n;
+    int 		Year, Month, OldLocalDayOfMonth;
     int			LocalDayOfMonth,	DayOfMonth;
-    int			Hours, Mins, Secs, OldSecs, digit, xoff, xsize;
     long		CurrentLocalTime, CurrentGMTTime, date;
-    double		UT, val, RA, DEC, LTRise, LTSet, LocalHour, hour24();
-    int			D, H, M, S, sgn, A, B, q;
-    char		str[10];
+    double		UT, val, LTRise, LTSet, LocalHour, hour24();
+    int			H, M;
+    struct timeval	timeout;
+    fd_set		xfdset;
 
 
 
@@ -179,7 +180,7 @@
 	if (n>nMAX){
 
 	    n = 0;
-	    nMAX = 1000;
+	    nMAX = 60;
 
 
             CurrentGMTTime = time(CurrentTime); GMTTime = gmtime(&CurrentGMTTime); 
@@ -193,7 +194,8 @@
 	    CurrentLocalTime = CurrentGMTTime; LocalTime = localtime(&CurrentLocalTime);
 	    LocalDayOfMonth = LocalTime->tm_mday;
 
-	    if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){
+// Redraw always to catch e.g. DST changes (M. Stigge, 2008-04-10)
+//	    if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){
 
 		Flag = 0;
 
@@ -250,7 +252,7 @@
 	    	    copyXPMArea(10, 84, 28, 7, 19, 40);
 		}
 
-	    }
+//	    }
 
 	    OldLocalDayOfMonth = LocalDayOfMonth;
 
@@ -267,6 +269,11 @@
 
 
 
+	/*
+	 *  Add X display to file descriptor set for polling.
+	 */
+	FD_ZERO(&xfdset);
+	FD_SET(ConnectionNumber(display), &xfdset);
 
 
 
@@ -297,7 +304,9 @@
 	 *  Redraw and wait for next update 
 	 */
 	RedrawWindow();
-	usleep(DELAY);
+	timeout.tv_sec = DELAY / 1000000L;
+	timeout.tv_usec = DELAY % 1000000L;
+	select(ConnectionNumber(display) + 1, &xfdset, NULL, NULL, &timeout);
 
 
      }