diff options
author | kris <kris@FreeBSD.org> | 2003-06-27 12:36:51 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2003-06-27 12:36:51 +0800 |
commit | 524e66df6b1072c0cc138e7f63ea50ea8eaeb963 (patch) | |
tree | 467c96db0bcbd88d864b77fb927dc0233eddd35e /astro | |
parent | 7fce7158089a626f709fba616cc60be48bf882de (diff) | |
download | freebsd-ports-gnome-524e66df6b1072c0cc138e7f63ea50ea8eaeb963.tar.gz freebsd-ports-gnome-524e66df6b1072c0cc138e7f63ea50ea8eaeb963.tar.zst freebsd-ports-gnome-524e66df6b1072c0cc138e7f63ea50ea8eaeb963.zip |
Correct string buffer handling. Check for updates every 60 seconds as
documented in the code, not every 2 seconds. Bump PORTREVISION.
Obtained from: OpenBSD
Diffstat (limited to 'astro')
-rw-r--r-- | astro/wmspaceweather/Makefile | 1 | ||||
-rw-r--r-- | astro/wmspaceweather/files/patch-wmSpaceWeather.c | 85 |
2 files changed, 80 insertions, 6 deletions
diff --git a/astro/wmspaceweather/Makefile b/astro/wmspaceweather/Makefile index 569f2b4777cd..8111bce44ab9 100644 --- a/astro/wmspaceweather/Makefile +++ b/astro/wmspaceweather/Makefile @@ -6,6 +6,7 @@ PORTNAME= wmspaceweather PORTVERSION= 1.04 +PORTREVISION= 1 CATEGORIES= astro windowmaker MASTER_SITES= http://nis-www.lanl.gov/~mgh/WindowMaker/ DISTNAME= wmSpaceWeather-${PORTVERSION} diff --git a/astro/wmspaceweather/files/patch-wmSpaceWeather.c b/astro/wmspaceweather/files/patch-wmSpaceWeather.c index 10dbda051067..1b50fcf892d8 100644 --- a/astro/wmspaceweather/files/patch-wmSpaceWeather.c +++ b/astro/wmspaceweather/files/patch-wmSpaceWeather.c @@ -1,9 +1,6 @@ - -$FreeBSD$ - ---- wmSpaceWeather.c.orig Sat Aug 17 13:26:47 2002 -+++ wmSpaceWeather.c Sat Aug 17 13:27:10 2002 -@@ -115,7 +115,7 @@ +--- wmSpaceWeather.c.orig Thu Feb 18 17:57:45 1999 ++++ wmSpaceWeather.c Wed Jun 18 03:08:57 2003 +@@ -115,7 +115,7 @@ XEvent event; int i, n, s, k, m, dt1, dt2; int Year, Month, Day, DayOfMonth, OldDayOfMonth; int Hours, Mins, Secs, OldSecs, xoff, D[10], xsize; @@ -12,3 +9,79 @@ $FreeBSD$ int height, UpToDate, LEDOn; double UT, TU, TU2, TU3, T0, gmst, hour24(); +@@ -126,6 +126,7 @@ int Kp[8] = { -1, -1, -1, -1, -1, -1, + double E1, E2, P1, P2, P3; + char Xray[10], digit[2]; + FILE *fp; ++char FileName[1024]; + + + +@@ -249,13 +250,13 @@ FILE *fp; + + + /* +- * Check the Kp file every (approx.) 2 seconds. ++ * Check the Kp file every (approx.) 60 seconds. + * Can significantly reduce this frequency later. But its + * easier to debug this way... + * Do this before trying to download again! The file may be there and it + * may be Up-To-Date! + */ +- if (dt2 > 2){ ++ if (dt2 > 60){ + + dt2 = 0; + +@@ -272,13 +273,13 @@ FILE *fp; + Secs = Time->tm_sec; + UT = (double)Hours + (double)Mins/60.0 + (double)Secs/3600.0; + CurrentJD = jd(Year, Month, Day, UT); +- + + + /* + * Read in Kp values + */ +- if ((fp = fopen("/tmp/LatestKp.txt", "r")) != NULL){ ++ snprintf(FileName, sizeof(FileName), "%s/.wmSpaceWeatherReports/LatestKp.txt", getenv("HOME")); ++ if ((fp = fopen(FileName, "r")) != NULL){ + + for (i=0; i<8; ++i){ + fscanf(fp, "%ld %d", &TimeTag[i], &Kp[i]); +@@ -289,7 +290,7 @@ FILE *fp; + fscanf(fp, "%lf", &P3); + fscanf(fp, "%lf", &E1); + fscanf(fp, "%lf", &E2); +- fscanf(fp, "%10s", Xray); ++ fscanf(fp, "%9s", Xray); + fclose(fp); + + } else { +@@ -318,7 +319,7 @@ FILE *fp; + LatestAvailJD = jd(Year, Month, Day, UT); + + DeltaT = (CurrentJD - LatestAvailJD)*24.0; +- UpToDate = (DeltaT <= 3.0) ? 1 : 0; ++ UpToDate = (DeltaT <= 4.0) ? 1 : 0; + + if (!UpToDate){ + +@@ -560,7 +561,7 @@ void ParseCMDLine(int argc, char *argv[] + + } else if ((!strcmp(argv[i], "-url"))||(!strcmp(argv[i], "-u"))){ + +- strcpy(URL, argv[++i]); ++ strlcpy(URL, argv[++i], sizeof(URL)); + + } else { + +@@ -651,7 +652,7 @@ void pressEvent(XButtonEvent *xev){ + if (GotDoubleClick1) { + GotFirstClick1 = 0; + GotDoubleClick1 = 0; +- sprintf(Command, "netscape -remote 'openURL(%s)' || netscape '%s' &", URL, URL); ++ snprintf(Command, sizeof(Command), "netscape -remote 'openURL(%s)' || netscape '%s' &", URL, URL); + system(Command); + } + |