diff options
author | Richard Sharpe <sharpe@samba.org> | 1999-02-02 23:01:08 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 1999-02-02 23:01:08 +0000 |
commit | 95f5b9724e1e4b5e2fe3a8e2ffee8a697aec5d25 (patch) | |
tree | 3b47c2a55c3dc5b65fb01df8a53ed1f104248428 /source | |
parent | f218a32646793e7d2f5dc7d9ceb49b7cbc3dd4da (diff) | |
download | samba-95f5b9724e1e4b5e2fe3a8e2ffee8a697aec5d25.tar.gz |
Minor changes to the usage message in neblookup to explain what
nmblookup -M -
does.
Also added a -T flag, which forces the translation of IP addresses to
names. Not [yet] the default.
Diffstat (limited to 'source')
-rw-r--r-- | source/utils/nmblookup.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c index 23415a0ca68..a066b072644 100644 --- a/source/utils/nmblookup.c +++ b/source/utils/nmblookup.c @@ -79,11 +79,13 @@ static void usage(void) printf("\t-M searches for a master browser\n"); printf("\t-R set recursion desired in packet\n"); printf("\t-S lookup node status as well\n"); + printf("\t-T translate IP addresses into names\n"); printf("\t-r Use root port 137 (Win95 only replies to this)\n"); printf("\t-A Do a node status on <name> as an IP Address\n"); printf("\t-i NetBIOS scope Use the given NetBIOS scope for name queries\n"); printf("\t-s smb.conf file Use the given path to the smb.conf file\n"); printf("\t-h Print this help message.\n"); + printf("\n if name is \"-\", lookup __MSBROWSE__<01>\n"); printf("\n"); } @@ -107,6 +109,7 @@ int main(int argc,char *argv[]) BOOL got_bcast = False; BOOL lookup_by_ip = False; BOOL recursion_desired = False; + BOOL translate_addresses = False; DEBUGLEVEL = 1; *lookup = 0; @@ -117,7 +120,7 @@ int main(int argc,char *argv[]) charset_initialise(); - while ((opt = getopt(argc, argv, "d:B:U:i:s:SMrhAR")) != EOF) + while ((opt = getopt(argc, argv, "d:B:U:i:s:SMrhART")) != EOF) switch (opt) { case 'B': @@ -132,6 +135,9 @@ int main(int argc,char *argv[]) got_bcast = True; use_bcast = False; break; + case 'T': + translate_addresses = !translate_addresses; + break; case 'i': fstrcpy(scope,optarg); strupper(scope); @@ -224,9 +230,15 @@ int main(int argc,char *argv[]) if ((ip_list = name_query(ServerFD,lookup,lookup_type,use_bcast, use_bcast?True:recursion_desired, bcast_addr,&count,NULL))) { - for (j=0;j<count;j++) + for (j=0;j<count;j++) { + if (translate_addresses) { + struct hostent *host = gethostbyaddr((char *)&ip_list[j], sizeof(ip_list[j]), AF_INET); + if (host) + printf("%s, ", host -> h_name); + } printf("%s %s<%02x>\n",inet_ntoa(ip_list[j]),lookup, lookup_type); - + } + /* We can only do find_status if the ip address returned was valid - ie. name_query returned true. */ |