Date: Fri, 26 Apr 1996 08:49:39 -0600 From: Sean Kelly <kelly@fsl.noaa.gov> To: mnewell@kaizen.net Cc: rjs@asd.banctec.com, gpalmer@freebsd.org, ptroot@uswest.com, questions@freebsd.org Subject: Re: Net connected printer Message-ID: <9604261449.AA04545@fslg8.fsl.noaa.gov> In-Reply-To: <Pine.SGI.3.92.960426100518.1622B-100000@dada.kaizen.net> (message from Mike Newell on Fri, 26 Apr 1996 10:11:30 -0400 (EDT))
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Mike" == Mike Newell <mnewell@kaizen.net> writes: Mike> I'll include the source for the driver I've been using. Mike> Works fine to my lj4simx. And here's the perl code from the handbook that I should do the same thing. Invoke as `netprint hostname portnum', reads stdin, writes to printer. Suitable for use in any LPD filter: #!/usr/bin/perl # # netprint - Text filter for printer attached to network # Installed in /usr/local/libexec/netprint # $#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>"; $printer_host = $ARGV[0]; $printer_port = $ARGV[1]; require 'sys/socket.ph'; ($ignore, $ignore, $protocol) = getprotobyname('tcp'); ($ignore, $ignore, $ignore, $ignore, $address) = gethostbyname($printer_host); $sockaddr = pack('S n a4 x8', &AF_INET, $printer_port, $address); socket(PRINTER, &PF_INET, &SOCK_STREAM, $protocol) || die "Can't create TCP/IP stream socket: $!"; connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!"; while (<STDIN>) { print PRINTER; } exit 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9604261449.AA04545>