summaryrefslogtreecommitdiff
path: root/networking/nslookup.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-15 16:34:54 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-15 16:34:54 +0000
commit5e1189e187f6a7957dadb8eda2c271c4a0777a23 (patch)
tree140cd30d77342c730afbc1df863bec93c63978a8 /networking/nslookup.c
parent95c1c1e05f290ccbcc2ff863a62bcee5d57bf5c8 (diff)
downloadbusybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.tar.gz
busybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.tar.bz2
busybox-w32-5e1189e187f6a7957dadb8eda2c271c4a0777a23.zip
More documentation updates, and minor fixes to make things sync
up with the docs. -Erik
Diffstat (limited to 'networking/nslookup.c')
-rw-r--r--networking/nslookup.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 15019e935..3223b3b63 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -41,7 +41,7 @@
41 | + find out how the real nslookup gets the default name server 41 | + find out how the real nslookup gets the default name server
42 */ 42 */
43 43
44static const char nslookup_usage[] = "nslookup [HOST]\n\n"; 44static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n";
45 45
46 46
47/* I have to see how the real nslookup does this. 47/* I have to see how the real nslookup does this.
@@ -50,8 +50,8 @@ static const char nslookup_usage[] = "nslookup [HOST]\n\n";
50 */ 50 */
51static void server_fprint(FILE * dst) 51static void server_fprint(FILE * dst)
52{ 52{
53 fprintf(dst, "Server: %s\n", "something"); 53 fprintf(dst, "Server: %s\n", "default");
54 fprintf(dst, "Address: %s\n\n", "something"); 54 fprintf(dst, "Address: %s\n\n", "default");
55} 55}
56 56
57/* only works for IPv4 */ 57/* only works for IPv4 */
@@ -96,9 +96,9 @@ static int addr_list_fprint(char **h_addr_list, FILE * dst)
96{ 96{
97 int i, j; 97 int i, j;
98 char *addr_string = (h_addr_list[1]) 98 char *addr_string = (h_addr_list[1])
99 ? "Addresses" : "Address"; 99 ? "Addresses: " : "Address: ";
100 100
101 fprintf(dst, "%s: ", addr_string); 101 fprintf(dst, "%s ", addr_string);
102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) { 102 for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
103 addr_fprint(h_addr_list[i], dst); 103 addr_fprint(h_addr_list[i], dst);
104 104
@@ -132,7 +132,7 @@ static struct hostent *gethostbyaddr_wrapper(const char *address)
132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst) 132static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
133{ 133{
134 if (host) { 134 if (host) {
135 fprintf(dst, "Name: %s\n", host->h_name); 135 fprintf(dst, "Name: %s\n", host->h_name);
136 addr_list_fprint(host->h_addr_list, dst); 136 addr_list_fprint(host->h_addr_list, dst);
137 } else { 137 } else {
138 fprintf(dst, "*** %s\n", hstrerror(h_errno)); 138 fprintf(dst, "*** %s\n", hstrerror(h_errno));
@@ -159,7 +159,7 @@ int nslookup_main(int argc, char **argv)
159{ 159{
160 struct hostent *host; 160 struct hostent *host;
161 161
162 if (argc < 2) { 162 if (argc < 2 || *argv[1]=='-') {
163 usage(nslookup_usage); 163 usage(nslookup_usage);
164 } 164 }
165 165
@@ -170,7 +170,7 @@ int nslookup_main(int argc, char **argv)
170 host = gethostbyname(argv[1]); 170 host = gethostbyname(argv[1]);
171 } 171 }
172 hostent_fprint(host, stdout); 172 hostent_fprint(host, stdout);
173 return 0; 173 exit( TRUE);
174} 174}
175 175
176/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */ 176/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */