diff options
author | Eric Andersen | 1999-11-13 04:47:09 +0000 |
---|---|---|
committer | Eric Andersen | 1999-11-13 04:47:09 +0000 |
commit | b6a44b8d39b7834ab9f6c43938f4b58f135e846e (patch) | |
tree | d9bd903d4e30ea4faf1977a514853c5aac83690c /mnc.c | |
parent | eded54bd96ed0394844f9ba23c5ab54dff8a917f (diff) | |
download | busybox-b6a44b8d39b7834ab9f6c43938f4b58f135e846e.zip busybox-b6a44b8d39b7834ab9f6c43938f4b58f135e846e.tar.gz |
updates for the day
Diffstat (limited to 'mnc.c')
-rw-r--r-- | mnc.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -40,8 +40,8 @@ #define BUFSIZE 100 static const char mnc_usage[] = -"mini-netcat 0.0.3 -- Open pipe to IP:port\n" -"\tmnc [IP] [port]\n"; +"mnc [IP] [port]\n\n" +"mini-netcat opens a pipe to IP:port\n"; int mnc_main(int argc, char **argv) @@ -56,9 +56,15 @@ mnc_main(int argc, char **argv) fd_set readfds, testfds; + if (argc<=1 || **(argv+1) == '-' ) { + usage( mnc_usage); + } + argc--; + argv++; + sfd = socket(AF_INET, SOCK_STREAM, 0); - hostinfo = (struct hostent *) gethostbyname(argv[1]); + hostinfo = (struct hostent *) gethostbyname(*argv); if (!hostinfo) { @@ -67,7 +73,7 @@ mnc_main(int argc, char **argv) address.sin_family = AF_INET; address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; - address.sin_port = htons(atoi(argv[2])); + address.sin_port = htons(atoi(*(++argv))); len = sizeof(address); |