[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] nmh ChangeLog h/prototypes.h sbr/ambigsw.c sbr/...
From: |
Eric Gillespie |
Subject: |
[Nmh-commits] nmh ChangeLog h/prototypes.h sbr/ambigsw.c sbr/... |
Date: |
Thu, 14 Aug 2008 01:50:46 +0000 |
CVSROOT: /sources/nmh
Module name: nmh
Changes by: Eric Gillespie <epg> 08/08/14 01:50:46
Modified files:
. : ChangeLog
h : prototypes.h
sbr : ambigsw.c getans.c print_help.c print_sw.c
uip : msh.c
Added files:
test/tests/pick: test-stderr
Log message:
* sbr/ambigsw.c: Send print_sw output to stderr. This avoids
strange problems with scan `pick -bogus`, not to mention being
nicer anyway.
* sbr/getans.c, sbr/print_help.c, uip/msh.c: Send print_sw
output
to stdout.
* h/prototypes.h, sbr/print_sw.c (print_sw): Add FILE * argument
and send output there rather than to stdout.
* test/tests/pick/test-stderr: Add test that error messages
don't
end up going to stdout.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/test/tests/pick/test-stderr?cvsroot=nmh&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/nmh/ChangeLog?cvsroot=nmh&r1=1.294&r2=1.295
http://cvs.savannah.gnu.org/viewcvs/nmh/h/prototypes.h?cvsroot=nmh&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/ambigsw.c?cvsroot=nmh&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/getans.c?cvsroot=nmh&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/print_help.c?cvsroot=nmh&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/print_sw.c?cvsroot=nmh&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/msh.c?cvsroot=nmh&r1=1.13&r2=1.14
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/nmh/nmh/ChangeLog,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -b -r1.294 -r1.295
--- ChangeLog 14 Aug 2008 01:31:11 -0000 1.294
+++ ChangeLog 14 Aug 2008 01:50:45 -0000 1.295
@@ -1,5 +1,20 @@
2008-08-13 Eric Gillespie <address@hidden>
+ * sbr/ambigsw.c: Send print_sw output to stderr. This avoids
+ strange problems with scan `pick -bogus`, not to mention being
+ nicer anyway.
+
+ * sbr/getans.c, sbr/print_help.c, uip/msh.c: Send print_sw output
+ to stdout.
+
+ * h/prototypes.h, sbr/print_sw.c (print_sw): Add FILE * argument
+ and send output there rather than to stdout.
+
+ * test/tests/pick/test-stderr: Add test that error messages don't
+ end up going to stdout.
+
+2008-08-13 Eric Gillespie <address@hidden>
+
* uip/pick.c: Print matching messages immediately, instead of
waiting until the very end to print anything.
Ensure valid sequence name as soon as we parse it from command,
Index: h/prototypes.h
===================================================================
RCS file: /sources/nmh/nmh/h/prototypes.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- h/prototypes.h 2 Jun 2008 22:37:01 -0000 1.24
+++ h/prototypes.h 14 Aug 2008 01:50:45 -0000 1.25
@@ -2,7 +2,7 @@
/*
* prototypes.h -- various prototypes
*
- * $Id: prototypes.h,v 1.24 2008/06/02 22:37:01 pm215 Exp $
+ * $Id: prototypes.h,v 1.25 2008/08/14 01:50:45 epg Exp $
*/
/*
@@ -91,7 +91,7 @@
int pidstatus (int, FILE *, char *);
char *pluspath(char *);
void print_help (char *, struct swit *, int);
-void print_sw (char *, struct swit *, char *);
+void print_sw (char *, struct swit *, char *, FILE *);
void print_version (char *);
void push (void);
char *pwd (void);
Index: sbr/ambigsw.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/ambigsw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- sbr/ambigsw.c 2 Jul 2002 22:09:14 -0000 1.2
+++ sbr/ambigsw.c 14 Aug 2008 01:50:46 -0000 1.3
@@ -2,7 +2,7 @@
/*
* ambigsw.c -- report an ambiguous switch
*
- * $Id: ambigsw.c,v 1.2 2002/07/02 22:09:14 kenh Exp $
+ * $Id: ambigsw.c,v 1.3 2008/08/14 01:50:46 epg Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -16,5 +16,5 @@
ambigsw (char *arg, struct swit *swp)
{
advise (NULL, "-%s ambiguous. It matches", arg);
- print_sw (arg, swp, "-");
+ print_sw (arg, swp, "-", stderr);
}
Index: sbr/getans.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/getans.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- sbr/getans.c 29 Apr 2007 22:34:04 -0000 1.3
+++ sbr/getans.c 14 Aug 2008 01:50:46 -0000 1.4
@@ -2,7 +2,7 @@
/*
* getans.c -- get an answer from the user and return a string array
*
- * $Id: getans.c,v 1.3 2007/04/29 22:34:04 pm215 Exp $
+ * $Id: getans.c,v 1.4 2008/08/14 01:50:46 epg Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -50,7 +50,7 @@
*cp = '\0';
if (ansbuf[0] == '?' || cp == ansbuf) {
printf ("Options are:\n");
- print_sw (ALL, ansp, "");
+ print_sw (ALL, ansp, "", stdout);
continue;
}
cpp = brkstring (ansbuf, " ", NULL);
Index: sbr/print_help.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/print_help.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- sbr/print_help.c 2 Jul 2002 22:09:14 -0000 1.2
+++ sbr/print_help.c 14 Aug 2008 01:50:46 -0000 1.3
@@ -3,7 +3,7 @@
* print_help.c -- print a help message, and possibly the
* -- profile/context entries for this command
*
- * $Id: print_help.c,v 1.2 2002/07/02 22:09:14 kenh Exp $
+ * $Id: print_help.c,v 1.3 2008/08/14 01:50:46 epg Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -23,7 +23,7 @@
/* print all the switches */
printf (" switches are:\n");
- print_sw (ALL, swp, "-");
+ print_sw (ALL, swp, "-", stdout);
/*
* check if we should print any profile entries
Index: sbr/print_sw.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/print_sw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- sbr/print_sw.c 2 Jul 2002 22:09:14 -0000 1.2
+++ sbr/print_sw.c 14 Aug 2008 01:50:46 -0000 1.3
@@ -2,7 +2,7 @@
/*
* print_sw.c -- print switches
*
- * $Id: print_sw.c,v 1.2 2002/07/02 22:09:14 kenh Exp $
+ * $Id: print_sw.c,v 1.3 2008/08/14 01:50:46 epg Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -13,7 +13,7 @@
void
-print_sw (char *substr, struct swit *swp, char *prefix)
+print_sw (char *substr, struct swit *swp, char *prefix, FILE *fp)
{
int len, optno;
register int i;
@@ -45,10 +45,11 @@
*cp++ = *cp1++;
*cp++ = ')';
while ((*cp++ = *cp1++));
- printf (" %s%s\n", prefix, buf);
+ fprintf (fp, " %s%s\n", prefix, buf);
} else {
if (!swp->minchars)
- printf(optno ? " %s[no]%s\n" : " %s%s\n", prefix,
swp->sw);
+ fprintf(fp, optno ? " %s[no]%s\n" : " %s%s\n",
+ prefix, swp->sw);
}
if (optno)
swp++; /* skip -noswitch */
Index: uip/msh.c
===================================================================
RCS file: /sources/nmh/nmh/uip/msh.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- uip/msh.c 4 Nov 2007 11:54:35 -0000 1.13
+++ uip/msh.c 14 Aug 2008 01:50:46 -0000 1.14
@@ -2,7 +2,7 @@
/*
* msh.c -- The nmh shell
*
- * $Id: msh.c,v 1.13 2007/11/04 11:54:35 jjr Exp $
+ * $Id: msh.c,v 1.14 2008/08/14 01:50:46 epg Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -1475,7 +1475,7 @@
continue;
if (buffer[0] == '?') {
printf ("commands:\n");
- print_sw (ALL, sw, "");
+ print_sw (ALL, sw, "", stdout);
printf ("type CTRL-D or use ``quit'' to leave %s\n",
invo_name);
continue;
@@ -2142,7 +2142,7 @@
case OK:
printf ("commands:\n");
- print_sw (ALL, sw, "");
+ print_sw (ALL, sw, "", stdout);
printf ("type ``quit'' to leave %s\n", invo_name);
fflush (stdout);
fflush (stderr);
Index: test/tests/pick/test-stderr
===================================================================
RCS file: test/tests/pick/test-stderr
diff -N test/tests/pick/test-stderr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ test/tests/pick/test-stderr 14 Aug 2008 01:50:45 -0000 1.1
@@ -0,0 +1,24 @@
+#!/bin/sh
+######################################################
+#
+# Test that errors are not written to stdout.
+#
+######################################################
+
+expected_err=$MH_TEST_DIR/$$.expected_err
+expected_out=$MH_TEST_DIR/$$.expected_out
+actual_err=$MH_TEST_DIR/$$.actual_err
+actual_out=$MH_TEST_DIR/$$.actual_out
+
+# Error message should go to stderr.
+cat > $expected_err <<EOF
+pick: -a ambiguous. It matches
+ -and
+ -after date
+EOF
+# Nothing should to go stdout.
+cat /dev/null > $expected_out
+
+pick -a > $actual_out 2> $actual_err
+diff -u $expected_err $actual_err
+diff -u $expected_out $actual_out
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] nmh ChangeLog h/prototypes.h sbr/ambigsw.c sbr/...,
Eric Gillespie <=