Re: [tcpdump-workers] savefile.c patch

2004-05-27 Thread Guy Harris
On May 27, 2004, at 5:22 AM, Gisle Vanem wrote: Since pcap_dump_close() doesn't have a pcap_t argument, where should the oldmode come from? Can we have two module globals; oldmode_stdin, oldmode_stdout, assuming stdin/stdout won't be opened for capture more than once? If it's opened for capture or

Re: [tcpdump-workers] savefile.c patch

2004-05-27 Thread Gisle Vanem
> Since pcap_dump_close() doesn't have a pcap_t argument, where should > the oldmode come from? Can we have two module globals; oldmode_stdin, > oldmode_stdout, assuming stdin/stdout won't be opened for capture more > than once? I've added a 'long filemode' to 'struct pcap' (long since O_BINARY

Re: [tcpdump-workers] savefile.c patch

2004-05-27 Thread Gisle Vanem
"Guy Harris" <[EMAIL PROTECTED]> said: > Also, should we save the mode returned by "setmode()" and restore it > when we close a "pcap_t" or "pcap_dumper_t" that refers to the standard > input or output? Since pcap_dump_close() doesn't have a pcap_t argument, where should the oldmode come from?

Re: [tcpdump-workers] savefile.c patch

2004-05-26 Thread Guy Harris
On May 26, 2004, at 2:35 PM, Guy Harris wrote: Also, that means that if it's writing to the standard output it won't do a "setbuf()" even on Windows. ...which, of course, it isn't doing now, either - but now writing to the standard output won't work right on Windows as it's writing in text mode.

Re: [tcpdump-workers] savefile.c patch

2004-05-26 Thread Guy Harris
On May 26, 2004, at 2:16 PM, Gisle Vanem wrote: I wasn't sure why either. Maybe reducing the chance of a file with truncated packets. I just moved setbuf() further up. Actually, you moved the "if (f == NULL)" check down, leaving the "setbuf()" where it was, and also removed the "#ifdef WIN32"/"#en

Re: [tcpdump-workers] savefile.c patch

2004-05-26 Thread Gisle Vanem
"Guy Harris" <[EMAIL PROTECTED]> said: > Also, is "setmode()" sufficient with all the compilers that could be > used to compile libpcap/WinPcap on Windows (MSVC++, MinGW, etc.), or is > "_setmode()" needed with some compilers? (The code currently uses > "_setmode()".) MSVC/MingW/CygWin have b

Re: [tcpdump-workers] savefile.c patch

2004-05-26 Thread Guy Harris
On May 26, 2004, at 1:55 AM, Gisle Vanem wrote: I feel it's high time we cleanup some of the sources. I'd start with savefile.c. Currently it doesn't work for offline data from stdin. --gv --- libpcap-2004.05.20/savefile.c Tue Mar 23 21:18:08 2004 +++ savefile.c Wed Mar 24 16:29:06 2004 @@ -

[tcpdump-workers] savefile.c patch

2004-05-26 Thread Gisle Vanem
I feel it's high time we cleanup some of the sources. I'd start with savefile.c. Currently it doesn't work for offline data from stdin. --gv --- libpcap-2004.05.20/savefile.c Tue Mar 23 21:18:08 2004 +++ savefile.c Wed Mar 24 16:29:06 2004 @@ -52,6 +52,12 @@ #define TCPDUMP_MAGIC 0xa1b2c3d