file_description (version 2.0)
You can also look at:
#! /usr/bin/perl
##############################################################################
#
# SYNTAX: file_description type
#
# DESCRIPTION: This utility gives a short phrase describing a given file type.
#
# VERSION: 2.0
#
# HISTORY: 0.0 -> 1.0 8/19/96
# HISTORY: teldef now refers to both SIS and GIS files.
# HISTORY: Deleted individual GIS teldef file types (eg g2onflf).
# HISTORY: 8/23/96
# HISTORY: Added scraps file type.
# HISTORY:
# HISTORY: 1.0 -> 1.1 9/11/96
# HISTORY: Added totsky, corimg, expo, and totexpo.
# HISTORY:
# HISTORY: 1.1 -> 1.2 9/26/96
# HISTORY: Now reads from $LISTS/file_classes instead of having a big
# HISTORY: case statement.
# HISTORY:
# HISTORY: 1.2 -> 2.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/exception
#
##############################################################################
#$DEBUG = 1;
$type = $ARGV[0];
$UTIL = $ENV{"UTIL"};
open FILE_CLASSES, "<$ENV{'LISTS'}/file_classes";
while (<FILE_CLASSES>) {
if ( ! /^#/ ) {
if ( /^$type *\|/ ) {
($filetype, $tape_class, $trend_class, $description) = split /\|/, $_, 4;
if ( $description ) {
$description=~s/ *(.*) *\n*/$1/;
print "$description\n";
$found_description = 1;
last;
}
}
}
}
if ( ! $found_description ) {
`$UTIL/exception $0 1 "Unknown file type $type"`;
}
exit 0;