1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-12-25 17:19:46 +05:30

fixup: freadln.c: test: use return instead of exit

This commit is contained in:
Intel A80486DX2-66 2024-04-07 18:59:08 +03:00
parent 2c6d56faa5
commit 889f39ac29
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -139,13 +139,13 @@ int main(void) {
FILE* f = fopen(TEST_FILE, "w");
if (f == NULL) {
perror("fopen");
exit(EXIT_FAILURE);
return EXIT_FAILURE;
}
fprintf(f, "Hello, world!\nAnother line\n\n");
FILE* new_f = freopen(TEST_FILE, "r", f);
if (new_f == NULL) {
perror("freopen");
exit(EXIT_FAILURE);
return EXIT_FAILURE;
}
f = new_f;
@ -162,7 +162,7 @@ int main(void) {
int result = freadln(f, &line, &line_length);
if (result == freadln_ERROR) {
perror("freadln");
exit(EXIT_FAILURE);
return EXIT_FAILURE;
} else if (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)));