diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-11-01 23:41:49 +0100 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-11-01 23:41:49 +0100 |
commit | a993f53f4ab8e08bfa2c198d9375f85686e87c9f (patch) | |
tree | 56139307fe70528cf64dbc7ed700dad1b7dd4b98 /mactelnet.c | |
parent | 50d04396d84bcf0adf1b44223c4d751562639225 (diff) | |
download | MAC-Telnet-a993f53f4ab8e08bfa2c198d9375f85686e87c9f.tar.gz MAC-Telnet-a993f53f4ab8e08bfa2c198d9375f85686e87c9f.zip |
Minior fix: Move mac-address code downwards according to the order of arguments. So problems with the ifname will be reported before problems with the mac address/identity name.
Diffstat (limited to 'mactelnet.c')
-rw-r--r-- | mactelnet.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/mactelnet.c b/mactelnet.c index 936fb8e..652023b 100644 --- a/mactelnet.c +++ b/mactelnet.c @@ -303,34 +303,6 @@ int main (int argc, char **argv) { strncpy(devicename, argv[optind++], sizeof(devicename) - 1); devicename[sizeof(devicename) - 1] = '\0'; - /* Check for identity name or mac address */ - { - unsigned char *p = argv[optind]; - int colons = 0; - while (*p++) { - if (*p == ':') { - colons++; - } - } - - if (colons != 5) { - fprintf(stderr, "Searching for '%s'...", argv[optind]); - - /* Search for Router by identity name, using MNDP */ - if (!queryMNDP(argv[optind], dstmac)) { - fprintf(stderr, "not found.\n"); - return 1; - } - - /* Router found, display mac and continue */ - fprintf(stderr, "%s\n", ether_ntoa((struct ether_addr *)dstmac)); - - } else { - /* Convert mac address string to ether_addr struct */ - ether_aton_r(argv[optind], (struct ether_addr *)dstmac); - } - } - /* Seed randomizer */ srand(time(NULL)); @@ -387,6 +359,34 @@ int main (int argc, char **argv) { return 1; } + /* Check for identity name or mac address */ + { + unsigned char *p = argv[optind]; + int colons = 0; + while (*p++) { + if (*p == ':') { + colons++; + } + } + + if (colons != 5) { + fprintf(stderr, "Searching for '%s'...", argv[optind]); + + /* Search for Router by identity name, using MNDP */ + if (!queryMNDP(argv[optind], dstmac)) { + fprintf(stderr, "not found.\n"); + return 1; + } + + /* Router found, display mac and continue */ + fprintf(stderr, "%s\n", ether_ntoa((struct ether_addr *)dstmac)); + + } else { + /* Convert mac address string to ether_addr struct */ + ether_aton_r(argv[optind], (struct ether_addr *)dstmac); + } + } + if (!haveUsername) { int ret=0; printf("Login: "); |