> From [EMAIL PROTECTED] Sat Feb 23 02:33:34 2002
> From: "Arie J. Gerszt" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: 
> Date: Sat, 23 Feb 2002 11:35:10 +0100
>
> Hi
>
> I am looking vor an LPR solution for the following problem:
>
> In a school with lots of computer rooms and printers we would like
> to have 1 central printer server. All incoming printer jobs should
> be redirected upon the sender's ip address to the appropiate printer,
> so that a user never has to select the right printer.
>
> Can this be solved through lpr?
>
> Thank you
> Arie
>

This is done using the 'chooser' and 'force_ipaddr_hostname' function or facility:

lp:lp=/dev/null
  :chooser=|/this/is/the/chooser/script
  :force_ipaddr_hostname

The force_ipaddr_hostname forces the hostname value in the
control file to be the IP address of the job originator.
The control file is provided in the CONTROL_FILE environment
variable and the -H command line argument.  You can now do something like:

# perl script...
my @cf = split("\n",$ENV{CONTROL_FILE} );
my $ipaddr;
foreach (@cf){
        if( /^H/ ){
                $ipaddr = $_;
                $ipaddr =~ s/^HIPADDR//;
                last;
        }
}

# now you have the IPAddress
my $choices = { 10.0.0.1 => "pr1@server", ... }

my $choice = $choices->{$ipaddr}

print "$choice\n";

--- the usually error handling, defaults, etc. are left
  as an exercise for the reader.

Patrick

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to