summaryrefslogtreecommitdiff
path: root/tcpdump.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-06-11 21:01:31 -0700
committerGuy Harris <gharris@sonic.net>2020-06-11 21:01:31 -0700
commit27ede6609cad295a3100fe7c11fca35192da8d74 (patch)
tree75e1b5e88bae6934c87b76f2ccc67051e9a93bf1 /tcpdump.c
parentde60de43d0373da5134dbab4e081fb630e8f1298 (diff)
downloadtcpdump-27ede6609cad295a3100fe7c11fca35192da8d74.tar.gz
Use \ rather than / as a pathname separator in Windows.
Diffstat (limited to 'tcpdump.c')
-rw-r--r--tcpdump.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tcpdump.c b/tcpdump.c
index 06d3d9b9..1aa285e3 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -124,6 +124,16 @@ The Regents of the University of California. All rights reserved.\n";
#include <grp.h>
#endif /* _WIN32 */
+/*
+ * Pathname separator.
+ * Use this in pathnames, but do *not* use it in URLs.
+ */
+#ifdef _WIN32
+#define PATH_SEPARATOR '\\'
+#else
+#define PATH_SEPARATOR '/'
+#endif
+
/* capabilities convenience library */
/* If a code depends on HAVE_LIBCAP_NG, it depends also on HAVE_CAP_NG_H.
* If HAVE_CAP_NG_H is not defined, undefine HAVE_LIBCAP_NG.
@@ -1498,7 +1508,7 @@ main(int argc, char **argv)
VFile = NULL;
WFileName = NULL;
dlt = -1;
- if ((cp = strrchr(argv[0], '/')) != NULL)
+ if ((cp = strrchr(argv[0], PATH_SEPARATOR)) != NULL)
ndo->program_name = program_name = cp + 1;
else
ndo->program_name = program_name = argv[0];