Correct packet count displayed while capturing with -w option. (there was

an extra increment of cfile.count).

Print a newline to stdout at the end of a capture with "-w" so that the
final packet count isn't obliterated by the shell prompt.

svn path=/trunk/; revision=2156
This commit is contained in:
Gilbert Ramirez 2000-07-24 16:27:34 +00:00
parent 401fd78672
commit 2e0d26f22b
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.36 2000/07/20 09:39:23 guy Exp $
* $Id: tethereal.c,v 1.37 2000/07/24 16:27:34 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -590,6 +590,11 @@ capture(int packet_count, int out_file_type)
inpkts = pcap_loop(ld.pch, packet_count, capture_pcap_cb, (u_char *) &ld);
pcap_close(ld.pch);
/* Send a newline if we were printing packet counts to stdout */
if (cfile.save_file != NULL) {
printf("\n");
}
return TRUE;
error:
@ -620,7 +625,6 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
args.pdh = ld->pdh;
if (ld->pdh) {
wtap_dispatch_cb_write((u_char *)&args, &whdr, 0, NULL, pd);
cfile.count++;
printf("\r%u ", cfile.count);
fflush(stdout);
} else {