#! /bin/csh -f # # Filename: print # # Programmer: Br. David Carlson # # Date: September 24, 1995 # # This C shell program allows the user to print files on either Epson DFX # printer. Note that it tests if the filename specified is a legitimate file, # is readable, and contains text. It prints an appropriate message, # depending upon the result. This script is intended to be used under HP-UX # on acad1. # # Modified slightly, 14 Mar '96: added pr to beautify output # while (1) clear cat /usr/local/bin/print.menu echo "Enter your choice of command: \c" set choice="$<" if ("$choice" == "1" || "$choice" == "2" || "$choice" == "3" || "$choice" == "4") then clear echo " Academic Minicomputer" echo " Print Menu\n" echo "Please enter the filename" echo "to be printed or q to quit: \c" set fname="$<" if ("$fname" == "q" || "$fname" == "Q") then exit 0 endif if (! -f "$fname") then echo "Cannot find a file named" "$fname" exit 1 else if (! -r "$fname") then echo "Cannot read from file" "$fname" exit 2 else file "$fname" | grep text > /dev/null if ("$status" != "0") then echo "$fname" "appears not to be text. Only text can be printed." exit 3 endif endif endif if ("$choice" == "1") then pr -h "File: $fname User: `whoami`" "$fname" | lp -da02epson echo "$fname" "has been sent to the Epson DFX printer in Alfred 02" echo "Press Enter to continue: \c" set ansr="$<" else if ("$choice" == "2") then pr -h "File: $fname User: `whoami`" "$fname" | lp -dcisepson echo "$fname" "has been sent to the Epson DFX printer on ground Physics" echo "Press Enter to continue: \c" set ansr="$<" else if ("$choice" == "3") then pr -h "File: $fname User: `whoami`" "$fname" | lp -depsonj echo "$fname" "has been sent to the Epson LQ-870 printer in P204" echo "Press Enter to continue: \c" set ansr="$<" else if ("$choice" == "4") then pr -h "File: $fname User: `whoami`" "$fname" | lp -dminiepson echo "$fname" "has been sent to the Epson LQ-850 printer in the mini room" echo "Press Enter to continue: \c" set ansr="$<" else if ("$choice" == "q" || "$choice" == "Q") then echo "" exit 0 else echo "Invalid choice -- press Enter" set ansr="$<" endif end