diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2011-02-24 16:46:30 +0100 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2011-02-24 16:46:30 +0100 |
commit | cb6fe86292fd85a67dfd930cdc351fec0ddf96bc (patch) | |
tree | 1c60d781bddc739e66473a7a1d649e17da63970e /mactelnet.c | |
parent | f77147c698364fb38c226895556176abd61d3217 (diff) | |
download | MAC-Telnet-cb6fe86292fd85a67dfd930cdc351fec0ddf96bc.tar.gz MAC-Telnet-cb6fe86292fd85a67dfd930cdc351fec0ddf96bc.zip |
Code cleanup
Diffstat (limited to 'mactelnet.c')
-rw-r--r-- | mactelnet.c | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/mactelnet.c b/mactelnet.c index e69c88f..2b2f74a 100644 --- a/mactelnet.c +++ b/mactelnet.c @@ -461,50 +461,10 @@ int main (int argc, char **argv) { /* Need to use, to be able to autodetect which interface to use */ setsockopt(insockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval)); - /* Check for identity name or mac address */ - { - char *p = argv[optind]; - int colons = 0; - int dashs = 0; - while (*p++) { - if (*p == ':') { - colons++; - } - else if (*p == '-') { - dashs++; - } - } - - /* - * Windows users often enter macs with dash instead - * of colon. - */ - if (colons == 0 && dashs == 5) { - p = argv[optind]; - while (*p++) { - if (*p == '-') { - *p = ':'; - } - } - colons = dashs; - } - - if (colons != 5) { - fprintf(stderr, "Searching for '%s'...", argv[optind]); - - /* Search for Router by identity name, using MNDP */ - if (!query_mndp(argv[optind], dstmac)) { - fprintf(stderr, "not found\n"); - return 1; - } - - /* Router found, display mac and continue */ - fprintf(stderr, "found\n"); - - } else { - /* Convert mac address string to ether_addr struct */ - ether_aton_r(argv[optind], (struct ether_addr *)dstmac); - } + /* Get mac-address from string, or check for hostname via mndp */ + if (!query_mndp_verbose(argv[optind], dstmac)) { + /* No valid mac address found, abort */ + return 1; } if (!have_username) { |