home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume14 / shellforms / part01 / Print < prev    next >
Text File  |  1988-05-09  |  3KB  |  96 lines

  1. #! /bin/csh -f
  2. #
  3. #-    print -  print file(s) to line printer (with sf interface)
  4. #-
  5. #    Author:        Paul Lew, General Systems Group, Salem, NH
  6. #    Created at:    5/8/86
  7. #    Last update:    01/27/88  00:03 AM  (Edition: 11)
  8. #
  9. #-    Usage:    Print filenames <CR>
  10. #---------------------------------------------------------------#
  11. #          Display help if requested by user            #
  12. #---------------------------------------------------------------#
  13. switch ( "$1" )
  14.     case -H[xX]:
  15.         set echo; set verbose; shift
  16.         breaksw
  17.     case -H*:
  18.         show_help `which $0` $1
  19.         goto end
  20.     default:
  21.     endsw
  22. #---------------------------------------------------------------#
  23. #      Display form to take input from the user        #
  24. #---------------------------------------------------------------#
  25. set srcfile = "/tmp/form.$$"
  26. sf -o ${srcfile} -u <<!
  27.  
  28.          General Systems Group Fast Printer Spooler
  29.  
  30.    File Name: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31.  
  32.     [-#] Number of copies:    ~~~          [-h] Burst Header Page: ~~~
  33.     [-m] Send mail on completion: ~~~     [-p] Format with pr:    ~~~
  34.  
  35.     [-J] Job Name:        ~~~~~~~~~~~~~
  36.     [-C] Class Name:    ~~~~~~~~~~~~~
  37.     [-T] Title for pr:    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38.  
  39.             Current Print Queue Status
  40. `lpq | head -5`
  41.  
  42.     [Press TAB to move to next field, RETURN to execute]
  43.  
  44. v=fnd=$*
  45. v=copya=add=1v=bursts=/Yes/Noa=a
  46. v=mails=/No/Yesa=av=prs=/Yes/Noa=a
  47. v=jobd=$1
  48. v=classd=`hostname`
  49. v=titled=$1
  50. !
  51. #---------------------------------------------------------------#
  52. #    Execute script to set variables from form        #
  53. #---------------------------------------------------------------#
  54. if ( ! -e ${srcfile} ) goto end
  55. source ${srcfile}
  56. #---------------------------------------------------------------#
  57. #      Re-arrange variables before execution            #
  58. #---------------------------------------------------------------#
  59. if ( "${copy}" != "1" ) then
  60.     set copy = "-#${copy}"
  61. else
  62.     set copy = ''
  63.     endif
  64. #
  65. if ( "${burst}" != "Yes" ) then
  66.     set burst = "-h"
  67. else
  68.     set burst = ''
  69.     endif
  70. #
  71. if ( "${pr}" == "Yes" ) then
  72.     set pr = "-p"
  73. else
  74.     set pr = ''
  75.     endif
  76. #
  77. if ( "${mail}" == "Yes" ) then
  78.     set mail = "-m"
  79. else
  80.     set mail = ''
  81.     endif
  82. #
  83. set tf; set cf; set jf
  84. if ( "${title}" != "" ) set tf = "-T"
  85. if ( "${class}" != "" ) set cf = "-C"
  86. if ( "${job}" != "" ) set jf = "-J"
  87. #---------------------------------------------------------------#
  88. #           Execute proper command ....            #
  89. #---------------------------------------------------------------#
  90. if ( "${fn}" != "" ) then
  91.     lpr ${copy} ${burst} ${pr} ${mail} ${tf} "${title}" \
  92.     ${cf} "${class}" ${jf} "${job}" ${fn}
  93.     endif
  94. /bin/rm -f ${srcfile}
  95. end:
  96.