#! /usr/bin/perl # # This script is used to create a web version of the file # gno/NOTES/status.bin. # # Usage: mkstatus infile outfile.html # # $Id: mkstatus,v 1.3 2012/08/25 07:22:00 gdr Exp $ # # check usage and open files if (scalar(@ARGV) != 2) { printf(stderr "usage: mkstatus infile outfile"); exit(1); } $infile = shift; $outfile = shift; open(infp, "< $infile") || &Fatal("couldn't open $infile for input: $?"); open(outfp, "> $outfile") || &Fatal("couldn't open $outfile for output: $?"); # Initialize the months strings. push(@month, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ); # print out the html header printf(outfp "\n" . "\n" . "GNO Status: Programs\n" . "\n" . "\n" . '' . "\n" . "
\n"); # look for the rcs ident string. while() { if (/\$Id([^\$]*)\$/) { $_ = $1; if (/^:\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+/) { $file=$1; $version=$2; $rawdate=$3; $time=$4; if ($rawdate =~ m,(\d+)/(\d+)/(\d+),) { $year = $1; $m = $2; $day = $3; $mon = @month[int($2) - 1]; $date = "$day $mon $year"; } } else { $date = "(unspecified date)"; } last; } } # initial information printf(outfp "

GNO Program Status List

\n". "Last Updated: %s

\n" . "This page shows the current status of various program components.

". "Unfortunately, this page does not show it's tables very well\n". "when viewing with lynx, so you're better off using a graphical\n". "browser. My apologies to those who do not have this option.

\n", $date); printf(outfp "

Field Descriptions

\n". "Each program listed below has associated with it a number of\n". "columns. The meaning of each column is listed below. Empty\n". "entries indicate incomplete programs or unavailable information.\n". "Hyphens (-) indicate that the field is not relevent.

\n". "

\n"); printf(outfp "If you would like to work on a given utility, make sure you pick\n". "one that has not already been claimed. Before starting, you should\n". "then contact ".'Devin Reade '. "to ensure your name gets on the list. This should eliminate\n". "duplicated work

\n"); # search for the start of the participants list $found = 0; while () { if (/^\s*%%%NAMES-START%%%\s*$/) { $found = 1; last; } } ($found) || &Fatal("start of names table not found"); while() { (/^\s*%%%NAMES-END%%%\s*$/) && last; s/\(.*//; # dump comments if (/\s*(\S+)\s*([^<]+)\s*<([^>]+)/) { $names{$1} = $2; $email{$1} = $3; } } # start the table printf(outfp '' ."\n" . "\n" . "
Program Name\n" . "204\n" . "Req\n" . "Owner\n" . "Src\n" . "Man\n" . "Cmpl\n" . "Test\n" . "Arc\n" . "Install\n" . "Comments\n"); # debug # printf(outfp "
\n");

# search for the start of the status table
$found = 0;
while () {
    if (/^\s*%%%STATUS-TABLE-START%%%\s*$/) {
	$found = 1;
	last;
    }
}
($found) || &Fatal("start of status table not found");


# extract the status info
while () {
    (/^\s*%%%STATUS-TABLE-END%%%\s*$/) && last;  # end of table
    if (/\#\s*(.*)/) {
	$comment = $1;
	$_ = $`;
    } else {
	$comment = '';
    }
    ($prog, $in204, $req, $owner, $source, $man, $compile, $test, 
     $archive, $install, $pkgNote) = split;

    # leave out the package.  Merge notes in with name.
    if ($pkgNote =~ /\[([^\]]+)\]/) {
	$note = $1;
    } else {
	$note = '';
    }
    if ($pkgNote =~ /\(([^\)]+)\)/) {
	$prog .= " ($1)";
    }

    $prog = &htmlconv($prog);
    $in204 = &htmlconv($in204);
    $req = &htmlconv($req);
    $owner = &htmlconv($owner);
    $source = &htmlconv($source);
    $man = &htmlconv($man);
    $compile = &htmlconv($compile);
    $test = &htmlconv($test);
    $archive = &htmlconv($archive);
    $install = &htmlconv($install);
#    $pkgNote = &htmlconv($pkgNote);
    $comment = &htmlconv($comment);

    if ($note ne '') {
	$prog .= ' [Note '.$note.']';
    }

    printf(outfp
	   "
%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s" . "%s\n", $prog, $in204, $req, $owner, $source, $man, $compile, $test, $archive, $install, $comment); } # end the table printf(outfp "

\n"); # search for any notes $printed = 0; while() { if (/%%%NOTE-START-([^%]+)%%%/) { if ($printed == 0) { $printed = 1; printf(outfp "

Notes

\n"); } printf(outfp '
Note '.$1.":\n
"); while() { (/%%%NOTE-END-([^%]+)%%%/) && last; print outfp &htmlconv($_) } printf(outfp "\n"); } } # print out the list of participants printf(outfp "

Contributers

\n". "The following table shows the names for the "Owner"\n". "column of the status table, above:\n" . '' ."\n". ""); } else { printf(outfp "
IDName IDName IDName\n"); @keylist = keys(%names); @keylist = sort(@keylist); $column = 0; $columns = 3; foreach $k (@keylist) { if (($column % $columns) == 0) { printf(outfp "
 "); } $column++; if ($email{$k} eq 'none') { printf(outfp "%s%s\n", $k, $names{$k}); } else { printf(outfp "%s". '%s'."\n", $k, $email{$k}, $names{$k}); } } # pad the last of the table while (($column % $columns) != 0) { printf(outfp "   \n"); $column++; } printf(outfp "
"); # print out the html footer printf(outfp "
\n" . "Devin Reade\n" . "
\n" . 'gdr@gno.org' ."\n". "

\n"); # clean up and exit close(infp); close(outfp); sub htmlconv { local($text); $text = @_[0]; if (($text eq '.') || ($text eq '')) { $text = ' '; } else { $text =~ s//>\;/g; $text =~ s/"/"\;/g; } return $text; } sub Fatal { print stderr "Fatal Error: "; print stderr @_; print stderr "\nAborted\n"; exit(1); }