1 --- wmSpaceWeather.c.orig Thu Feb 18 17:57:45 1999
2 +++ wmSpaceWeather.c Tue Apr 13 20:06:41 2004
3 @@ -115,7 +115,7 @@ XEvent event;
4 int i, n, s, k, m, dt1, dt2;
5 int Year, Month, Day, DayOfMonth, OldDayOfMonth;
6 int Hours, Mins, Secs, OldSecs, xoff, D[10], xsize;
7 -long CurrentLocalTime;
8 +time_t CurrentLocalTime;
9 int height, UpToDate, LEDOn;
10 double UT, TU, TU2, TU3, T0, gmst, hour24();
12 @@ -126,6 +126,7 @@ int Kp[8] = { -1, -1, -1, -1, -1, -1,
13 double E1, E2, P1, P2, P3;
14 char Xray[10], digit[2];
20 @@ -249,13 +250,13 @@ FILE *fp;
24 - * Check the Kp file every (approx.) 2 seconds.
25 + * Check the Kp file every (approx.) 60 seconds.
26 * Can significantly reduce this frequency later. But its
27 * easier to debug this way...
28 * Do this before trying to download again! The file may be there and it
36 @@ -272,13 +273,13 @@ FILE *fp;
38 UT = (double)Hours + (double)Mins/60.0 + (double)Secs/3600.0;
39 CurrentJD = jd(Year, Month, Day, UT);
46 - if ((fp = fopen("/tmp/LatestKp.txt", "r")) != NULL){
47 + snprintf(FileName, sizeof(FileName), "/tmp/LatestKp.txt", getenv("HOME"));
48 + if ((fp = fopen(FileName, "r")) != NULL){
51 fscanf(fp, "%ld %d", &TimeTag[i], &Kp[i]);
52 @@ -289,7 +290,7 @@ FILE *fp;
53 fscanf(fp, "%lf", &P3);
54 fscanf(fp, "%lf", &E1);
55 fscanf(fp, "%lf", &E2);
56 - fscanf(fp, "%10s", Xray);
57 + fscanf(fp, "%9s", Xray);
61 @@ -318,7 +319,7 @@ FILE *fp;
62 LatestAvailJD = jd(Year, Month, Day, UT);
64 DeltaT = (CurrentJD - LatestAvailJD)*24.0;
65 - UpToDate = (DeltaT <= 3.0) ? 1 : 0;
66 + UpToDate = (DeltaT <= 4.0) ? 1 : 0;
70 @@ -560,7 +561,7 @@ void ParseCMDLine(int argc, char *argv[]
72 } else if ((!strcmp(argv[i], "-url"))||(!strcmp(argv[i], "-u"))){
74 - strcpy(URL, argv[++i]);
75 + strlcpy(URL, argv[++i], sizeof(URL));
79 @@ -651,7 +652,7 @@ void pressEvent(XButtonEvent *xev){
80 if (GotDoubleClick1) {
83 - sprintf(Command, "netscape -remote 'openURL(%s)' || netscape '%s' &", URL, URL);
84 + snprintf(Command, sizeof(Command), "netscape -remote 'openURL(%s)' || netscape '%s' &", URL, URL);