- getopt returns -1 when arg list is exhausted, not EOF

- store getopt's return value into an int, not a char...
This commit is contained in:
pvalchev 2002-02-20 20:25:54 +00:00
parent affedb781a
commit 3492a70ae6

View File

@ -1,6 +1,22 @@
$OpenBSD: patch-arpcatch_c,v 1.1 2001/04/20 07:53:02 reinhard Exp $
--- arpcatch.c.orig Fri Aug 22 02:57:01 1997
+++ arpcatch.c Tue Apr 17 16:00:13 2001
$OpenBSD: patch-arpcatch_c,v 1.2 2002/02/20 20:25:54 pvalchev Exp $
--- arpcatch.c.orig Thu Aug 21 18:57:01 1997
+++ arpcatch.c Wed Feb 20 13:20:11 2002
@@ -11,13 +11,13 @@ int debug = 0;
int defer = 0;
int main(int argc, char **argv) {
- char c;
+ int c;
char *configfile = DEFAULT_CONFIGFILE;
char *device = DEFAULT_DEVICE;
table_t *at;
int fd;
- while((c = getopt(argc, argv, "di:f:")) != EOF) {
+ while((c = getopt(argc, argv, "di:f:")) != -1) {
switch(c) {
case 'd':
debug++;
@@ -37,6 +37,7 @@ int main(int argc, char **argv) {
}
}