#!/usr/gnu/bin/perl5 -- -*- Perl -*-
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# news.cgi
#
# Displays news items.
#
# Author: Reid Rivenburgh (reid@lanl.gov)
#
# Created: 5/24/95
#
#------------------------------------------------------------------------------
# Set up the require path.
if ($0 =~ /\//)
{
$0 =~ /^(.*)\/[^\/]*$/;
$programPath = $1;
}
else
{
$programPath = ".";
}
push(@INC, $programPath."/lib");
require "news-lib.pl";
require "news-date.pl";
#------------------------------------------------------------------------------
# Pump STDERR into output stream so we know what happens
#------------------------------------------------------------------------------
open(STDERR,">&STDOUT") || die "Can't dup stdout: $!\n";
select(STDERR); $| = 1; # Make unbuffered.
select(STDOUT); $| = 1; # Make unbuffered.
#------------------------------------------------------------------------------
# Get the passed variable use routine from cgi-lib.pl
#------------------------------------------------------------------------------
&ReadParse;
#------------------------------------------------------------------------------
# Setup today
#------------------------------------------------------------------------------
($sec,$min,$hour,$thisday,$thismon,$thisyear,$wday,$yday,$isdst) = localtime(time);
$thismon++; # 0 based
$thisyear += 1900;
$today = $weekday[$wday].", ".$monthname[$thismon-1]." ".$thisday.", ".$thisyear;
$currentdate=sprintf("%4.4d-%2.2d-%2.2d",$cyear,$cmon,$cday);
#------------------------------------------------------------------------------
# Print the header.
#------------------------------------------------------------------------------
&printHeader("$organization News and Events");
print <
You can also view the $organization calendar.
EOF opendir(NEWSDIR, "$newsDir"); # Get all of the news files in the news directory, minus '.' and '..'. @newsFiles = grep(!/^(\.\.?)|(CVS)$/, readdir(NEWSDIR)); closedir(NEWSDIR); # Sort the files by reverse date. @newsFiles = sort(SortReverseDate @newsFiles); # Print the headlines. print "