1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-11-08 18:02:23 +05:30

freadln.c: test: add and use macro YN for printing booleans

This commit is contained in:
Intel A80486DX2-66 2024-04-07 18:52:01 +03:00
parent da96289764
commit 425aae56ec
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -122,6 +122,8 @@ typedef uintmax_t SIZE_T_FORMAT;
typedef size_t SIZE_T_FORMAT;
# endif
# define YN(boolean) ((boolean) ? "yes" : "no")
int main(void) {
// stdin test
printf("Type something> ");
@ -162,8 +164,8 @@ int main(void) {
perror("freadln");
exit(EXIT_FAILURE);
} else if (result == freadln_EOF || feof(f)) {
printf("File: EOF, breaking the loop (returned by function? %d, "
"feof? %d)\n", result == freadln_EOF, !!feof(f));
printf("File: EOF, breaking the loop (returned by function? %s, "
"feof? %s)\n", YN(result == freadln_EOF), YN(feof(f)));
break;
}
printf("File, line #%d: '%s' (%" PRIuSIZE " characters)\n", i + 1, line,