- char *intf = NULL;
- char *script = NULL;
- int quit = 0;
- int foreground = 0;
-
- char *why;
- struct sockaddr saddr;
- struct ether_addr addr;
- struct in_addr ip = { 0 };
- int fd;
- int ready = 0;
- suseconds_t timeout = 0; // milliseconds
- unsigned conflicts = 0;
- unsigned nprobes = 0;
- unsigned nclaims = 0;
- int t;
- int state = PROBE;
-
- struct ifreq ifr;
- unsigned short seed[3];
-
+ int state;
+ char *r_opt;
+ unsigned opts;
+
+ // ugly trick, but I want these zeroed in one go
+ struct {
+ const struct in_addr null_ip;
+ const struct ether_addr null_addr;
+ struct in_addr ip;
+ struct ifreq ifr;
+ int timeout_ms; /* must be signed */
+ unsigned conflicts;
+ unsigned nprobes;
+ unsigned nclaims;
+ int ready;
+ int verbose;
+ } L;
+#define null_ip (L.null_ip )
+#define null_addr (L.null_addr )
+#define ip (L.ip )
+#define ifr (L.ifr )
+#define timeout_ms (L.timeout_ms)
+#define conflicts (L.conflicts )
+#define nprobes (L.nprobes )
+#define nclaims (L.nclaims )
+#define ready (L.ready )
+#define verbose (L.verbose )
+
+ memset(&L, 0, sizeof(L));
+ INIT_G();
+
+#define FOREGROUND (opts & 1)
+#define QUIT (opts & 2)