| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Reply-To: | <litterio AT pyxsys DOT net> |
| From: | "Francis Litterio" <litterio AT pyxsys DOT net> |
| To: | "'C. Porter Bassett'" <cporter AT byu DOT edu>, <cygwin AT cygwin DOT com> |
| Subject: | RE: IP Lookup command |
| Date: | Thu, 31 May 2001 13:52:05 -0400 |
| Message-ID: | <000f01c0e9fa$6866fe90$4500f98c@EMMAROSE> |
| MIME-Version: | 1.0 |
| X-Priority: | 3 (Normal) |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
| Importance: | Normal |
| In-Reply-To: | <001c01c0e9f5$dc233c90$0a00a8c0@PWORK> |
Try this quick hack. It works for me under Cygwin 1.3.1:
#include <stdio.h>
#include <netdb.h>
int main(int argc, char * argv[])
{
char ** addrlistelem;
struct hostent * hostinfo;
hostinfo = gethostbyname(argv[1]);
if (hostinfo == NULL)
{
fputs("unknown host\n", stderr);
exit(1);
}
addrlistelem = hostinfo->h_addr_list;
while (*addrlistelem)
{
char * address = *addrlistelem;
printf("%u.%u.%u.%u\n", address[0] & 0xff, address[1] & 0xff,
address[2] & 0xff, address[3] & 0xff);
addrlistelem++;
}
exit(0);
}
-----Original Message-----
From: cygwin-owner AT sources DOT redhat DOT com
[mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of C. Porter Bassett
Sent: Thursday, May 31, 2001 1:20 PM
To: cygwin AT cygwin DOT com
Subject: IP Lookup command
I need a command that I can call in the following manner:
$ unknown_command host_on_my_network
192.168.20.119
$
At least here on my network, neither nslookup nor host work, although
they
will go outside of my network and work just fine. Ping manages to find
local computers in the way that I am looking for. Should I just pass
ping
though some filter?
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |