mirror of
https://git.FreeBSD.org/ports.git
synced 2024-10-18 19:49:40 +00:00
Correct string buffer handling. Check for updates every 60 seconds as
documented in the code, not every 2 seconds. Bump PORTREVISION. Obtained from: OpenBSD
This commit is contained in:
parent
83a3a4bb08
commit
1c544281f2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=83717
@ -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}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user