Userland "dig/host" for lookups against /etc/hosts?
Christopher Nehren
apeiron+usenet at coitusmentis.info
Sun Mar 27 22:30:29 PST 2005
-----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.
More information about the freebsd-questions
mailing list