#!/usr/bin/perl # # print filter for deciding if a file is a PS file or not. # # designed for use with xbubblejet, a Tcl/Tk based GUI for # allowing Linux users to interactively set print options # for their Canon BJ-4XXX printer. # # # obtain the username: parameter after "-n" # while (@ARGV) { $user = shift ; if ($user eq "-n") { $user = shift ; last; } } $_ = ; # # check if a postscript file # if (substr($_,0,2) eq "%!") { $device_options = "-sDEVICE=bjc600" ; $canon_options = "-q -dSAFER -dNOPAUSE -sOutputFile=- -" ; $user_options_file = " ; chop $user_options ; close(OPTFILE) ; } else { undef($user_options) } ; $gs_options = $device_options." ".$user_options." ".$canon_options ; open(FILTER,"| /usr/bin/gs $gs_options"); undef($asciimode) ; } else { # # just an ASCII file - add carriage returns using sed # open(FILTER,'| /bin/sed -e s/$/ /') ; $asciimode = 1; } print FILTER $_; while () { print FILTER $_ } ; if (defined($asciimode)) { print ' ' } ; close(FILTER) ;