* libmisc/yesno.c: yes_or_no returns a bool instead of int.
* libmisc/yesno.c: Avoid implicit conversion of pointers to booleans. * libmisc/yesno.c: The return value of fflush is not checked on purpose.
This commit is contained in:
parent
78c0edb7c1
commit
f14452ec3c
@ -1,3 +1,11 @@
|
||||
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/yesno.c: yes_or_no returns a bool instead of int.
|
||||
* libmisc/yesno.c: Avoid implicit conversion of pointers to
|
||||
booleans.
|
||||
* libmisc/yesno.c: The return value of fflush is not checked
|
||||
on purpose.
|
||||
|
||||
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/age.c: Avoid implicit conversion of integers to
|
||||
|
@ -44,11 +44,12 @@
|
||||
/*
|
||||
* yes_or_no - get answer to question from the user
|
||||
*
|
||||
* It returns 0 if no.
|
||||
* It returns false if no.
|
||||
*
|
||||
* If the read_only flag is set, it will print No, and will return 0.
|
||||
* If the read_only flag is set, it will print No, and will return
|
||||
* false.
|
||||
*/
|
||||
int yes_or_no (int read_only)
|
||||
bool yes_or_no (bool read_only)
|
||||
{
|
||||
char buf[80];
|
||||
|
||||
@ -57,20 +58,22 @@ int yes_or_no (int read_only)
|
||||
*/
|
||||
if (read_only) {
|
||||
puts (_("No"));
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Typically, there's a prompt on stdout, sometimes unflushed.
|
||||
*/
|
||||
fflush (stdout);
|
||||
(void) fflush (stdout);
|
||||
|
||||
/*
|
||||
* Get a line and see what the first character is.
|
||||
*/
|
||||
/* TODO: use gettext */
|
||||
if (fgets (buf, sizeof buf, stdin))
|
||||
if (fgets (buf, sizeof buf, stdin) == buf) {
|
||||
return buf[0] == 'y' || buf[0] == 'Y';
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user