    Linux HOWTO (Linux Printing HOWTO)
  Grant Taylor <gtaylor+pht@picante.com>,  Alex Ott
  ott@phtd.tpu.edu.ru

  v3.29, 9  1999

   Linux Printing HOWTO,      ,
  ,          
  Linux (    ).

  ______________________________________________________________________

  Table of Contents





















































  1. 

     1.1 
     1.2  

  2.  

  3.     Linux

     3.1  lp  ( <=2.1.32)
     3.2  parport ( >= 2.1.33)
     3.3  

  4.  

     4.1 Postscript
     4.2 Non-Postscript
     4.3   ?
        4.3.1   

  5.       ?

  6.   , 

  7.   -  

     7.1   lpd
     7.2    

  8.      

  9.  

     9.1 Red Hat
     9.2 Debian
     9.3  

  10. Ghostscript

     10.1   Ghostscript
     10.2   Ghostscript
        10.2.1     
        10.2.2 ,    ..

  11.     

     11.1    Unix/lpd
        11.1.1  
        11.1.2  
     11.2   Win95, WinNT, LanManager,  Samba
     11.3   NetWare
     11.4   EtherTalk (Apple)
     11.5  HP   ethernet-
        11.5.1    HP
     11.6 
     11.7  Windows
     11.8  Apple.
     11.9   Netware

  12.     Windows

     12.1 - Ghostscript  Windows
     12.2  pbm2ppa
     12.3  pbm2l7k

  13.    -
     13.1  -
     13.2    

  14.   -  

     14.1  
     14.2    WYSIWYG

  15.     

     15.1 PostScript
     15.2 TeX dvi
     15.3 Adobe PDF

  16.     lpd

     16.1  printcap
     16.2      

  17. Credits



  ______________________________________________________________________

   ::      , 
  .



  11..

  

  Printing HOWTO   ,    , 
         Linux-.  
  ,      "  " (the point-and-
  click)  Microsoft  Apple,      
           
  (LANs).


     ,     
      .   
  -     
         ,    
      9  10   
   .


     3.x      
     .    ,  
      ,   60 
  .       ,  : a)
         
  Printing HOWTO <http://www.picante.com/~gtaylor/pht/> b)  
     ,    ,   .


    Printing HOWTO
  <http://www.picante.com/~gtaylor/pht/>  ,   
    ;     MetaLab
  (metalab.unc.edu)    LDP.



  11..11..

  

    , ..    Printing HOWTO
  (PHT).   PHT    
  :


  1.      1992       
         comp.os.linux,   .  
         HOWTO    
       FAQ  `howto'.      
     plain ascii.

  2.     HOWTO, Printing-HOWTO   
     Lpd FAQ Brian McCauley <B.A.McCauley@bham.ac.uk>;  
       PHT   .     
      Karl Auer <Karl.Auer@anu.edu.au>.    PHT  
      TeXinfo,     PS, HTML, Ascii,  Info.

  3.       PHT,  
       -   ,  
      .   PHT    SGML,
      LinuxDoc DTD    SGML-tools-1.   
     3.27,       ; 
      3.27        
     (!).


  11..22..   

        Grant Taylor (c)
  1992-1999.       
   GNU General Public License,  2   .


  22..

   

      lpd     ,  
      ,     
   ,      --    
   lpr. Printing Usage HOWTO
  <http://metalab.unc.edu/LDP/HOWTO/Printing-Usage-HOWTO.html> 
            
   .


          ,   
            
   . !


  33..

      LLiinnuuxx

        
   ;   ,    .
     Linux  2.1.33.


        .  ,
    ,  Linux    ,
         "Plug and Play"   PC BIOS. ( 
   ;    PnP -PCI  
  Windows  -    -  ).


  33..11..

   llpp  (( <<==22..11..3322))

   Linux (<=2.1.32), ,      
     lp (  cat /proc/devices 
    lp,   ),   
   : _/_d_e_v_/_l_p_0, _/_d_e_v_/_l_p_1,  _/_d_e_v_/_l_p_2.   
   ,    
  /  .  ,    
    _l_p_0  _l_p_1     . 
   .


    ,    lp  
  ,      .
  ,     .


        plip  lp    
       (    2.0).  
            kerneld
    2.x (  1.3.x)   .  
      ,     
  plip   ,  lp  .    
     ;    
    ,  -      
   .


    ,  tunelp,  
  ,  ,  ,     lp
  Linux 2.0  ,     .


      ,      lp= 
      /:



         lp   ,    
        LILO/LOADLIN      ,
          .

       :      lp=port0[,irq0[,port1[,irq1[,port2[,irq2]]]]]

       :   lp=0x378,0   or   lp=0x278,5,0x378,7 **

       ,      ,   
       ** ,    ,    
       .        
       lp=0.





      ,    
  /       insmod ( 
   _/_e_t_c_/_c_o_n_f_._m_o_d_u_l_e_s,   kerneld)  
  .  : io=port0,port1,port2 
  irq=irq0,irq1,irq2.       _i_n_s_m_o_d
       .


  **   ,  ( )     
      ,     . 
    ( _l_p_0)  0x3bc.        
     .


        Linux 2.0  
   /usr/src/linux/drivers/char/lp.c.


  33..22..

   ppaarrppoorrtt (( >>== 22..11..3333))

     2.1.33 (      2.0.30),
   lp      parport.
    parport    ,
    -   lp -     
   ,    
     ,  
      /   ,
    .


    parport     
         Zip,
  Backpack CD-ROM  ,   .     
    2.0;   .


   ,   ,  ,  ,  
  parport    lp   .
   ,    lp1  Linux 2.0   lp0  Linux 2.2.
  ,          ,
     lp     parport.


      parport  ,   
    ,        
  Documentation/parport.txt    ,   
    parport <http://www.cyberelk.demon.co.uk/parport.html>.



  33..33..

   

     Linux   _/_d_e_v_/_t_t_y_S_1.
   stty      
     setserial  
        IRQ  
  /   .  
     Linux     Serial-HOWTO
  <http://metalab.unc.edu/mdw/HOWTO/Serial-HOWTO.html>.


        
  ,   ,      .
     -  ,   
   --        
   30      .  
    4096 ,      
     ,        
   30        
  ,      .   cat file
  > /dev/ttyS2       , 
    ,       .


  30-        
  "closing_wait"    setserial ( 2.12 
  ).     
   setserial    rc.serial.  
        
    closing_wait    
  .



  44..

   

   Linux     ,   
       ,  
   ,     ,    
        (  )  Linux.
        , 
       "Windows"  "GDI".  
  , -       
       . 
      Windows   
      Windows;    
  Winprinters.      
    NT, OS/2,    .


      __ ________  Linux.   
  ,      - ( -
  -   ,   
  ).    ,  ,
      .


        . 
   NEC, ,     
   PCL,     PCL  
       300dpi,   NEC   
   600dpi   .


  ,         Winprinters, 
    ,    Linux  ,  
          . 
   12  ,     ,
     Windows.


  44..11..

  PPoossttssccrriipptt

   ,  ________  Linux,   
       PostScript.  
     Unix,    
      PostScript,      
  ,    PostScript.   
  PostScript       .


     Unix,     ,
   Postscript    . 
     :


      ((TTiimmiinngg))
        Postscript    Apple Laserwriter, 
           Macintosh   
              
        80- .


        
          Postscript      
            ,   fax-,   
              
        .   Postscript      
          postscript,     
          .    PDF,
               Postscript.
          ,    , 
         ,    Windows    
         Postscript,   Adobe   
           Postscript,   PDF, 
             ,  
            "distiller". ( 
           ps2pdf  pdf2ps  
        ghostscript).


        
        Postscript    ;  
                .  
               
                ,
              "DRAFT",  
             .


       
        Postscript      
        (        ). 
        Adobe      
          ,  ,   Aladdin
            Postscript.



  44..22..

  NNoonn--PPoossttssccrriipptt

    ,    PostScript ,
        
  Ghostscript,   PostScript  
    PostScript .  
  Ghostscript <http://www.cs.wisc.edu/~ghost/>  
         
   . ,    
       Ghostscript,    
    Linux    
   Ghostscript -  .   
       Ghostscript   contrib
   .     
   Ghostscript,       .


     Adobe      
  "PrintGear".  ,        
     PostScript,     PostScript.
     ,  Ghostscript  .   
   PrintGear    ,  PCL,  
      Linux.(    PCL,  
    Windows).


  44..33..

    ??

      ,      
     ,    .   
   <http://www.picante.com/~gtaylor/pht/printer_list.cgi>
  Printing HOWTO ---       
  Linux.      ; ,  
        
        ,   
  .


     
  <http://www.cs.wisc.edu/~ghost/printer.html> Ghostscript 
     ,       
  .  Dejanews     " "
   "  ".     ,   
   ,  ,      
     
  <http://www.picante.com/~gtaylor/pht/printer_list.cgi>,   
          .


  44..33..11..

    

       . 
     , ,   
   ,   ,  
      .   
       ,  
   ,   .   ,   
    ,   !  listed, add it!


      :


     
             --   
          ,  ,    ..
             
        " ",   ,  
          ;      
         ,        .


      (( ))
           ,   
        ,        ,   
        .


     
          ,      ,   
         .     
           .


     
           ;    - 
         /   ,   .

    ,      ,
    ,   . ,  
          
     .


     ,    :


     BBrrootthheerr

        
           HL-10V, HL-660, HL-720, HL-760.

         (( ))
           HL-1050.

     CCaannoonn

        
           BJ-10e, BJ-20, BJ-200, BJC-210, BJC-240, BJC-250, BJC-610,
           BJC-620, BJC-70, BJC-800, LBP-8II, LIPS-III.

         (( ))
           BJ-300, BJC-4000, BJC-4100, BJC-4200, BJC-4300, BJC-4400,
           BJC-7000, BJC-7004.

        
           BJC-4550, MultiPASS C2500, MultiPASS C3500.

        
           BJC-5000, LBP-460, LBP-660.

     EEppssoonn

        
           ActionLaser 1100, LP 8000, LQ 850, Stylus Color, Stylus Color
           400, Stylus Color 500, Stylus Color 600, Stylus Color 640,
           Stylus Color 850, Stylus Color II, Stylus Color IIs, Stylus
           Pro XL.

         (( ))
           Stylus Color 800, Stylus Photo 750.

        
           Stylus Color 740.

     HHPP

        
           2000Cse, 2500C, DesignJet 650C, DeskJet 1200C, DeskJet 1600C,
           DeskJet 1600Cm, DeskJet 400, DeskJet 420C, DeskJet 500,
           DeskJet 550C, DeskJet 600, DeskJet 660Cse, DeskJet 690C,
           DeskJet 850C, DeskJet 855C, DeskJet 870, DeskJet 870Cxi,
           DeskJet 890, LaserJet 1100, LaserJet 2100, LaserJet 2100M,
           LaserJet 4000N, LaserJet 4L, LaserJet 5, LaserJet 5L,
           LaserJet 5MP, LaserJet 6L, LaserJet 6MP, LaserJet 8000,
           LaserJet 8100, Laserjet 5000, Mopier 320, PaintJet XL300.

         (( ))
           HP 660C.

        
           DeskJet 1000C, DeskJet 670C, DeskJet 710, DeskJet 720C,
           DeskJet 722C, DeskJet 820C.

        
           LaserJet 3100.

     IIBBMM

        
           Jetprinter 3852.

     LLeexxmmaarrkk

        
           Optra Color 1200, Optra Color 1275, Optra Color 40, Optra
           Color 45, Optra E, Optra E+, Optra Ep, Optra S 1250.

        
           1020 Business, 3000, 5700, 7000.

        
           1000, 1020, 1100, 2030, 2050, 2070, 5000, 7200, Winwriter
           100, Winwriter 150c, Winwriter 200.

     MMiinnoollttaa

        
           PagePro 6, PagePro 8.

     NNEECC

        
           P2X.

        
           SuperScript 100C, SuperScript 1260, SuperScript 150C,
           SuperScript 650C, SuperScript 750C, SuperScript 860,
           SuperScript 870.

        
           SuperScript 660i, SuperScript 660plus.

     OOkkiiddaattaa

        
           OL 410e, OL 610e/PS, OL 810e/PS, Okipage 6e, Okipage 6ex,
           Okipage 8c.

         (( ))
           Okipage 4w.

        
           Okipage 8w, okijet 2010.

     OOlliivveettttii

        
           JP350S.

     PPaannaassoonniicc

        
           KX-P1123, KX-P4440, KX-P5400, KX-P8420, KX-P8475.

        
           KX-P6500.

        
           KX-P6100, KX-P8410.

     QQMMSS

        
           2425 Turbo EX.

     RRiiccoohh

        
           4801, 6000.

     XXeerrooxx

        
           DocuPrint C55, DocuPrint N17, DocuPrint N32.


  55..

        ??

        Linux    --
        lpd,    
     BSD Net-2.    
     .    .
    SVR4,  Sun Solaris,   
    ,   lpsched.  
  ,    Linux   LPRng,
      ,   .
  LPRng        (:
     ,   ,  
   -lpd  )     
  ,  lpd.         --
        SUID,   
     PGP  Kerberos.


    ,     , lpd  
     Linux.     
  ,         
        Unix.


         LPRng,   LPRng -
  An Enhanced Printer Spooler <http://www.astart.com/lprng/LPRng.html>.
         
    LPRng   lpd.


  66..

    ,, 

       ,    
    lpd.


  Lpd  Line Printer Daemon (  ), 
        -    
       . :


     lpd
          .       
         ,        
        .


     lpr
          . Lpr   lpd  
             .


     lpq
            .


     lpc
           lpd.   lpc  
        , ,   .. 
        .


     lprm
        lprm     .


      ?   , 
     lpd.    /etc/printcap 
       .    
  lpr, lpr   lpd    _/_d_e_v_/_p_r_i_n_t_e_r, 
   lpd          
      .  lpd   
      .


   lp      
    --       
  ascii.   ,     
    lpd      
  ,      PostScript,  ,  dvi,
  ..



  77..

    --  

  77..11..

    llppdd

    lpd  ,   
      .       
        ,     
    .   ,    
  ,   !

       lpd,      
  _/_e_t_c_/_p_r_i_n_t_c_a_p,      
  _/_v_a_r_/_s_p_o_o_l_/_l_p_d.


     _/_e_t_c_/_p_r_i_n_t_c_a_p   :



       #  djet500
       lp|dj|deskjet:\
               :sd=/var/spool/lpd/dj:\
               :mx#0:\
               :lp=/dev/lp0:\
               :sh:





      _l_p, _d_j,  _d_e_s_k_j_e_t,  
     _/_v_a_r_/_s_p_o_o_l_/_l_p_d_/_d_j,  
    ,    
  _/_d_e_v_/_l_p_0,        (  ,
     .. )    
  .


       _p_r_i_n_t_c_a_p.


      ,     --
     ,  DeskJet 500  ,  DeskJet
     .     
  Unix   ,  deskjet    
    ,   :



       This is line one.
                        This is line two.
                                         This is line three.





    PostScript      
   PostScript,    " ",  
   .


    - ,    
  .        
  printcap      _i_f  _o_f.  , _i_f,
     --      .


      ,  _f_i_l_t_e_r,  
       ,    
  .      _i_f  , 
    printcap:




  lp|dj|deskjet:\
          :sd=/var/spool/lpd/dj:\
          :mx#0:\
          :lp=/dev/lp0:\
          :if=/var/spool/lpd/dj/filter:\
          :sh:





      :



       #!perl
       #        perl
       #    : chmod 755 filter
       while(<STDIN>){chop $_; print "$_\r\n";};
       #        : print "\f";





       ,      
        Unix   
  . (       
   ,    .   
     ).


           
   --       
  PostScript       .  
    .     
      .    ,
          
     DeskJet   ,   
   ""  .


     _m_a_g_i_c-.    
  ,           -- 
        . APS Filter 
    ,    Linux   
   ,      .


  77..22..

     

    ,       
       .   
     ,     
    SGID      SUID root,     
   ,     . ( ,  
        lpd,    
  ).






  -r-sr-sr-x   1 root     lp    /usr/bin/lpr*
  -r-sr-sr-x   1 root     lp    /usr/bin/lprm*
  -rwxr--r--   1 root     root  /usr/sbin/lpd*
  -r-xr-sr-x   1 root     lp    /usr/sbin/lpc*
  drwxrwxr-x   4 root     lp    /var/spool/lpd/
  drwxr-xr-x   2 root     lp    /var/spool/lpd/lp/





     lpd      ,
           lp   .
       UID lp.lp  -  , 
      .


  88..

       

      (   
    )   MetaLab
  <ftp://metalab.unc.edu/pub/Linux/system/printing/>.   
  psutils, a2ps, mpage, dvitodvi, flpr  ..    
  .


       ,  
      .    
  ,          APS Filter,
   Andreas Klemm,     
  printcap       . 
          , 
  APS Filter     .


  99..

   

      .    
      .


  99..11..

  RReedd HHaatt

  Red Hat      GUI-,
          
  .      ghostscript 
     Unix     ,
        _/_e_t_c_/_p_r_i_n_t_c_a_p  
   magic-  PostScript--ascii   gs 
  nenscript.     ,    
     .


  Red Hat   ,    ,   
  Ghostscript,     , (  GNU , 
    Aladdin Ghostscript,   
   ).    ,
    (   online
  <http://www.picante.com/~gtaylor/pht/printer_list.cgi>),   
    ,      , 
   ,  Red Hat.    
    Red Hat,     Aladdin
  Ghostscript,    ,     
  apsfilter,      , 
    Ghostscript.



  99..22..

  DDeebbiiaann

  Debian     lpd  LPRng;  LPRng
    .  ,  Debian   
     ;  apsfilter  5  
      ,    
    LPRng   uniprint Ghostscript.


  99..33..

   

           
  .


  1100..

  GGhhoossttssccrriipptt

  Ghostscript       Linux.
       Unix 
  PostScript,       $100
      .    Ghostscript, 
           PostScript.
         lpd,   
   PostScript-    .


  Ghostscript    .   Ghostscript,
   Aladdin Ghostscript, m    
   ,     
    Linux.      
     Ghostscript;   , , 
      ,     
  Ghostscripts   .


    Ghostscript  GNU Ghostscript,   
    Aladdin Ghostscript    GNU.
  (  Aladdin   ;  
       
    ,      
     GPL).


        gs,       
      (-dSAFER).  PostScript 
   ,     PostScript 
     .


      PDF, (   Adobe)
         PostScript 
   . Ghostscript     PDF   
    PostScript.         
      PDF.


  1100..11..

    GGhhoossttssccrriipptt

   ghostscript   magic-,  
   (   apsfilter,    
     ),       
    .


  gs -help   ,     
   (,      
  ,     ).


     gs    : gs _o_p_t_i_o_n_s -q
  -dSAFER -sOutputFile=/dev/lp1 test.ps.


  1100..22..

    GGhhoossttssccrriipptt

           gs 
   (     ,  
    ).


  1100..22..11..

      

  ,       
   -   ghostscript.   
  ,      , 
         ,  
           
   .       ,  
       ,     
   .


  1100..22..22..

  ,,    ....

        ,   
   .      . 
      ,     
    .     
   lib ghostscript       gs  
   .        
     .      
  .       Floyd-Steinberg
    ,     (0.2 - 0.15)
     .






  ---8<---- gamma.ps ----8<---
  %!
  %transfer functions for cyan magenta yellow black
  {0.3 exp} {0.3 exp} {0.3 exp} {0.3 exp} setcolortransfer
  ---8<------------------8<---





     ,      
        .    
   ,      colorcir.ps,
      ghostscript (  examples/), 
   .


         
   ,    upp  , 
           
    .     ,  
   Postscript,     .



  1111..

      

     lpd         
  ,     .   
      ,    
   lpr       .


  1111..11..

     UUnniixx//llppdd

           , 
        _/_e_t_c_/_h_o_s_t_s_._e_q_u_i_v 
  _/_e_t_c_/_h_o_s_t_s_._l_p_d. (,  _h_o_s_t_s_._e_q_u_i_v    
    ;         
      ).    
          
    _r_s;    lpd  
     .


  1111..11..11..

    llppdd

            
     _/_e_t_c_/_p_r_i_n_t_c_a_p:



       #  djet500
       lp|dj|deskjet:\
               :sd=/var/spool/lpd/dj:\
               :rm=machine.out.there.com:\
               :rp=printername:\
               :lp=/dev/null:\
               :sh:

           
   lpd.      , 
             
      .


  1111..11..22..

    rrllpprr

      _r_l_p_r      
         lpd  
   .         
         .  
  _r_l_p_r:


  Rlpr  TCP/IP        lpd,
      .


     lpr,  __ _______     
        , ( 
  _/_e_t_c_/_p_r_i_n_t_c_a_p)        
    .


  rlpr        
  lpr,       BSD lpr.


    rlpr     ______ ______ ____
  ______          
  . Rlpr    ,    lpr, 
          netscape,
  xemacs,  ..,        
  .


  Rlpr   Metalab
  <ftp://metalab.unc.edu/pub/Linux/system/printing/>.


  1111..22..

    WWiinn9955,, WWiinnNNTT,, LLaannMMaannaaggeerr,,  SSaammbbaa

   "Printing to Windows mini-HOWTO"    
    .


     lpd   smbclient (
   Samba)    TCP/IP   SMB. Samba
     smbprint. ,  
          , 
      smbprint  _i_f-.


    _/_e_t_c_/_p_r_i_n_t_c_a_p   :







  lp|remote-smbprinter:\
      :lp=/dev/null:sh:\
      :sd=/var/spool/lpd/lp:\
      :if=/usr/local/sbin/smbprint:





        smbprint  
     


       smbclient   
      SMB      lpd. 
   .


  1111..33..

    NNeettWWaarree

    ncpfs    nprint, 
         smbprint,   NetWare.
     ncpfs  Metalab.     LSM 
    0.16:


         ncpfs      
       netware  Linux.       
       netware     netware  
        Linux.     1.2.x  1.3.54 
       . ncpfs      1.3.x  1.3.54.



      nprint   lpd,   
          
  NetWare,     _i_f-    lpd. 
   -  :



       sub2|remote-NWprinter:\
               :lp=/dev/null:sh:\
               :sd=/var/spool/lpd/sub2:\
               :if=/var/spool/lpd/nprint-script:





  nprint-script    :



       #! /bin/sh
       #       guest  !
       /usr/local/bin/nprint -S net -U name -P passwd -q printq-name -







  1111..44..

    EEtthheerrTTaallkk ((AAppppllee))

   netatalk  -  nprint  smbclient. 
           Apple 
     ;  Linux Netatalk-HOWTO
  <http://thehamptons.com/anders/netatalk/>.


  1111..55..

   HHPP   eetthheerrnneett--

   HP         
     ,  lpd.   
  ,         ,
        "" lpd.,  
          .  HP
     printcap :



       lj-5|remote-hplj:\
               :lp=/dev/null:sh:\
               :sd=/var/spool/lpd/lj-5:\
               :rm=printer.name.com:rp=raw:





   HP Laserjet   Jet Direct i  
     lpd -- "raw",   PCL ( 
  Postscript)  "text",    ascii ( 
     ).    JetDirect Plus3
  - ,    "raw1", "text2",  
  .


  ,   ISS    denial of service
  (DoS),     HP Jetdirect.  
      98.


     ,      
     PostScript,    
            
     ghostscript  .


        Linux    
   ,        
            
   -    - .  
  ,      HP Jetdirects, 
   ;    
  .


    ,     , 
     ethernet  HP LJ (  ).
        LAN,    
    Linux ( lj-5    ).


     HP      
     (banner page)  ; 
         
     telnet,    return,  "banner: 0" 
   "quit".   ,    
    ;  "?"    .


         
     HP WebJet
  <http://www.hp.com/go/webjetadmin>.      
   http    .    
  Java ,     HP,  
  . ,       Unix,
        rexec,  
  .        
  .


  1111..55..11..

     HHPP

    (   " ") 
         
   TCP .     
     JetDirect (   JetDirectEx). 
           TCP 
      ( 9100  9100, 9101  9102 
  - )       .
  LPRng (   ,     )
          
   TCP,    BSD lpd    .  
     Perl:
































  #!/usr/bin/perl
  # Thanks to Dan McLaughlin for writing the original version of this
  # script (And to Jim W. Jones for sitting next to Dan when writing me
  # for help ;)

  $fileName = @ARGV[0];

  open(IN,"$fileName") || die "Can't open file $fileName";

  $dpi300     = "\x1B*t300R";
  $dosCr      = "\x1B&k3G";
  $ends = "\x0A";

  $port =  9100 unless $port;
  $them = "bach.sr.hp.com" unless $them;

  $AF_INET = 2;
  $SOCK_STREAM = 1;
  $SIG{'INT'} = 'dokill';
  $sockaddr = 'S n a4 x8';

  chop($hostname = `hostname`);
  ($name,$aliases,$proto) = getprotobyname('tcp');
  ($name,$aliases,$port) = getservbyname($port,'tcp')
      unless $port =~ /^\d+$/;;
  ($name,$aliases,$type,$len,$thisaddr) =
          gethostbyname($hostname);
  ($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
  $this = pack($sockaddr, $AF_INET, 0, $thisaddr);
  $that = pack($sockaddr, $AF_INET, $port, $thataddr);

  if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
  #    print "socket ok\n";
  }
  else {
      die $!;
  }
  # Give the socket an address.
  if (bind(S, $this)) {
  #    print "bind ok\n";
  }
  else {
      die $!;
  }

  # Call up the server.

  if (connect(S,$that)) {
  #    print "connect ok\n";
  }
  else {
      die $!;
  }

  # Set socket to be command buffered.

  select(S); $| = 1; select(STDOUT);

  #    print S "@PJL ECHO Hi $hostname! $ends";
  #    print S "@PJL OPMSG DISPLAY=\"Job $whoami\" $ends";
  #    print S $dpi300;

  # Avoid deadlock by forking.

  if($child = fork) {
      print S $dosCr;
      print S $TimesNewR;

      while (<IN>) {
          print S;
      }
      sleep 3;
      do dokill();
  } else {
      while(<S>) {
          print;
      }
  }

  sub dokill {
      kill 9,$child if $child;
  }





  1111..66..

   iiff    

    lpd    _i_f    
  .     _i_f,    
       .  
    _p_r_i_n_t_c_a_p:



       lj-5:remote-hplj:\
               :lp=/dev/null:sh:\
               :sd=/var/spool/lpd/lj-5:\
               :if=/usr/lib/lpd/filter-lj-5:
       lj-5-remote:lp=/dev/null:sh:rm=printer.name.com:\
               :rp=raw:sd=/var/spool/lpd/lj-5-raw:





      filter-lj-5   :



       #!/bin/sh
       gs <options> -q -dSAFER -sOutputFile=- - | \
               lpr -Plj-5-remote -U$5





   _-_U lpr    lpr   ,  
         
  .       
    ,       
    .    _p_r_i_n_t_c_a_p.


  1111..77..

   WWiinnddoowwss

      Windows ( OS/2)   Linux 
    SMB   SAMBA,  
       Linux  
  Windows.


  Samba      .   
   magic-    Linux      
  PostScript        
    Windows     .  
   Windows       
   ,      
        Windows.    
  PostScript.


  1111..88..

   AAppppllee..

  Netatalk     Apple  EtherTalk.
    Netatalk HOWTO
  <http://thehamptons.com/anders/netatalk/>   
  .


  1111..99..

    NNeettwwaarree

   ncpfs    pserver,   
        NetWare.  
        Bindery  NetWare, ..
  2.x, 3.x,  4.x     bindery.


       ncpfs    pserver 
  FTP  ncpfs FTP <ftp://ftp.gwdg.de/pub/linux/misc/ncpfs/>.


  1122..

      WWiinnddoowwss

     ,     
  , -    ""   
  ,       
  ,       . 
          
    PCL,    .   (
  )       
   ,     
       (  
   ).


            
     .


  1122..11..

  -- GGhhoossttssccrriipptt  WWiinnddoowwss

        Windows ( mswinpr2),
       Ghostscript  
   . (    if  LPD  Unix).
     Ghostscript,    
   Windows GDI.   ,    
   Windows  PostScript     
  Windows,    .


      ,     
        Windows- 
     Linux,   Unix (    Windows,
  Mac,  ..)    "" .


          ,   
    ,        .
         
      Ghostscript (   
  Ghostscript  ).


  1122..22..

   ppbbmm22ppppaa

    HP  "Printing Performance Architecture"
  (   "    
   PCL).      
  pbm2ppa,  Tim Norman.    ghostscript 
   PostScript      pbm  
   pbm2ppa        
    ppa,     . 
         ghostscript.


     ppa     
   ppa <http://www.rpi.edu/~normat/technical/ppa/>; pbm2ppa
     HP 720, 820,  1000; 
  ,       
        ppa.


  1122..33..

   ppbbmm22ll77kk

      Lexmark  
         Windows. ,
  Henryk Paluch  ,     -
    Lexmark 7000.  ,     
           
  Lexmark.      
  <http://bimbo.fjfi.cvut.cz/~paluch/l7kdriver/>.



  1133..

     --

  1133..11..

   --

       ,  
      .     
   _H_y_l_a_F_a_x,  Sam Leffler,   ftp.sgi.com. 
         
   .


  SuSE   Java HylaFax,     
     Java ( Windows  Linux).  
  -   Java   ; Linux 
           .


            Linux
  efax,     .   getty --
  mgetty    (     
   !).


  1133..22..

     

    ,    
         -  
   ,       
  -   .   
  postscript,        ,
  ,        .  
         , 
  Remote Printing WWW Site <http://www.tpc.int/>.


  1144..

    --  

        .  
  Linux         
  : Linux/x86, Linux/Alpha, Linux/Sparc, Linux/foo, iBCS,
  Win16/Win32s (  dosemu , ,  Wine), Mac/68k (
  Executor),  Java.        Linux  
   Unix  .


    Linux,      
     Unix:


  1144..11..

   

          
   ,      
   ,    .


     nroff
              Unix.   --
              
          *roff;   ""  , 
        nroff ,     ,   
         ,        .
          ,      
          postscript   groff.   man 
              man -t foo | lpr.


     TTeeXX
        TeX,  - LaTeX,     
            Unix.   
          LaTeX, -    
           ___ ___     
        ,       .
          TeX  dvi,     PostScript
         Hewlett Packard PCL   dvips  dvilj.  
          TeX  LaTeX,    
        teTeX;    .


     SSGGMMLL
               (parser)
        sgml   Unix  Linux;     
         Linuxdoc-SGML.     
        DTD.


     HHTTMMLL
          ,     
             HTML    Netscape.
            ,   YMMV.


  1144..22..

     WWYYSSIIWWYYGG

         WYSIWYG 
     .    
  ,  ,    
   (StarOffice).


     SSttaarrOOffffiiccee
             StarOffice 
         Linux.        
               .  mini-
        HOWTO,        . 
           PostScript  PCL,    
             Linux.


     WWoorrddPPeerrffeecctt
         Corel     Word
        Perfect 8  Linux,  ,    
         Corel Draw  Quattro Pro,   
          linux.    ,   
        ARM ; Corel    ARM  Netwinder
        Linux      ARM Linux   
        .        
          ,    . 
            Linux WordPerfect
        <http://www.channel1.com/users/rodsmith/wpfonts.html> 
           WordPerfect   
        Ghostscript      (
             DOS WordPerfect,  
                
        WP8).


     AApppplliixx
        Applix     (, 
         , Windows   ),  
        Applix. Red Hat  SuSE  ,     "
         ";     Applix.


     LLyyXX
        LyX    LaTeX,   
        .    LyX
        <http://www.lyx.org>    . 
          LyX    KDE,  
        Klyx;  LyX    KDE --     
        .


     MMaaxxwweellll
        Maxwell    ,   
        MS RTF,      ,  
            GPL.


     TThhee AAnnddrreeww UUsseerr IInntteerrffaaccee SSyysstteemm (( 
         Andrew)" AUIS  ez,  WYSIWYG- 
            , 
           HTML    MIME   
         .   AUIS   .


     KKooffffiiccee
         KDE      
        .  ,        .
              LyX.


     GGNNOOMMEE
         GNOME      
            GNU.    
        .


        Jeff Phillips <jeff@I_RATUS.org>  Caldera WordPerfect
        7  Linux ( Slackware)      . 
              , 
          .  Caldera    
        <http://www.caldera.com/>.      
         Wordperfect   Corel,    Unix.


                
        .


  1155..

      

            
  .


  1155..11..

  PPoossttSSccrriipptt

  Ghostscript    X11,    
     PostScript,  Ghostview.
          
  PDF. ,  gv     "Ghostview";
         
    ghostview    Athena gui.


  1155..22..

  TTeeXX ddvvii

     (DeVice Independant)  TeX  
    X11   xdvi.   xdvi 
  ghostscript     PostScript.


     VT100.   dgvt. Tmview  
  Linux  svgalib,       .


  1155..33..  AAddoobbee PPDDFF

  Adobe Acrobat Reader   Linux;    
     <http://www.adobe.com/>.


      xpdf,   freeware   
   ,     Ghostview  
   PDF   gs  X11.


  1166..

      llppdd

  1166..11..

   pprriinnttccaapp

  Lpd   ,     
  _/_e_t_c_/_p_r_i_n_t_c_a_p       
  .    _p_r_i_n_t_c_a_p   
   _b_r_#, _f_c_#, _x_c_#, _f_s_# and _x_s_#.    
        
   .  _b_r_#     
  ,  `br#9600'.


       stty    printcap.
    ,     stty.


   stty    ,    
          
  .    ,  `_s_t_t_y _-_a'   
   .














  dina:/usr/users/andy/work/lpd/lpd# stty -a < /dev/ttyS2
  speed 9600 baud; rows 0; columns 0; line = 0;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
  eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
  lnext = ^V; min = 1; time = 0;
  -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
  -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr
  -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel
  -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
  bs0 vt0 ff0
  -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
  -tostop -echoprt -echoctl -echoke





           
     -clocal, -crtscts, and ixon.   
            
  .


      stty  .  stty
    ,     , 
         
    `<'   .


         stty,   `_c_a_t
  _f_i_l_e _> _/_d_e_v_/_t_t_y_S_2' (  )    ,
     /usr/src/linux/include/asm-i386/termbits.h. 
      #defines    (
         (   ,
    ?)     ).   
    :



       /* c_cflag bit meaning */
       #define CBAUD   0000017





       _f_c_#  _f_s_#.   
  ,    (  ) 
      stty.        ?


         a --    stty.
      (   ). 
        ,  
      _f_c_#.     
      ,     
   `fc#0177777' (  ).


        (   )
     a   --    stty.   
     CS8 (0000060), HUPCL (0002000),  CREAD (0000200).
         (  0000015).
    ,      0002275.    
   _f_s_# (`fs#02275'     ).

           
   , "c_lflag bits".      
  ,      `xc#0157777'  `xs#0'.


  1166..22..

       

  Jon Luckey ,      
       
  _____________     . 
  ,   FIFO    16550 
  Linux-   setserial   
   (        uart  8250
    ).


  1177..

  CCrreeddiittss

    smbprint   Marcel Roelofs <marcel@paragon.nl>.


    nprint    Netware  
  Michael Smith <mikes@bioch.ox.ac.uk>.


       lpd  Andrew Tefft
  <teffta@engr.dnet.ge.com>.


         gs   Andreas <quasi@hub-
  fue.franken.de>.


      30-   (closing_wait)
      Cris Johnson
  <cdj@netcom.com>.


  Robert Hart      
       HP,    
  .


      ,      
   ,      .

















