echo off-by-1 error when POSIXLY_CORRECT and no args
From:
Paul Eggert
Subject:
echo off-by-1 error when POSIXLY_CORRECT and no args
Date:
Sun, 19 Sep 2004 23:35:00 -0700
User-agent:
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)
I installed the following patch to fix a bug I introduced a few months
ago; sorry about that.
2004-09-19 Paul Eggert <address@hidden>
* src/echo.c (main): Don't pass NULL to strcmp when
POSIXLY_CORRECT and given no arguments.
Index: echo.c
===================================================================
RCS file: /home/eggert/coreutils/cu/src/echo.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -p -u -r1.55 -r1.56
--- echo.c 1 Jun 2004 12:43:41 -0000 1.55
+++ echo.c 20 Sep 2004 06:32:10 -0000 1.56
@@ -120,7 +120,7 @@ main (int argc, char **argv)
bool display_return = true;
bool allow_options =
(! getenv ("POSIXLY_CORRECT")
- || (! DEFAULT_ECHO_TO_XPG && 0 < argc && STREQ (argv[1], "-n")));
+ || (! DEFAULT_ECHO_TO_XPG && 1 < argc && STREQ (argv[1], "-n")));
/* System V machines already have a /bin/sh with a v9 behavior.
Use the identical behavior for these machines so that the
[Prev in Thread]
Current Thread
[Next in Thread]
echo off-by-1 error when POSIXLY_CORRECT and no args,
Paul Eggert<=