Alejandro Colomar e28deeb8e9 libmisc/yesno.c: Use getline(3) and rpmatch(3)
getline(3) is much more readable than manually looping.  It has some
overhead due to the allocation of a buffer, but that shouldn't be a
problem here.  If that was a problem, we could reuse the buffer (thus
making the function non-reentrant), but I don't think that's worth the
extra complexity.

Using rpmatch(3) instead of a simple y/n test provides i18n to the
response checking.  We have a fall-back minimalistic implementation for
systems that lack this function (e.g., musl libc).

While we're at it, apply some other minor improvements to this file:

-  Remove comment saying which files use this function.  That's likely
   to get outdated.  And anyway, it's just a grep(1) away, so it doesn't
   really add any value.

-  Remove unnecessary casts to (void) that were used to verbosely ignore
   errors from stdio calls.  They add clutter without really adding much
   value to the code (or I don't see it).

-  Remove comments from the function body.  They make the function less
   readable.  Instead, centralize the description of the function into a
   man-page-like comment before the function definition.  This keeps the
   function body short and sweet.

-  Add '#include <stdbool.h>', which was missing.

-  Minor whitespace style changes (it doesn't hurt the diff at this
   point, since most of the affected lines were already touched by other
   changes, so I applied my preferred style :).

Acked-by: Samanta Navarro <ferivoz@riseup.net>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-26 17:32:47 -05:00
..
2023-02-23 20:28:43 -06:00
2023-02-09 10:03:03 -06:00
2023-02-23 20:28:43 -06:00
2023-02-09 10:03:03 -06:00
2023-03-27 10:10:37 -05:00
2023-01-30 18:24:15 +01:00
2022-08-06 11:27:56 -05:00
2022-09-02 20:27:14 -05:00
2021-12-23 19:36:50 -06:00
2022-08-17 12:34:01 -05:00
2023-02-09 10:03:03 -06:00
2023-02-09 10:03:03 -06:00
2023-02-16 13:23:08 -06:00
2021-12-23 19:36:50 -06:00
2023-02-09 10:03:03 -06:00
2023-02-23 20:28:43 -06:00
2023-03-28 13:00:38 +02:00
2023-02-23 20:28:43 -06:00
2023-02-09 10:03:03 -06:00
2022-12-22 10:31:43 +01:00
2023-02-23 20:28:43 -06:00
2022-12-22 11:43:29 +01:00
2022-12-22 11:43:29 +01:00
2023-02-23 20:28:43 -06:00
2021-12-23 19:36:50 -06:00
2023-02-09 10:03:03 -06:00
2022-08-06 11:27:56 -05:00
2023-03-20 08:47:52 +01:00
2023-02-09 10:03:03 -06:00
2023-02-23 20:28:43 -06:00
2022-08-06 11:27:56 -05:00
2023-02-09 10:03:03 -06:00
2023-02-09 10:03:03 -06:00
2023-02-23 20:28:43 -06:00
2023-02-09 10:03:03 -06:00
2023-02-23 20:28:43 -06:00
2023-02-23 20:28:43 -06:00
2023-02-23 20:28:43 -06:00
2023-02-16 11:29:33 +01:00
2023-02-23 20:28:43 -06:00
2021-12-23 19:36:50 -06:00
2023-02-23 20:28:43 -06:00
2022-12-22 11:43:29 +01:00
2023-02-23 20:28:43 -06:00
2023-02-09 10:03:03 -06:00
2022-12-15 16:22:05 -06:00
2023-02-02 13:08:30 -06:00
2022-08-17 12:34:01 -05:00
2022-12-15 16:22:05 -06:00
2023-02-09 10:03:03 -06:00
2021-12-23 19:36:50 -06:00
2023-02-23 20:28:43 -06:00
2023-02-02 13:08:30 -06:00
2023-02-16 11:29:33 +01:00
2023-02-16 11:29:33 +01:00
2021-12-23 19:36:50 -06:00
2023-02-02 13:08:30 -06:00
2023-02-09 10:03:03 -06:00
2023-02-09 10:03:03 -06:00
2023-02-16 13:23:08 -06:00
2023-03-28 13:00:38 +02:00
2021-12-23 19:36:50 -06:00
2023-02-16 13:23:08 -06:00
2023-02-16 13:23:08 -06:00
2023-01-26 22:44:39 -06:00
2023-02-16 13:23:08 -06:00
2023-02-16 13:23:08 -06:00
2023-02-23 20:28:43 -06:00