#!/bin/csh -f # Gv calls gv to display PostScript files on a X-terminal with the # syntaxes # # Gv [-ghostviewoption ... ] # Gv [-ghostviewoption ...] [ name[.[e]ps] ... ] [ name[.epsi] ... ] # # The difference to gv is that the suffixes .ps. eps or .epsi do not # have to be provided explicitly with the file names, and that more # than one file name is allowed on the command line. # The UNIX shell file expansion mechanism implies that also calls # with wildcards like # Gv [-ghostviewoption ... ] *.eps *.ps # Gv [-ghostviewoption ... ] name* name2?.ps # are supported. # Richard J. Mathar, 1997-04-14 set opt while ( ${#argv} > 0 ) # Treat options that have to be followed by other arguments. # (The list is taken from the gv manual). # Those arguments have to be handled in conjunction with the # argument that follows, whereas the monolitic options are # merely treated with a 'shift'. switch ( $argv[1] ) case "-page": case "-resolution": case "-magstep": case "-dpi": case "-xdpi": case "-ydpi": # Handle the corresponding toolkit options that arise with # a second argument. case "-geometry": #case "-title": #case "-xnllanguage": #case "-xrm": # set opt="$opt $argv[1] $argv[2]" # shift # breaksw # And handle the options of gv and of the toolkit that # are standalone. #case "-*": # set opt="$opt $argv[1]" # breaksw # Take the remaining command line arguments which are supposed # to be PostScript file names. If these are not readable (possibly # non-existing) the three suffixes are tested one-by-one. default: if ( -r $argv[1] ) then gv $opt $argv[1] else if ( -r $argv[1].ps ) then gv $opt $argv[1].ps else if ( -r $argv[1].eps ) then gv $opt $argv[1].eps else if ( -r $argv[1].epsi ) then gv $opt $argv[1].epsi endif # fanz is a flag to indicate that file names have been found set fanz breaksw endsw shift end # If there were no command line options (no $*, not even a file name): if ( ! $?fanz ) gv $opt