mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-12-26 02:29:50 +05:30
fixup: freadln.c: test: use return
instead of exit
This commit is contained in:
parent
2c6d56faa5
commit
889f39ac29
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user