#!@DASPERL BEGIN { # Path to directory containing other GEOS DAS programs. # Directory $GEOSDAS_PATH/bin will be searched for these # programs. if ( $#ARGV + 1 < 2 || $ARGV[0] eq 'help' ) { print STDERR <<'ENDOFHELP'; Usage: token_resolve token_pattern date time token_resolve efake.prog.t%y4%m2%d2.%h2Z yyyymmdd hhmmss token_resolve takes a tokenized filename, and optionally an eight digit date and a six digit time and replaces the tokens with the correct values. If no date and time are supplied, the replacement is done with Unix wildcards. If only a time is needed you must supply a zero for the date as a placeholder. Legal tokens are based on the GrADS tokens: %y2 2 digit year %y4 4 digit year %m2 2 digit month (leading zero if needed) %mc 3 character month abbreviation (jan, feb etc.) %d2 2 digit day (leading zero if needed) %j3 3 digit Julian day of year (001-366) %h2 2 digit hour %n2 2 digit minute (leading zero if needed) %s2 2 digit second %s any string - returns "*" %c any single character - returns "?" %n any single digit - returns "[0-9]" ENDOFHELP } use FindBin; # This module contains the dirname() subroutine. use File::Basename; # If default GEOS DAS path, set path to parent directory of directory where this # script resides. $GEOSDAS_PATH = dirname( $FindBin::Bin ); # Set name of the bin directory to search for other programs needed by this one. $BIN_DIR = "$GEOSDAS_PATH/bin"; # Get the name of the directory where this script resides. If it is different # than BIN_DIR, then this directory will also be included in the list of # directories to search for modules and programs. $PROGRAM_PATH = $FindBin::Bin; # Now allow use of any modules in the bin directory, and (if not the same) the # directory where this program resides. (The search order is set so that # the program's directory is searched first, then the bin directory.) if ( $PROGRAM_PATH ne $BIN_DIR ) { @SEARCH_PATH = ( $PROGRAM_PATH, $BIN_DIR ); } else { @SEARCH_PATH = ( $BIN_DIR ); } } # End BEGIN # Any reason to exit found during the BEGIN block? if ( $die_away == 1 ) { exit 1; } # Include the directories to be searched for required modules. use lib ( @SEARCH_PATH ); # Set the path to be searched for required programs. $ENV{'PATH'} = join( ':', @SEARCH_PATH, $ENV{'PATH'} ); # This module contains the rget() subroutine. use Manipulate_time; $filename = token_resolve( "$ARGV[0]", "$ARGV[1]", "$ARGV[2]" ); print "$filename\n"; # Change the return code so that 0 indicates success. (Scripts and script wrappers # return 0 on success, (unix convention), perl subroutines return "true" on success.) exit ! $rget_retcode;