From owner-freebsd-questions@FreeBSD.ORG Wed Sep 24 10:58:06 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE5D4106567C for ; Wed, 24 Sep 2008 10:58:06 +0000 (UTC) (envelope-from andy.kosela@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id 860F78FC28 for ; Wed, 24 Sep 2008 10:58:06 +0000 (UTC) (envelope-from andy.kosela@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2268638rvf.43 for ; Wed, 24 Sep 2008 03:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=UDDiLQYBuuQHlui1F2xYRv2ZhjGHmA6ET5QcIVdRVi8=; b=OXQ51kND/61U/JbvkLtc1FLHhpKDnYF9yr9trQ7aSThV9LaKIf3BzecPqWOxP9b3pa TjVLe6N78QYOuqHAeeWCwC0fCEbnzz4liPhbYSK7M8pz9oIDWoLUEvotl3AmZMenrPfQ /KiXPh0WV7jT4+o4Z6KVb+bO/O7MlwaNTtldM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=eMdjtIiEeKZ6eFng4+dS1hJTqi98TIWZNW+J98K0n/HR2Qa8NxAfkDpfwL0Czd3GsJ DahGsx4f0Hhhq9gvUSaQnIcNpvjGBghmxB4v4PNc35fnfTgKVeRUfsZy9dfeNlJk6S5V K/aYp1WxwJMBTlzdO9EShMcS4UTV3AAhjC9oc= Received: by 10.140.141.16 with SMTP id o16mr3346667rvd.209.1222252409220; Wed, 24 Sep 2008 03:33:29 -0700 (PDT) Received: by 10.141.196.7 with HTTP; Wed, 24 Sep 2008 03:33:29 -0700 (PDT) Message-ID: <3cc535c80809240333s1036386fnaa597267f0cf12aa@mail.gmail.com> Date: Wed, 24 Sep 2008 12:33:29 +0200 From: "Andy Kosela" Sender: andy.kosela@gmail.com To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 987bbc38f7c6a8f2 Subject: Netprint perl script from Handbook doesn't work X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 10:58:06 -0000 The netprint perl script provided in the Handbook (9.4.3.2) is not working.. or am I missing something: plotinus:~> cat new.txt | lp.sh Can't contact 10.10.21.12: Address family not supported by protocol family at /usr/local/libexec/netprint line 21. plotinus:> cat /usr/local/libexec/netprint #!/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; System is 7.0-RELEASE, I got to say it was working on 6.2-RELEASE Best Regards, Andy Kosela