Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: fingerhu@ircam.fr (Michel Fingerhut)
Subject: Re: Online, Internet-Accessible Product Information
Date: 3 Feb 93 09:20:40 GMT	[thread overview]
Message-ID: <1993Feb3.092040.23086@ircam.fr> (raw)
In-Reply-To: 1993Feb2.104350.1540@ircam.fr

I wrote:
>I hacked a perl script that goes through all the SPRs and extracts their
>title and hardware and software requirements.  If there is enough demand,
>I'll post either the list or the script.

Well, by popular demand (>1) here is the script.  The list is far too long
to post.  Suggestions to me by email, complaints to /dev/null (this _is_
a hack).

-------------------------------- chop -----------------------------------
#!/usr/local/bin/perl
#
#			Copyright (c) 1993 by IRCAM
#			    All rights reserved.
#
#  For any information regarding this and other IRCAM software, please
#  send email to:
#                              manager@ircam.fr
#

#
# mkindex	%I% IRCAM %G%
#
# Make tbl index of SPDs
# Options:
#	-d	output raw [g]roff file in /tmp/index.$$
#	-l	output processed file to printer
#	none	preview
#
# Modification history
#
# 21-Jan-93 - Michel Fingerhut (fingerhu@ircam.fr)
#
$[ = 1;                 	# set array base to 1
$, = ' ';               	# set output field separator
$\ = "\n";              	# set output record separator

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) = localtime(time);
%month= ( 1, 'Jan', 2, 'Feb', 3, 'Mar', 4, 'Apr', 5, 'May', 6, 'Jun',
	   7, 'Jul', 8, 'Aug', 9, 'Sep', 10, 'Oct', 11, 'Nov', 12, 'Dec');

$date= sprintf("%2d-%s-%d", $mday, $month{$mon+1}, $year);

$options = ':dlv';		# for getopts
$usage   = "Usage: $0 [-v]\n";  # if failed

#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Keyword tables -- key is pattern, value is stuff to stick in
#------------------------------------------------------------------------------

%hard= (
    "vax",	"Vax",
    "decstation","DECstation",
    "decsystem", "DECsystem",
    "tops-10",	"Tops-10 system",
    "tops-20",	"Tops-20 system",
    "kl10",	"KL10",
    "ki10",	"KI10",
    "ks10",	"KS10",
    "risc",	"Risc",
    "pdp",	"PDP",
    "alpha",	"Alpha",
    "stem-10",	"Dec-10",
    "stem-20",	"Dec-20",
    "11mds",	"11MDS",
    "rt-11",	"RT-11 config",
    "macsys-rt","MACSYS-RT",
    "rsx-11",	"RSX-11 config",
    "cts-500",	"CTS-500",
    "rsts",	"RSTS config",
    "unibux",	"Unibus-based config",
    "ias ",	"IAS OS config",
);

%soft= (
    "ultrix",	"Ultrix",
    "rsts",	"RSTS",
    "vms",	"VMS",
    "osf",	"OSF",
    "rt-11",	"RT-11",
    "tops",	"TOPS",
    "rsx",	"RSX",
    "sco",	"SCO Unix",
)
;
# parse arguments
require 'getopts.pl';
&Getopts($options) || die $usage  ;     # parse the arguments

# -v: print version and exit
if (defined $opt_v) {
    print '%I% IRCAM %G%';
    exit;
}

$out= $opt_d? ">/tmp/index.$$" : 
      ($opt_l? "| groff -me -t -l" :
	       "| groff -me -t | ghostview -");

open (TABLE, $out) || die "Can't open table for output: $!\n";
print TABLE ".TS H";
print TABLE "center box;";
print TABLE "c | cw(8c) | ce | ce";
print TABLE "l | l | l | l.";
print TABLE "SPD	TITLE	SOFT	HARD";
print TABLE "=";
print TABLE ".TH";

foreach $spd (<*>) {
    next if $spd !~ /^\d.*\d$/;
    open(SPD, $spd) || die "Can't open $spd: $!\n";
    &extract;
    close(SPD);
}
print TABLE ".TE";
close TABLE;

#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------

sub extract {
    while (<SPD>) {
	chop;
	s/^\s+//;
	undef $title;
	if (/.*PRODUCT NAME[:\s]*(.*)/ || /(.*\S)\s*SPD \d\d\.\d\d\.\d\d$/
	   || /(.*\S)\s*SPD$/) {
	    ($title= $1) =~ s/\s*SPD.*//i;
	    $title =~ s/^\s+//;
	    while (1) {
	        chop($_ = <SPD>);
	        s/^\s+//;
		s/^\d\d\.\d\d\.\d\d\s*//;
		last if $_ eq "";
	        $title .= " $_";
	    }
	    &extract1;
	    $software =~ s/, $//;
	    $hardware =~ s/, $//;
	    printf TABLE
	        "%s\tT{\n%s\nT}\tT{\n%s\nT}\tT{\n%s\nT}\n",
	    	$spd, $title, $software, $hardware;
	    return;
	}
    }
}

#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------

sub extract1 {
    while (<SPD>) {
	chop;
	s/^\s+//;
	&hardware if /HARDWARE REQUIRE/;
	&software if /PREREQUISITE SOFTWARE|SOFTWARE REQUIREMENTS/;
    }
}

#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------

sub software {
    undef $software;
    while (<SPD>) {
	chop;
	s/^\s+//;
	return if /^[A-Z\s]{10,}/;
	foreach $p (keys %soft) {
	    $software .= "$soft{$p}, " if /$p/i && $software !~ /$soft{$p}/;
	}
    }
}

#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------

sub hardware {
    undef $hardware;
    while (<SPD>) {
	chop;
	s/^\s+//;
	return if /^[A-Z\s]{10,}/;
	foreach $p (keys %hard) {
	    $hardware .= "$hard{$p}, " if /$p/i && $hardware !~ /$hard{$p}/;
	}
    }
}


  reply	other threads:[~1993-02-03  9:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-22 20:49 Online, Internet-Accessible Product Information Russ Jones
1993-02-02 10:43 ` Michel Fingerhut
1993-02-03  9:20   ` Michel Fingerhut [this message]
1993-02-04 15:07   ` Brent Sterner
1993-02-04 17:53     ` Patrick W. Matlock (DCS)
1993-02-06 16:59   ` Barry Archer
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox