#!/usr/local/bin/gawk -f # Copyright © 1998-1999 Saugus.net, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Here we're basically just initializing our variables and writing out # the constant beginning portion of our HTML source. BEGIN \ { # Get relevant month names getline LastMonth < "/export/apache/htdocs/lib/text/lastmonth.txt"; close("lastmonth.txt"); getline ThisMonth < "/export/apache/htdocs/lib/text/thismonth.txt"; close("thismonth.txt"); # Get the current day of the month Today=int(strftime("%d")); # We're using multi-line input records RS=""; FS="\n"; # Set the start-of-file toggle Toggle=int("0"); }; # The following pattern will match a group of lines beginning # with the string "
" at the beginning of a line and ending # with a blank line. For our expected input, this should match # every entry. # /^
/ \ { DateStart=index($1,", ")+2; DateEnd=index($1,""); if(DateEnd==0)DateEnd=length($1); Date=substr($1,DateStart,DateEnd-DateStart); Space=index(Date," "); if(Space==0)Space=length(Date); Month=substr(Date,0,Space-1); Day=int(substr(Date,Space+1)); if(!((Month==LastMonth)||((Month==ThisMonth)&&(Day