Import wmSpaceWeather 1.04.
Submitted by Peter Stromberg <home@wilfried.net>. wmSpaceWeather is a space weather monitor. The monitor shows two relativistic electron and three relativistic proton flux levels at geosyncronous orbit (currently from the NOAA GOES spacecraft), current Solar Flare X-ray flux, and the last eight three-hour Kp index values.
This commit is contained in:
parent
3c029b90d8
commit
fc2e28ed01
24
astro/wmspaceweather/Makefile
Normal file
24
astro/wmspaceweather/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2001/01/10 16:54:48 naddy Exp $
|
||||
|
||||
DISTNAME= wmSpaceWeather-1.04
|
||||
PKGNAME= ${DISTNAME:L}
|
||||
CATEGORIES= astro x11
|
||||
NEED_VERSION= 1.348
|
||||
MASTER_SITES= http://nis-www.lanl.gov/~mgh/WindowMaker/
|
||||
HOMEPAGE= http://nis-www.lanl.gov/~mgh/WindowMaker/DockApps.shtml
|
||||
|
||||
MAINTAINER= Peter Stromberg <home@wilfried.net>
|
||||
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
RUN_DEPENDS= wget::net/wget
|
||||
|
||||
WRKSRC= ${WRKDIST}/wmSpaceWeather
|
||||
|
||||
post-extract:
|
||||
@cd ${WRKSRC}; make clean
|
||||
|
||||
.include <bsd.port.mk>
|
3
astro/wmspaceweather/files/md5
Normal file
3
astro/wmspaceweather/files/md5
Normal file
@ -0,0 +1,3 @@
|
||||
MD5 (wmSpaceWeather-1.04.tar.gz) = b91415bc9e234d3e6fcd93d34c7fd680
|
||||
RMD160 (wmSpaceWeather-1.04.tar.gz) = 7cde741e2ca9990ecc1dac63e3b5ca6d2c41bd5d
|
||||
SHA1 (wmSpaceWeather-1.04.tar.gz) = eb64b72aeb9f94a87d19e444de7d2a56c5414a65
|
76
astro/wmspaceweather/patches/patch-GetKp
Normal file
76
astro/wmspaceweather/patches/patch-GetKp
Normal file
@ -0,0 +1,76 @@
|
||||
$OpenBSD: patch-GetKp,v 1.1.1.1 2001/01/10 16:54:49 naddy Exp $
|
||||
--- wmSpaceWeather/GetKp.orig Fri Feb 12 06:42:01 1999
|
||||
+++ wmSpaceWeather/GetKp Wed Jan 10 14:37:37 2001
|
||||
@@ -7,19 +7,31 @@
|
||||
|
||||
require "ctime.pl";
|
||||
|
||||
+ #
|
||||
+ # Change to users home directory. We used to dump into /tmp
|
||||
+ # but using home dir instead avoids multiple users interfering
|
||||
+ # with one another. (Yeah, we could "unique-ize" the filenames, but
|
||||
+ # this is easier for now...)
|
||||
+ #
|
||||
+ $home = (getpwuid($<))[7];
|
||||
+ $ok = chdir() || chdir($home);
|
||||
|
||||
- ($Year, $Month, $Day) = &year_month_day();
|
||||
-
|
||||
- if (-e "/tmp/DGD.txt"){
|
||||
- unlink("/tmp/DGD.txt");
|
||||
+ #
|
||||
+ # Check to see if .wmSpaceWeatherReports exists.
|
||||
+ # If not, make it and move to it.
|
||||
+ #
|
||||
+ if ( !(-e ".wmSpaceWeatherReports") ){
|
||||
+ mkdir(".wmSpaceWeatherReports", 0775);
|
||||
}
|
||||
+ chdir(".wmSpaceWeatherReports");
|
||||
+ unlink("DGD.txt");
|
||||
+ unlink("curind.txt");
|
||||
|
||||
- if (-e "/tmp/curind.txt"){
|
||||
- unlink("/tmp/curind.txt");
|
||||
- }
|
||||
+
|
||||
+ ($Year, $Month, $Day) = &year_month_day();
|
||||
|
||||
|
||||
- $grabcmd = "cd /tmp; wget --passive-ftp --tries 2 -q ftp://www.sec.noaa.gov/pub/indices/DGD.txt";
|
||||
+ $grabcmd = "wget --passive-ftp --tries 2 -q ftp://www.sec.noaa.gov/pub/indices/DGD.txt";
|
||||
system "$grabcmd";
|
||||
|
||||
|
||||
@@ -37,7 +49,7 @@
|
||||
$Kp{190001018} = 999;
|
||||
|
||||
|
||||
- open(TmpFile, "/tmp/DGD.txt");
|
||||
+ open(TmpFile, "DGD.txt");
|
||||
while (<TmpFile>){
|
||||
chop;
|
||||
if ($_ =~ /^\d{4} \d{2} \d{2}\s*\d*/ ){
|
||||
@@ -68,12 +80,12 @@
|
||||
#
|
||||
# Add in very latest stuff
|
||||
#
|
||||
- $grabcmd = "cd /tmp; wget --passive-ftp --tries 2 -q ftp://www.sec.noaa.gov/pub/latest/curind.txt";
|
||||
+ $grabcmd = "wget --passive-ftp --tries 2 -q ftp://www.sec.noaa.gov/pub/latest/curind.txt";
|
||||
system "$grabcmd";
|
||||
%lmonstr = ( "Jan", 1, "Feb", 2, "Mar", 3, "Apr", 4, "May", 5, "Jun", 6, "Jul", 7, "Aug", 8, "Sep", 9, "Oct", 10, "Nov", 11, "Dec", 12);
|
||||
|
||||
@lval = ($lyear, $lmonstr{$lmon}, $ldom);
|
||||
- open(TmpFile, "/tmp/curind.txt");
|
||||
+ open(TmpFile, "curind.txt");
|
||||
while (<TmpFile>){
|
||||
chop;
|
||||
if ($_ =~ /^:Geomagnetic_Values: (\d{4}) (.*) (\d{1,2})/){
|
||||
@@ -133,7 +145,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- open(TmpFile, ">/tmp/LatestKp.txt");
|
||||
+ open(TmpFile, ">LatestKp.txt");
|
||||
foreach $key (sort keys %Result ) {
|
||||
if ($Result{$key} > 10) { $Result{$key} = -1; }
|
||||
printf TmpFile "$key $Result{$key}\n";
|
42
astro/wmspaceweather/patches/patch-Makefile
Normal file
42
astro/wmspaceweather/patches/patch-Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
$OpenBSD: patch-Makefile,v 1.1.1.1 2001/01/10 16:54:49 naddy Exp $
|
||||
--- wmSpaceWeather/Makefile.orig Mon Jan 4 22:20:45 1999
|
||||
+++ wmSpaceWeather/Makefile Wed Jan 10 14:10:06 2001
|
||||
@@ -1,8 +1,5 @@
|
||||
-CC = gcc
|
||||
-CFLAGS = -O2 -Wall
|
||||
-INCDIR = -I/usr/X11R6/include/X11
|
||||
-DESTDIR= /usr/X11R6
|
||||
-LIBDIR = -L/usr/X11R6/lib
|
||||
+CFLAGS += -I${X11BASE}/include
|
||||
+LIBDIR = -L${X11BASE}/lib
|
||||
# for linux
|
||||
LIBS = -lXpm -lX11 -lXext
|
||||
# for Solaris
|
||||
@@ -12,14 +9,14 @@ OBJS = wmSpaceWeather.o \
|
||||
|
||||
|
||||
.c.o:
|
||||
- $(CC) $(COPTS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR)
|
||||
+ $(CC) $(CFLAGS) -c $< -o $*.o $(INCDIR)
|
||||
|
||||
|
||||
all: wmSpaceWeather.o wmSpaceWeather
|
||||
|
||||
wmSpaceWeather.o: wmSpaceWeather_master.xpm wmSpaceWeather_mask.xbm
|
||||
wmSpaceWeather: $(OBJS)
|
||||
- $(CC) $(COPTS) $(SYSTEM) -o wmSpaceWeather $^ $(INCDIR) $(LIBDIR) $(LIBS)
|
||||
+ $(CC) $(COPTS) $(SYSTEM) -o wmSpaceWeather $(OBJS) $(INCDIR) $(LIBDIR) $(LIBS)
|
||||
|
||||
clean:
|
||||
for i in $(OBJS) ; do \
|
||||
@@ -28,7 +25,6 @@ clean:
|
||||
rm -f wmSpaceWeather
|
||||
|
||||
install:: wmSpaceWeather
|
||||
- install -s -m 0755 wmSpaceWeather $(DESTDIR)/bin
|
||||
- install -m 0755 GetKp $(DESTDIR)/bin
|
||||
- install -m 0644 wmSpaceWeather.1 $(DESTDIR)/man/man1
|
||||
-
|
||||
+ $(BSD_INSTALL_PROGRAM) wmSpaceWeather $(PREFIX)/bin
|
||||
+ $(BSD_INSTALL_SCRIPT) GetKp $(PREFIX)/bin
|
||||
+ $(BSD_INSTALL_MAN) wmSpaceWeather.1 $(PREFIX)/man/man1
|
79
astro/wmspaceweather/patches/patch-wmSpaceWeather_c
Normal file
79
astro/wmspaceweather/patches/patch-wmSpaceWeather_c
Normal file
@ -0,0 +1,79 @@
|
||||
$OpenBSD: patch-wmSpaceWeather_c,v 1.1.1.1 2001/01/10 16:54:49 naddy Exp $
|
||||
--- wmSpaceWeather/wmSpaceWeather.c.orig Thu Feb 18 18:57:45 1999
|
||||
+++ wmSpaceWeather/wmSpaceWeather.c Wed Jan 10 14:48:34 2001
|
||||
@@ -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;
|
||||
-long CurrentLocalTime;
|
||||
+time_t CurrentLocalTime;
|
||||
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]);
|
||||
@@ -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);
|
||||
}
|
||||
|
1
astro/wmspaceweather/pkg/COMMENT
Normal file
1
astro/wmspaceweather/pkg/COMMENT
Normal file
@ -0,0 +1 @@
|
||||
dockable space weather monitor
|
7
astro/wmspaceweather/pkg/DESCR
Normal file
7
astro/wmspaceweather/pkg/DESCR
Normal file
@ -0,0 +1,7 @@
|
||||
wmSpaceWeather is a space weather monitor. The monitor shows two
|
||||
relativistic electron and three relativistic proton flux levels
|
||||
at geosyncronous orbit (currently from the NOAA GOES spacecraft),
|
||||
current Solar Flare X-ray flux, and the last eight three-hour Kp
|
||||
index values.
|
||||
|
||||
WWW: ${HOMEPAGE}
|
4
astro/wmspaceweather/pkg/PLIST
Normal file
4
astro/wmspaceweather/pkg/PLIST
Normal file
@ -0,0 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/01/10 16:54:50 naddy Exp $
|
||||
bin/GetKp
|
||||
bin/wmSpaceWeather
|
||||
man/man1/wmSpaceWeather.1
|
Loading…
Reference in New Issue
Block a user