From 4aa89c4070e50462b258378cefc2a0d0f5d30998 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Wed, 26 Jul 2023 17:01:58 -0400 Subject: remove additional ifdefs based upon MSDOS --- INSTALL.md | 2 +- gencode.c | 4 ---- optimize.c | 16 ---------------- pcap-int.h | 11 ++--------- pcap.c | 27 ++++++++------------------- savefile.c | 6 ------ sf-pcap.c | 6 ------ 7 files changed, 11 insertions(+), 61 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index f3986b4e..30229cb3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -280,7 +280,7 @@ in `/usr/include/sys/dlpi.h`, and find the corresponding value. pcap-dbus.c - D-Bus capture support pcap-dbus.h - D-Bus capture support pcap-dlpi.c - Data Link Provider Interface support - pcap-dos.c - removed in 2023, after libpcap 1.9 + pcap-dos.c - removed in 2023, after libpcap 1.10 pcap-dpdk.c - DPDK device support pcap-dpdk.h - DPDK device support pcap-enet.c - enet support diff --git a/gencode.c b/gencode.c index 501354bb..8f055492 100644 --- a/gencode.c +++ b/gencode.c @@ -43,10 +43,6 @@ #include #include -#ifdef MSDOS -#include "pcap-dos.h" -#endif - #include "pcap-int.h" #include "extract.h" diff --git a/optimize.c b/optimize.c index 6adcbc12..f22a092d 100644 --- a/optimize.c +++ b/optimize.c @@ -141,22 +141,6 @@ lowest_set_bit(int mask) abort(); /* mask is zero */ return (u_int)bit; } -#elif (defined(MSDOS) && defined(__WATCOMC__)) || defined(STRINGS_H_DECLARES_FFS) - /* - * MS-DOS with Watcom C, which has and declares ffs() there, - * or some other platform (UN*X conforming to a sufficient recent version - * of the Single UNIX Specification). - */ - #include - #define lowest_set_bit(mask) (u_int)((ffs((mask)) - 1)) -#elif (defined(MSDOS) && defined(__DJGPP__)) || defined(__hpux) - /* - * MS-DOS with DJGPP or HP-UX 11i v3, which declare ffs() in , - * which we've already included. Place this branch after the - * branch, in case a later release of HP-UX makes the declaration available - * via the standard header. - */ - #define lowest_set_bit(mask) ((u_int)(ffs((mask)) - 1)) #else /* * None of the above. diff --git a/pcap-int.h b/pcap-int.h index 48948238..d1cf195e 100644 --- a/pcap-int.h +++ b/pcap-int.h @@ -40,11 +40,6 @@ #include -#ifdef MSDOS - #include - #include -#endif - #include "varattrs.h" #include "fmtutils.h" @@ -293,7 +288,6 @@ struct pcap { */ int bpf_codegen_flags; -#if !defined(_WIN32) && !defined(MSDOS) int selectable_fd; /* FD on which select()/poll()/epoll_wait()/kevent()/etc. can be done */ /* @@ -308,7 +302,6 @@ struct pcap { * prepared not to see any packets from the attempt. */ const struct timeval *required_select_timeout; -#endif /* * Placeholder for filter code if bpf not in kernel. @@ -469,7 +462,7 @@ int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); /* * Routines that most pcap implementations can use for non-blocking mode. */ -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) int pcap_getnonblock_fd(pcap_t *); int pcap_setnonblock_fd(pcap_t *p, int); #endif @@ -533,7 +526,7 @@ struct pcap_if_list; typedef struct pcap_if_list pcap_if_list_t; typedef int (*get_if_flags_func)(const char *, bpf_u_int32 *, char *); int pcap_platform_finddevs(pcap_if_list_t *, char *); -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) int pcap_findalldevs_interfaces(pcap_if_list_t *, char *, int (*)(const char *), get_if_flags_func); #endif diff --git a/pcap.c b/pcap.c index 2db694a2..d8b0e775 100644 --- a/pcap.c +++ b/pcap.c @@ -38,9 +38,7 @@ #include #ifndef _WIN32 #include -#ifndef MSDOS #include -#endif #include #include #ifdef HAVE_SYS_SOCKIO_H @@ -71,10 +69,6 @@ struct rtentry; /* declarations in */ #include "os-proto.h" #endif -#ifdef MSDOS -#include "pcap-dos.h" -#endif - #include "pcap-int.h" #include "optimize.h" @@ -1508,13 +1502,10 @@ pcap_freealldevs(pcap_if_t *alldevs) * it actually returns the names of all interfaces, with a NUL separator * between them; some callers may depend on that. * - * MS-DOS has its own pcap_lookupdev(), but that might be useful only - * as an optimization. - * * In all other cases, we just use pcap_findalldevs() to get a list of * devices, and pick from that list. */ -#if !defined(HAVE_PACKET32) && !defined(MSDOS) +#if !defined(HAVE_PACKET32) /* * Return the name of a network interface attached to the system, or NULL * if none can be found. The interface must be configured up; the @@ -1585,9 +1576,9 @@ pcap_lookupdev(char *errbuf) pcap_freealldevs(alldevs); return (ret); } -#endif /* !defined(HAVE_PACKET32) && !defined(MSDOS) */ +#endif /* !defined(HAVE_PACKET32) */ -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) /* * We don't just fetch the entire list of devices, search for the * particular device, and use its first IPv4 address, as that's too @@ -1709,7 +1700,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp, *netp &= *maskp; return (0); } -#endif /* !defined(_WIN32) && !defined(MSDOS) */ +#endif /* !defined(_WIN32) */ #ifdef ENABLE_REMOTE #include "pcap-rpcap.h" @@ -2512,10 +2503,8 @@ pcap_alloc_pcap_t(char *ebuf, size_t total_size, size_t private_offset) p->handle = INVALID_HANDLE_VALUE; /* not opened yet */ #else /* _WIN32 */ p->fd = -1; /* not opened yet */ -#ifndef MSDOS p->selectable_fd = -1; p->required_select_timeout = NULL; -#endif /* MSDOS */ #endif /* _WIN32 */ /* @@ -3565,7 +3554,7 @@ pcap_fileno(pcap_t *p) } #endif /* _WIN32 */ -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) int pcap_get_selectable_fd(pcap_t *p) { @@ -3616,7 +3605,7 @@ pcap_getnonblock(pcap_t *p, char *errbuf) * Get the current non-blocking mode setting, under the assumption that * it's just the standard POSIX non-blocking flag. */ -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) int pcap_getnonblock_fd(pcap_t *p) { @@ -3656,7 +3645,7 @@ pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf) return (ret); } -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) /* * Set non-blocking mode, under the assumption that it's just the * standard POSIX non-blocking flag. (This can be called by the @@ -4094,7 +4083,7 @@ pcap_cleanup_live_common(pcap_t *p) p->tstamp_precision_count = 0; } pcap_freecode(&p->fcode); -#if !defined(_WIN32) && !defined(MSDOS) +#if !defined(_WIN32) if (p->fd >= 0) { close(p->fd); p->fd = -1; diff --git a/savefile.c b/savefile.c index 3bf2e77b..1fc7e011 100644 --- a/savefile.c +++ b/savefile.c @@ -77,12 +77,6 @@ static pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *); */ #if defined(_WIN32) #define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY) -#elif defined(MSDOS) - #if defined(__HIGHC__) - #define SET_BINMODE(f) setmode(f, O_BINARY) - #else - #define SET_BINMODE(f) setmode(fileno(f), O_BINARY) - #endif #endif static int diff --git a/sf-pcap.c b/sf-pcap.c index 54b5c851..2c310773 100644 --- a/sf-pcap.c +++ b/sf-pcap.c @@ -61,12 +61,6 @@ */ #if defined(_WIN32) #define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY) -#elif defined(MSDOS) - #if defined(__HIGHC__) - #define SET_BINMODE(f) setmode(f, O_BINARY) - #else - #define SET_BINMODE(f) setmode(fileno(f), O_BINARY) - #endif #endif /* -- cgit v1.2.3