[Pkg-wmaker-commits] [wmfrog] 116/145: Check that $tmpfolder/$station exists.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sun Aug 23 05:46:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmfrog.
commit aed7d6dbd20be882cb951e630b17d284a6e5acb7
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Sun Aug 24 03:11:22 2014 -0500
Check that $tmpfolder/$station exists.
Otherwise, grep returns a "No such file or directory" error if it doesn't.
Adapted from Debian:
http://sources.debian.net/src/wmfrog/0.3.1%2Bds-2/debian/patches/20-weather.pl.patch/
---
wmfrog/Src/weather.pl | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/wmfrog/Src/weather.pl b/wmfrog/Src/weather.pl
index 4cd2d1b..712919b 100755
--- a/wmfrog/Src/weather.pl
+++ b/wmfrog/Src/weather.pl
@@ -367,32 +367,35 @@ debug("Dew:$dew");
# Check for ok temperature
-open GREP, "grep Temp $tmpfolder/${station} | ";
-$templine = <GREP>;
+if ( -f "$tmpfolder/$station" )
+{
+ open GREP, "grep Temp $tmpfolder/${station} | ";
+ $templine = <GREP>;
-$templine = ~m/^Temp:(.*)$/;
+ $templine = ~m/^Temp:(.*)$/;
-{
- if ( $temp > -50 and $temp < 150 )
{
- if ( $lasttemp > -50 and $lasttemp < 150 )
+ if ( $temp > -50 and $temp < 150 )
{
- if ( $temp > -2 and $temp < 2 )
+ if ( $lasttemp > -50 and $lasttemp < 150 )
{
- if ( $lasttemp > 7 or $lasttemp < -7 )
+ if ( $temp > -2 and $temp < 2 )
{
- $station = ""; # probably invalid
+ if ( $lasttemp > 7 or $lasttemp < -7 )
+ {
+ $station = ""; # probably invalid
+ }
}
}
}
+ else
+ {
+ $station = "";
+ }
}
- else
- {
- $station = "";
- }
-}
-close GREP;
+ close GREP;
+}
debug("Station: $station");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmfrog.git
More information about the Pkg-wmaker-commits
mailing list