"Fossies" - the Fresh Open Source Software Archive

Member "vera-1.23/contrib/vera.pl" (9 Jun 2002, 1286 Bytes) of package /linux/misc/vera-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "vera.pl" see the Fossies "Dox" file reference documentation.

    1 #! /usr/bin/perl -w
    2 #
    3 #  Andres Soolo <soolo [at] ut . ee> writes:
    4 #  "Also, I'd like to contribute this non-interactive tool to look up
    5 #  VERA entries:"
    6 
    7 
    8 use strict;
    9 
   10 # Global parameters
   11 
   12 use vars qw/$verainfo/; $verainfo = '/usr/share/info/vera.info.gz';
   13 
   14 # End of global parameters
   15 
   16 # All items in %acronym are wanted; those with empty string as their
   17 # values will be reported as unknown.
   18 my %acronym = map {uc, ''} @ARGV;
   19 
   20 delete $acronym{''}; # no such
   21 
   22 # Check whether user asked for --help
   23 if (not %acronym or defined $acronym{'--HELP'})
   24 {
   25     print "Usage: vera acronym ...\n";
   26     exit;
   27 }
   28 
   29 # The MNP5 -> MNP translation.  Note that MNP is only weakly wanted.
   30 # See 'Acronyms pointing to versions'.
   31 s/\d+$// and $acronym{$_} = $_ for keys %acronym;
   32 
   33 open VERA, "zcat $verainfo |" or die "Trouble opening $verainfo: $!";
   34 
   35 print "\n";
   36 
   37 while (%acronym and $_ = <VERA>)
   38 {
   39     chomp;
   40     last if $_ eq 'Examples:'; # No unnecessary duplicates
   41     if (defined $acronym{$_})
   42       {
   43         $acronym{$_} = $_; # Not unknown anymore
   44         print "$_\n";
   45         while ($_ ne "\n") { $_ = <VERA>; print; }
   46       }
   47 }
   48 
   49 close VERA;
   50 
   51 delete $acronym{$_} for values %acronym; # Delete weakly wanted ones
   52 
   53 print "Unknown acronyms: ", join (', ', sort keys %acronym), "\n\n" if %acronym;
   54