[Pkg-shadow-commits] r2033 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sun May 25 23:01:15 UTC 2008
Author: nekral-guest
Date: 2008-05-25 23:01:14 +0000 (Sun, 25 May 2008)
New Revision: 2033
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/yesno.c
Log:
* 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.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-05-25 22:54:20 UTC (rev 2032)
+++ upstream/trunk/ChangeLog 2008-05-25 23:01:14 UTC (rev 2033)
@@ -1,5 +1,13 @@
2008-05-26 Nicolas François <nicolas.francois at 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 at centraliens.net>
+
* libmisc/age.c: Avoid implicit conversion of integers to
booleans.
Modified: upstream/trunk/libmisc/yesno.c
===================================================================
--- upstream/trunk/libmisc/yesno.c 2008-05-25 22:54:20 UTC (rev 2032)
+++ upstream/trunk/libmisc/yesno.c 2008-05-25 23:01:14 UTC (rev 2033)
@@ -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 @@
*/
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;
}
+
More information about the Pkg-shadow-commits
mailing list