Give Tethereal a "-l" flag, as tcpdump has, to make the standard output

line-buffered.

svn path=/trunk/; revision=2451
This commit is contained in:
Guy Harris 2000-09-20 08:28:54 +00:00
parent e0139fc43b
commit 2ef47f9ccb
2 changed files with 16 additions and 4 deletions

View File

@ -11,6 +11,7 @@ S<[ B<-f> filter expression ]>
S<[ B<-F> file format ]>
S<[ B<-h> ]>
S<[ B<-i> interface ]>
S<[ B<-l> ]>
S<[ B<-n> ]>
S<[ B<-o> preference setting ] ...>
S<[ B<-p> ]>
@ -125,6 +126,14 @@ there are any non-loopback interfaces, and choosing the first loopback
interface if there are no non-loopback interfaces; if there are no
interfaces, B<Tethereal> reports an error and doesn't start the capture.
=item -l
Make the standard output line buffered. This may be useful when piping
the output of B<Tethereal> to another program, as it means that the
program to which the output is piped will see lines of output as soon as
B<Tethereal> generates those lines, rather than seeing them only when
the standard output buffer containing those lines fills up.
=item -n
Disables network object name resolution (such as hostname, TCP and UDP port

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.46 2000/09/15 05:32:19 guy Exp $
* $Id: tethereal.c,v 1.47 2000/09/20 08:28:43 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -136,12 +136,12 @@ print_usage(void)
fprintf(stderr, "This is GNU t%s %s, compiled with %s\n", PACKAGE,
VERSION, comp_info_str);
#ifdef HAVE_LIBPCAP
fprintf(stderr, "t%s [ -vVhp ] [ -c count ] [ -f <capture filter> ]\n", PACKAGE);
fprintf(stderr, "t%s [ -vVhlp ] [ -c count ] [ -f <capture filter> ]\n", PACKAGE);
fprintf(stderr, "\t[ -F <capture file type> ] [ -i interface ] [ -n ]\n");
fprintf(stderr, "\t[ -o <preference setting> ] ... [ -r infile ] [ -R <read filter> ]\n");
fprintf(stderr, "\t[ -s snaplen ] [ -t <time stamp format> ] [ -w savefile ] [ -x ]\n");
#else
fprintf(stderr, "t%s [ -vVh ] [ -F <capture file type> ] [ -n ]\n", PACKAGE);
fprintf(stderr, "t%s [ -vVhl ] [ -F <capture file type> ] [ -n ]\n", PACKAGE);
fprintf(stderr, "\t[ -o <preference setting> ] ... [ -r infile ] [ -R <read filter> ]\n");
fprintf(stderr, "\t[ -t <time stamp format> ] [ -w savefile ] [ -x ]\n");
#endif
@ -285,7 +285,7 @@ main(int argc, char *argv[])
);
/* Now get our args */
while ((opt = getopt(argc, argv, "c:Df:F:hi:no:pr:R:s:t:vw:Vx")) != EOF) {
while ((opt = getopt(argc, argv, "c:Df:F:hi:lno:pr:R:s:t:vw:Vx")) != EOF) {
switch (opt) {
case 'c': /* Capture xxx packets */
#ifdef HAVE_LIBPCAP
@ -324,6 +324,9 @@ main(int argc, char *argv[])
arg_error = TRUE;
#endif
break;
case 'l': /* Line-buffer standard output */
setvbuf(stdout, NULL, _IOLBF, 0);
break;
case 'n': /* No name resolution */
g_resolving_actif = 0;
break;