7 Commits
Author SHA1 Message Date
Tobias Stoeckmann 386315b305 yesno: make EOL optional in ENABLE_NLS case also
yesno behaves differently in a corner case depending on ENABLE_NLS.
With an input of "y" followed by an EOF the input is considered to
be "no", because the last character is replaced with '\0'.  It was
assumed that there is a newline, which doesn't have to be true.

If ENABLE_NLS is not set, getchar() reads y and accepts it as "yes",
looping through more getchar() calls until reaching newline or EOF.

* lib/yesno.c (yesno): Check for EOL before replacing.
* tests/test-yesno.sh: Add a test case (test along with gettext).
2015-03-24 12:33:12 +00:00
Paul Eggert a4d796fb14 maint: spelling fixes 2012-02-05 13:42:03 -08:00
Eric Blake 6ff1e78673 yesno-tests: convert to init.sh
* modules/yesno-tests (Files): Add init.sh.
* tests/test-yesno.sh: Use it.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-05-24 17:22:37 -06:00
Jim Meyering a9ab119464 test-yesno: work around sparc-dash here-document infelicity
Without this change, the literal \177 byte in a here document
would make dash 0.5.5.1-3 access uninitialized memory.
* tests/test-yesno.sh: Don't put the \177 byte in the here document.
Instead, use a marker, "@", and filter through tr to create the desired
contents.  Reported as <http://bugs.debian.org/548493> by Kurt Roeckx.
2009-09-28 11:35:53 +02:00
Bruno Haible d51d502c49 Make test-yesno.sh work on mingw. 2008-04-27 16:22:30 +02:00
Eric Blake 356aef655f * tests/test-yesno.sh: Silence stderr during test.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-10-22 09:39:27 -06:00
Eric Blake 1cf55d294e Test yesno in combination with closein.
* lib/yesno.c (yesno): Document use of stdin.
* modules/yesno-tests (Files): New module.
* tests/test-yesno.c (main): New file.
* tests/test-yesno.sh: Likewise.
2007-08-19 15:47:14 +00:00