# Shell script to do passthrough print, dealing with unknown TERM, # unknown passthrough print codes, etc. # Released to public domain by Rasmussen Software, Inc. # # To install: # Place it on UNIX(-like) system, in a directory in your PATH # Make it executable, with # chmod +x passprt # # To use: # Either pipe to it: # somecommand | passprt # or reference a file: # passprt somefile # if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then TERM=vt220 # TERM unknown; assume VT220 fi MC5=`tput mc5 2> /dev/null` # Code to turn on passthru MC4=`tput mc4 2> /dev/null` # Code to turn off passthru if [ "$MC4" = "" -o "$MC5" = "" ]; then # Are MC4, MC5 defined? case "$TERM" in [wW][yY]*) MC5=`echo -e "\033d#\c"`; # Wyse 50/60 MC4=`echo -e "\024\c"`;; [vV][iI][eE][wW]*) MC5=`echo -e "\0333\c"`; # Viewpoint MC4=`echo -e "\0334\c"`;; [vV][wW]*) MC5=`echo -e "\0333\c"`; # Vwpt MC4=`echo -e "\0334\c"`;; *) MC5=`echo -e "\033[?5i\c"`; # Other: assume ANSI style MC4=`echo -e "\033[?4i\c"`;; esac fi SAVETTY=`stty -g` # Save current stty settings stty onlcr # Be sure LF gets CR added echo -n $MC5 # Turn on passthrough print cat $* # Output all files echo -n $MC4 # Turn off passthrough print stty $SAVETTY # Restore stty settings