summaryrefslogtreecommitdiff
path: root/mactelnet.c
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-12-25 23:20:32 +0100
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-12-25 23:20:32 +0100
commit52edeba4b440aa0cc84d458caa40fb40f8488a63 (patch)
treefe5d94ebb6f0e98e4b2e42292fa5eff859c8f9ed /mactelnet.c
parent25476c74e2fe93163e50f41a0dc15b3088c6f65f (diff)
downloadMAC-Telnet-52edeba4b440aa0cc84d458caa40fb40f8488a63.tar.gz
MAC-Telnet-52edeba4b440aa0cc84d458caa40fb40f8488a63.zip
Add support for dash-seperated mac addresses
Diffstat (limited to 'mactelnet.c')
-rw-r--r--mactelnet.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mactelnet.c b/mactelnet.c
index 236d5f9..37fb026 100644
--- a/mactelnet.c
+++ b/mactelnet.c
@@ -439,10 +439,28 @@ int main (int argc, char **argv) {
{
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) {