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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of C. Porter Bassett
Sent: Thursday, May 31, 2001 1:20 PM
To: [EMAIL PROTECTED]
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

Reply via email to