PSF/AIX: How do you print from an HP-UX to 3160

ITEM: RTA000106654



Q:                                                                              
ABSTRACT:     PSF/AIX: HOW DO YOU PRINT FROM AN HP-UX TO 3160                   
              ETHERNET-ATTACHED PRINTERS?                                       
SEARCH ARG:   hp psf/aix                                                        
TOPIC THREAD: PRINT                                                             
              PSF/AIX                                                           
..                                                                              
I have recommended two 3160 Ethernet attached printers and PSF/AIX for          
printing from HP-UX.  My customer wants to simply know how to print             
with AFP resources from the HP.  What commands do the end users key in          
or what alternatives do they have.  For instance, lprafp is something           
I read about in searching the ASKQ database, but I can't explain what           
you do at the HP or how it goes to the PSF/AIX server.  Thanks for              
your help.                                                                      
                                                                               
A:                                                                              
Provided with PSF for AIX is sample source code (written in ANSI C)             
that Boulder has compiled and tested on several non-IBM UNIX platforms,         
including HP-UX.  It's best described in the README file that ships             
with the code, and I'll include that below.  While the README discusses         
one way to use this (through the LPR shell script with or without the           
-a flag), I often use lprafp itself directly according to the syntax            
at the bottom of the README.  The benefit of using the shell script             
approach is that users on the client system, in this case HP-UX, don't          
have to learn a new command like lprafp with its syntax; the                    
administrator merely renames the LPR shell script to whatever print             
command those clients generally use and inform the users of the new             
flag for their familiar command.  Note that they will need a C                  
compiler on their HP-UX system to compile this code.                            
                                                                               
I hope this helps.                                                              
                                                                                
----------------------------------------------------------------------          
                            LPR sample code README                              
                            PSF/AIX - Release 1.2                               
                                August 22, 1994                                 
                                                                                
This file explains the LPR sample code provided by PSF/AIX.                     
                                                                                
##*********************************************************************/        
##                                                                    */        
##   THIS PROGRAM IS PROVIDED ON AN "AS-IS" BASIS AND NO              */        
##   SUPPORT OR MAINTENANCE WILL BE PROVIDED WITH RESPECT TO THIS     */        
##   PROGRAM SAMPLE.  The licensee of the PSF product is free to      */        
##   copy, revise, modify, and make derivative works of this program  */       
##   sample as they see fit.                                          */        
##   The licensee of this sample code may not resell this code or     */        
##   include it in a product that is resold.                          */        
##                                                                    */        
##*********************************************************************/        
                                                                                
PURPOSE OF THIS PROGRAM SAMPLE:                                                 
-------------------------------                                                 
  This program sample provides a mechanism for UNIX (non-AIX or                 
  non-RISC System/AIX) customers to submit remote print jobs with               
  optional parameters using the -o flag.  This program enables a user           
  to print remote jobs submitted from UNIX machines to a RISC System/AIX        
  that is running AIX and PSF/AIX.  The -o flags that are interpreted by        
  PSF/AIX can be sent with the remote print job.                                
                                                                               
  With this new sample code a customer can submit a job using a shell           
  script we provide called LPR.  If LPR is invoked with the -A flag             
  then the "lprafp" program we provide is invoked.  The lprafp program          
  enables the passing of -o parameters to PSF/AIX.  If LPR is invoked           
  without the -A flag then the customer's standard print command                
  will be invoked.                                                              
                                                                                
FILES INCLUDED IN THIS PROGRAM SAMPLE:                                          
--------------------------------------                                          
  Makefile      - used by the make facility to generate the executable          
  README        - this file                                                     
  getopts.c     - source code                                                   
  getopts.h     - source code header file                                       
  LPR           - shell script that invokes the system print                    
                  command when the -A flag is not issued                       
                  or the lprafp executable when the -A flag is issued           
  lprafp.c      - source code                                                   
  lprafp.h      - source code header file                                       
                                                                                
