file_class (version 2.0)
You can also look at:
#! /usr/bin/perl
##############################################################################
#
# SYNTAX: file_class type
#
# DESCRIPTION: This utility returns the file class for a given file type.
# DESCRIPTION: The file class determines which directory it will end up in.
#
# VERSION: 2.0
#
# HISTORY: 0.0 -> 1.0 9/26/96
# HISTORY: Now reads from $LISTS/file_classes instead of having a large case
# HISTORY: statement.
# HISTORY:
# HISTORY: 1.0 -> 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, $remainder) = split /\|/, $_, 3;
if ( $tape_class ) {
$tape_class=~s/ *(.*) */$1/;
print "$tape_class\n";
$found_class = 1;
last;
}
}
}
}
if ( ! "$found_class" ) {
`$UTIL/exception $0 1 "Unknown file type $type setting class to aux"`;
print "aux\n";
}
exit 0