extern int optind;
extern int opterr;
extern char *optarg;
+#ifdef BDEBUG
+int dflag;
+#endif
/*
* On Windows, we need to open the file in binary mode, so that
{
char *cp;
int op;
+#ifndef BDEBUG
int dflag;
+#endif
char *infile;
int Oflag;
long snaplen;
if(wsockinit() != 0) return 1;
#endif /* WIN32 */
+#ifndef BDEBUG
dflag = 1;
+#else
+ /* if optimizer debugging is enabled, output DOT graph
+ * `dflag=4' is equivalent to -dddd to follow -d/-dd/-ddd
+ * convention in tcpdump command line
+ */
+ dflag = 4;
+#endif
infile = NULL;
Oflag = 1;
snaplen = 68;
if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
error("%s", pcap_geterr(pd));
+#ifdef BDEBUG
+ // replace line feed with space
+ for (cp = cmdbuf; *cp != '\0'; ++cp) {
+ if (*cp == '\r' || *cp == '\n') {
+ *cp = ' ';
+ }
+ }
+ // only show machine code if BDEBUG defined, since dflag > 3
+ printf("machine codes for filter: %s\n", cmdbuf);
+#endif
bpf_dump(&fcode, dflag);
pcap_close(pd);
exit(0);