#!/usr/local/bin/perl ############################################################################## # Time-stamp: # # Usage: do read_template(,); # # Read the template file as defined in /dev/null. # Set global variables as defined in the template file. # This is mainly used in gran-extr and RTS2gran. # ############################################################################## require "par-aux.pl"; sub read_template { local ($org_templ_file_name,$input) = @_; local ($f,$templ_file_name); # Resolve name $gran_dir = $ENV{GRANDIR} ? $ENV{GRANDIR} : $ENV{HOME} ; $templ_file_name = ( $org_templ_file_name eq '.' ? "TEMPL" #^^^ default file name : $org_templ_file_name eq ',' ? $gran_dir . "/bin/TEMPL" #^^^ global master template : $org_templ_file_name eq '/' ? $gran_dir . "/bin/T0" #^^ template, that throws away most of the info : $org_templ_file_name ); if ( $opt_v ) { print "Reading template file $templ_file_name ...\n"; } ($f = ($input eq "-" ? "stdin" : $input)) =~ s/.rts//; open(TEMPLATE,"cat $templ_file_name | sed -e 's/\$0/$f/' |") || die "Couldn't open file $templ_file_name"; while (