INSTALLATION DIRECTIONS:                                                        
------------------------                                                        
                                                                                
 NOTE:  In order to compile and install this sample code, you must have         
        an ANSI C compiler installed on the CLIENT system.  The Makefile        
        included with this sample indicates the path to a typical               
        installation for each type of system, but yours may vary.               
                                                                                
                                                                                
   On the PSF/AIX SERVER:                                                       
   -----------------------                                                     
                                                                                
        1) Log in as 'root'.                                                    
                                                                                
        2) Ensure that the TCP/IP line printer daemon (lpd) is installed        
           and running.                                                         
                                                                                
        3) Add the name or address of the remote client to the                  
           /etc/hosts.lpd file.  If you are not using name service,             
           you should fully qualify the name of the client by using             
           its TCP/IP domain (eg. 'alexandria.biz.office1.com'), or             
           by using dotted-decimal notation (eg. '1.23.456.789');               
           otherwise, just the name of the host should suffice.                 
                                                                                
        4) DONE                                                                 
                                                                               
        NOTE:  You may choose to use IBMs System Management Interface           
               Tool (SMIT) to perform the above tasks on an AIX host.           
                                                                                
                                                                                
   On the UNIX CLIENT(s):                                                       
   ----------------------                                                       
                                                                                
        1) Log in as 'root'.                                                    
                                                                                
        2) Copy the program sample directory to the client system.              
           This directory is found under '/usr/lpp/psf/utils/lpr'               
           on the PSF/AIX server, or where you found the file you're            
           now reading.                                                         
                                                                                
        3) Change to the program sample directory you just copied.             
                                                                                
        4) Modify the Makefile file as appropriate for your system.             
           (Uncomment those lines specific to the system.)                      
                                                                                
        5) Type 'make'.  This will compile 'lprafp' and set its                 
           permissions and owner/group.  This executable must run as            
           root, so the setuid bit is turned on.                                
                                                                                
        6) In the program sample directory, make a copy of the LPR              
           shell script using the same name as the 'native' print               
           command on your system (lp, enq, etc.).                              
                                                                                
        7) To use the "native" print command on your system modify              
           the next-to-last line in your renamed LPR shell script.              
           Fully qualify the path to the native print command.  This is        
           the command that will be used if the -A flag is not invoked.         
           (see example below for testing the native print command)             
           If the -A flag is used the lprafp program that you compiled          
           in step 5) will be called.                                           
                                                                                
        8) Test the system:                                                     
                                                                                
                1) Log into the CLIENT system as a normal user.                 
                2) Change to the program sample directory (or add it to         
                   your execution search path).                                 
                3) Print a sample file to a PSF queue on the remote             
                   system, by using the -A flag in conjunction with the         
                   'native' print command (see example documented               
                   later).                                                      
                                                                               
        9) Make sure the renamed LPR shell script is found first in the         
           (system/user's) execution search path (change the default            
           shell configuration files).  Notify your user base of the            
           change and instruct them to add this path to their shell             
           configuration files.                                                 
                                                                                
       10) DONE                                                                 
                                                                                
SAMPLE SOURCE CODE TESTED ON THE FOLLOWING SYSTEMS:                             
---------------------------------------------------                             
   AIX 3.2.5                                                                    
   HP,  HP-UX                                                                   
   Sun, SunOS 5.1.1                                                             
   Sun, Solaris 1.1.1                                                           
   DEC, ULTRIX V4.3A                                                           
                                                                                
EXAMPLES:                                                                       
---------                                                                       
                                                                                
  1) To print two copies of /etc/motd without a trailer page on                 
     a PSF queue named "laser" on server "alexandria":                          
                                                                                
        LPR -A -ocopies=2 -otrailer=no -s alexandria -p laser /etc/motd         
                                                                                
  2) To set up environment so that subsequent print requests are sent           
     to the PSF queue named "laser" on server "alexandria":                     
     (Note that server can be in dotted address format; for example             
     9.99.9.99)                                                                 
                                                                                
        LPR_PRINTER=laser                                                      
        export LPR_PRINTER                                                      
        LPR_SERVER=alexandria                                                   
        export LPR_SERVER                                                       
                                                                                
     To test that your environment variables have been set correctly:           
        LPR -A /etc/motd                                                        
                                                                                
   3) To print a file /etc/motd to the standard local print command             
      do not use the -A flag:                                                   
                                                                                
        LPR /etc/motd                                                           
                                                                                
lprafp USAGE statement:                                                         
-----------------------                                                         
If a user types "LPR -A -?" then the lprafp program is invoked and the         
following usage statement is displayed.  If a user types "LPR -?" then          
the system print command is invoked and its usage statement is                  
displayed.                                                                      
                                                                                
Usage:                                                                          
  lprafp -?                                                                     
  lprafp (-n) (-o