#!/usr/bin/perl -w { # get_versions.pl. Assumed installed in jgofsroot/* (most likely # jgofsroot/htmlbin). WJS Aug 10 # Does a strings | grep ersion of input arg. Input arg comes from # command line or QUERY_STRING, in that order. Input arg can be # relative file spec or program name or nothing. If nothing, # program name defgb assumed. If program name, program assumed to be # in ../*/ ($web_env = defined $ENV{'QUERY_STRING'}) && require ("cgi-lib.pl"); ($program = $ARGV[0]) || ($program = $ENV{'QUERY_STRING'}) || ($program = "defgb"); if ($program =~ q|/|) { ($program =~ q|^/|) && &quit ("Absolute file specs not allowed"); $double_dot_count = ($program =~ s/\.\./\.\./g); ($double_dot_count > 1) && &quit ("Cannot examine programs outside jgofsroot"); } else { $program = "../*/" . $program; } ($program =~ /^[\w\-\_\.\/\*]+$/) || &quit ("Illegal character in file spec $program"); $! = $? = 0; $web_env && (print &PrintHeader()) && (print "
");
  system ("strings $program | grep -i \" version \"");
  $web_env && ($? != 0) && (print "
") && &quit ("strings-piped-to-grep failed. Most likely file $program not found"); exit 0; } sub quit { ($web_env) ? &CgiDie($_[0]) : die $_[0]; }