Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/lib/libshmif Recognize ``-'' for stdout. allow...
details: https://anonhg.NetBSD.org/src/rev/06f565ecc81f
branches: trunk
changeset: 757064:06f565ecc81f
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Aug 12 18:22:40 2010 +0000
description:
Recognize ``-'' for stdout. allows piping output to tcpdump -r -
diffstat:
sys/rump/net/lib/libshmif/dumpbus.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (26 lines):
diff -r fd922d48e1ce -r 06f565ecc81f sys/rump/net/lib/libshmif/dumpbus.c
--- a/sys/rump/net/lib/libshmif/dumpbus.c Thu Aug 12 18:17:23 2010 +0000
+++ b/sys/rump/net/lib/libshmif/dumpbus.c Thu Aug 12 18:22:40 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dumpbus.c,v 1.4 2010/08/12 18:17:23 pooka Exp $ */
+/* $NetBSD: dumpbus.c,v 1.5 2010/08/12 18:22:40 pooka Exp $ */
/*
* Little utility to convert shmif bus traffic to a pcap file
@@ -83,9 +83,13 @@
if (pcapfile) {
struct pcap_file_header phdr;
- pfd = open(pcapfile, O_RDWR | O_CREAT, 0777);
- if (pfd == -1)
- err(1, "create pcap dump");
+ if (strcmp(pcapfile, "-") == 0) {
+ pfd = STDOUT_FILENO;
+ } else {
+ pfd = open(pcapfile, O_RDWR | O_CREAT, 0777);
+ if (pfd == -1)
+ err(1, "create pcap dump");
+ }
memset(&phdr, 0, sizeof(phdr));
phdr.magic = 0xa1b2c3d4; /* tcpdump magic */
Home |
Main Index |
Thread Index |
Old Index