summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.pp.se>2004-08-29 18:44:15 +0000
committerThomas Habets <thomas@habets.pp.se>2004-08-29 18:44:15 +0000
commit4bdc0101b9789324258dc407fb7a779db11c45e6 (patch)
tree7dc771f2e678dea92a12c1cc691819d0d7598adb
parent61548aff79e61cb678ea80971a2281ffb2cb4468 (diff)
downloadarping-4bdc0101b9789324258dc407fb7a779db11c45e6.tar.gz
.
-rw-r--r--Makefile5
-rw-r--r--arping-2/arping.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c527824..4e01d60 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 1063 2004-02-02 00:37:34Z marvin $
+# $Id: Makefile 1124 2004-08-29 18:44:15Z marvin $
TARGETS=arping
CD=cd
@@ -102,7 +102,7 @@ O_arping2=arping-2/arping.c
arping2: arping-2/arping
arping-2/arping: $(O_arping2)
# $(CC) `libnet-config --libs --defines --cflags` -o arping arping-2/arping.c -lnet -lpcap
- $(CC) -o arping arping-2/arping.c -lnet -lpcap $(EXTRA_LIBS)
+ $(CC) -g -o arping arping-2/arping.c -lnet -lpcap $(EXTRA_LIBS)
clean:
rm -f *.o $(TARGETS)
@@ -124,7 +124,6 @@ dist:
)
test: arping2
@echo Testing with destination host $(HOST) and MAC $(MAC)
-
# Easy ones
@$(SUDO) ./arping -c 1 -q $(HOST) || echo fail: arping host
@$(SUDO) ./arping -c 1 -q $(shell $(SUDO) ./arping -c 1 -r $(HOST)) \
diff --git a/arping-2/arping.c b/arping-2/arping.c
index 1a66cbf..234582d 100644
--- a/arping-2/arping.c
+++ b/arping-2/arping.c
@@ -12,7 +12,7 @@
*
* Also finds out IP of specified MAC
*
- * $Id: arping.c 1123 2004-08-25 13:26:02Z marvin $
+ * $Id: arping.c 1124 2004-08-29 18:44:15Z marvin $
*/
/*
* Copyright (C) 2000-2002 Thomas Habets <thomas@habets.pp.se>
@@ -964,7 +964,7 @@ int main(int argc, char **argv)
}
}
- parm = argv[optind];
+ parm = (optind < argc) ? argv[optind] : NULL;
/*
* Handle dstip_given instead of ip address after parms (-B really)
@@ -984,6 +984,10 @@ int main(int argc, char **argv)
}
}
+ if (!parm) {
+ usage(1);
+ }
+
/*
*
*/