From owner-freebsd-questions Fri Apr 26 07:50:55 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id HAA11838 for questions-outgoing; Fri, 26 Apr 1996 07:50:55 -0700 (PDT) Received: from fslg8.fsl.noaa.gov (fslg8.fsl.noaa.gov [137.75.131.171]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id HAA11833 Fri, 26 Apr 1996 07:50:52 -0700 (PDT) Received: by fslg8.fsl.noaa.gov (5.57/Ultrix3.0-C) id AA04545; Fri, 26 Apr 96 14:49:41 GMT Message-Id: <9604261449.AA04545@fslg8.fsl.noaa.gov> Received: by emu.fsl.noaa.gov (1.40.112.3/16.2) id AA067680179; Fri, 26 Apr 1996 08:49:39 -0600 Date: Fri, 26 Apr 1996 08:49:39 -0600 From: Sean Kelly To: mnewell@kaizen.net Cc: rjs@asd.banctec.com, gpalmer@freebsd.org, ptroot@uswest.com, questions@freebsd.org In-Reply-To: (message from Mike Newell on Fri, 26 Apr 1996 10:11:30 -0400 (EDT)) Subject: Re: Net connected printer Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >>>>> "Mike" == Mike Newell 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_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 () { print PRINTER; } exit 0;