#!/usr/local/bin/perl
use POSIX;
print "Content-type: text/html\n\n";
print "
";
print " ASOS Station Observations and Zone Forecast ";
print "";
print '';
# print "";
print "\n";
print ' ';
print "To display the latest Metar observations and the zone forecast,
";
print "enter the station identifier (ICAO abbrevbiation) below
";
print "
";
$ENV{'PATH'} = '/usr/local/weather/bin/solaris/weather';
print '';
read (STDIN, $user_input, $ENV{'CONTENT_LENGTH'});
$sID = substr($user_input,5,4);
print "
\n";
print "";
@mdecode = `/usr/local/weather/bin/solaris/weather -c metardecode $sID l `;
@zone = `/usr/local/weather/bin/solaris/weather -c zones $sID l `;
$num_obs = @mdecode;
$zone_length = @zone;
$stat = substr($mdecode[3],0,4);
$time = substr($mdecode[3],5,4);
$tempc = substr($mdecode[3],27,3);
$tempdpc = substr($mdecode[3],31,3);
$len = length($sID);
if ($len == 0)
{
print "\n\n";
exit;
}
if ($len != 0 && $time == 0 && $tempc == 0 && tempdpc == 0)
{
print "\n";
print "Station identifier $sID is not a valid station";
print "
\n";
print "\n\n