home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 200.img / SCO386X3.TD0 / usr / spool / lp / model / emulator < prev    next >
Encoding:
Text File  |  1988-05-17  |  3.3 KB  |  129 lines

  1. :
  2. #    @(#) emulator.src 1.4 88/05/13 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1987.
  5. #    This Module contains Proprietary Information of
  6. #    The Santa Cruz Operation, Microsoft Corporation
  7. #    and AT&T, and should be treated as Confidential.
  8. #
  9. #    lp interface for Tandy Printers in IBM Emulation Mode
  10. #
  11. #    This interface assumes that the LF code DIP switch is ON (LF = NL),
  12. #    the Emulation Mode DIP switch of the Tandy printer is ON, and that
  13. #    all other DIP switches are OFF. 
  14. #
  15. #    See your printer manual for details on how to use these options.
  16. #    Notice that some options are not compatible with others and that
  17. #    all options are not available on every printer;  check
  18. #    your printer manual for details.
  19. #    
  20. #
  21. #    Tandy Emulator 1.0
  22. #
  23. #    Options for lp -o:
  24. #
  25. #    compress    Standard Compressed 12 Characters per inch
  26. #    condense    Standard Condensed 17 Characters per inch
  27. #    corresp        Correspondence Quality 10 CPI
  28. #    corresp.12    Correspondence Quality 12 CPI
  29. #    prop        Proportional Spacing
  30. #    prop.comp    Compressed Proportional
  31. #    dblwidth    Double Width Characters
  32. #    emphasize    Emphasized Characters
  33. #    dblstrike    Double Strike Characters
  34. #    normal        Normal Printout.  Default if no options are chosen.
  35. #    
  36. #!    Tandy Printer in IBM Emulation Mode
  37.  
  38. trap  'echo "$fixup$fix" ; echo "\f\c" ; exit 144' 1 2 3 15
  39.  
  40. copies="$4"
  41. user=`grep "^$2:" /etc/passwd | line | awk -F: '{ print $5 }'`
  42.  
  43. if    nhead=`grep "^BANNERS=" /etc/default/lpd 2>/dev/null    |
  44.           line                        |
  45.           awk -F= '{ print $2 }'`
  46.     [ "N$nhead" = "N" ]
  47. then
  48.     nhead=1
  49. fi
  50.  
  51. while    [ $nhead -gt 0 ]
  52. do
  53.     echo "\014\c"
  54.     banner "$2"
  55.     echo "\n"
  56.     if    [ -n "$user" ]
  57.     then
  58.         echo "User: $user\n"
  59.     else
  60.         echo "\n"
  61.     fi
  62.     echo "Request id: $1    Printer: `basename $0`\n"
  63.     date
  64.     echo "\n"
  65.     if    [ -n "$3" ]
  66.     then
  67.         banner "$3"
  68.     fi
  69.     nhead=`expr $nhead - 1`
  70. done
  71.  
  72. fixup=
  73. for option in $5
  74. do
  75.     case "$option" in
  76.         compress)            # Compressed , (12 CPI)
  77.                    fix="\022"
  78.                   echo "\033:";;
  79.             condense)                        # Condensed , (17 CPI)
  80.                    fix="\022"
  81.            echo "\017";;
  82.             corresp)                     # Correspondence Quality, 10 CPI
  83.                    fix="\033I\001\022"
  84.            echo "\033I\002";;
  85.             corresp.12)                    # Correspondence Quality, 12 CPI
  86.                    fix="\033I\001\022"
  87.            echo "\033I\002\033:";;
  88.             prop)                      # Proportional Spacing
  89.                    fix="\033P\000\033I\001\022"
  90.            echo "\033I\002\033P\001";;
  91.             prop.comp)                       # Compressed Proportional
  92.                    fix="\033P\000\033I\001\022"
  93.            echo "\033I\002\033:\033P\001";;
  94.             emphasize)                       # Emphasized Characters
  95.                    fix="\033F"
  96.            echo "\033E";;
  97.         dblwidth)                # Double Width Characters
  98.            fix="\033W\000"
  99.            echo "\033W\001";;
  100.         dblstrike)                # Double Strike Characters
  101.            fix="\033H"
  102.            echo "\033G";;
  103.         normal)            # Normal, Default
  104.            fix="\033P\000\033I\001\022"
  105.            echo "\033P\000\033I\001\022";;
  106.              *)                         # Illegal Option
  107.                    echo "Illegal printer option $option ignored" >&2 ;;
  108.         esac
  109.         fixup="$fixup$fix"
  110. done
  111.  
  112.  
  113.  
  114. echo "\014\c"
  115. shift; shift; shift; shift; shift
  116. files="$*"
  117. i=1
  118. while    [ $i -le $copies ]
  119. do
  120.     for file in $files
  121.     do
  122.         cat "$file" 2>&1
  123.         echo "\014\c"
  124.     done
  125.     i=`expr $i + 1`
  126. done
  127. echo "$fixup\c"
  128. exit 0
  129.