diff options
author | Eric Blake <ebb9@byu.net> | 2007-08-19 15:47:14 +0000 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2007-08-19 15:47:14 +0000 |
commit | 1cf55d294e17922d56dc703d66fd699f67db7073 (patch) | |
tree | e66fe595460f3927e9d84d35d3b2d7a53957d631 /lib | |
parent | 47e1cb35806d3b8aeca05fbd7043b21ca858b92d (diff) | |
download | gnulib-1cf55d294e17922d56dc703d66fd699f67db7073.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yesno.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/yesno.c b/lib/yesno.c index 24006281f0..3db2d6ce0c 100644 --- a/lib/yesno.c +++ b/lib/yesno.c @@ -1,6 +1,6 @@ /* yesno.c -- read a yes/no response from stdin - Copyright (C) 1990, 1998, 2001, 2003, 2004, 2005, 2006 Free + Copyright (C) 1990, 1998, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -28,10 +28,14 @@ # include "getline.h" #endif -/* Return true if we read an affirmative line from standard input. */ - extern int rpmatch (char const *response); +/* Return true if we read an affirmative line from standard input. + + Since this function uses stdin, it is suggested that the caller not + use STDIN_FILENO directly, and also that the line + atexit(close_stdin) be added to main(). */ + bool yesno (void) { |