From owner-freebsd-questions@FreeBSD.ORG Mon Mar 28 06:30:29 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A48F416A4CE for ; Mon, 28 Mar 2005 06:30:29 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7CE243D41 for ; Mon, 28 Mar 2005 06:30:28 +0000 (GMT) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DFnkc-0005kP-A4 for freebsd-questions@freebsd.org; Mon, 28 Mar 2005 08:29:26 +0200 Received: from pcp08490587pcs.levtwn01.pa.comcast.net ([68.83.169.224]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Mar 2005 08:29:26 +0200 Received: from apeiron+usenet by pcp08490587pcs.levtwn01.pa.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Mar 2005 08:29:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Christopher Nehren Date: Mon, 28 Mar 2005 06:29:20 +0000 (UTC) Organization: /usr/bin/false Lines: 38 Message-ID: References: <200503280717.41037@harrymail> X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pcp08490587pcs.levtwn01.pa.comcast.net User-Agent: slrn/0.9.8.1 (FreeBSD) Sender: news Subject: Re: Userland "dig/host" for lookups against /etc/hosts? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2005 06:30:29 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2005-03-28, Emanuel Strobl scribbled these curious markings: > Is there one? Unfortunately I can't write one myself, at least not > in a reasonable amount of time.... - --cut-- #!/usr/bin/perl -w use strict; use Socket; my $host = shift or die "usage: hostshost hostname\n"; my $addr = gethostbyname($host); die "Cannot resolve host '$host'.\n" unless defined $addr; my $ip = inet_ntoa($addr); print "$host has address $ip\n"; - --cut-- Needs some 5.x version of Perl. Works with 5.005_03 as shipped in FreeBSD 4.x. Also works with more recent perls. Best Regards, Christopher Nehren -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCR6Rpk/lo7zvzJioRAg8pAJ4s69gjARzlc/ZL5sNKT2vSYa9XFwCbBILr ehnDiO3MuDC3b3nryMUx+Ws= =Z9c9 -----END PGP SIGNATURE----- -- I abhor a system designed for the "user", if that word is a coded pejorative meaning "stupid and unsophisticated". -- Ken Thompson If you ask the wrong questions, you get answers like "42" and "God". Unix is user friendly. However, it isn't idiot friendly.