From 1ae9fa8a84998e44e0234543162e257815d7e972 Mon Sep 17 00:00:00 2001 From: Eric Gillespie Date: Thu, 14 Aug 2008 01:28:56 +0000 Subject: [PATCH] * uip/pick.c: Print matching messages immediately, instead of waiting until the very end to print anything. --- ChangeLog | 5 +++++ uip/pick.c | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 280061b..969241f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-08-13 Eric Gillespie + * uip/pick.c: Print matching messages immediately, instead of + waiting until the very end to print anything. + +2008-08-13 Eric Gillespie + * uip/Makefile.in, uip/popi.c: Remove popi.c, which has been dead since PatchSet 257 (2000/06/12 11:07:34 UTC). diff --git a/uip/pick.c b/uip/pick.c index 2d9b76e..7aa4870 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -4,7 +4,7 @@ * * $Id$ * - * This code is Copyright (c) 2002, by the authors of nmh. See the + * This code is Copyright (c) 2002, 2008, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ @@ -233,6 +233,11 @@ main (int argc, char **argv) lo = mp->lowsel; hi = mp->hghsel; + /* If printing message numbers to standard out, force line buffering on. + */ + if (listsw) + setvbuf (stdout, NULL, _IOLBF, 0); + /* * Scan through all the SELECTED messages and check for a * match. If the message does not match, then unselect it. @@ -246,6 +251,9 @@ main (int argc, char **argv) lo = msgnum; if (msgnum > hi) hi = msgnum; + + if (listsw) + printf ("%s\n", m_name (msgnum)); } else { /* if it doesn't match, then unselect it */ unset_selected (mp, msgnum); @@ -272,13 +280,9 @@ main (int argc, char **argv) done (1); /* - * Print the name of all the matches + * Print total matched if not printing each matched message number. */ - if (listsw) { - for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) - if (is_selected (mp, msgnum)) - printf ("%s\n", m_name (msgnum)); - } else { + if (!listsw) { printf ("%d hit%s\n", mp->numsel, mp->numsel == 1 ? "" : "s"); } -- 1.7.10.4