d1a424c002
This will allow us to redefine the exit function.
For example:
```
#define exit(code) { \
fprintf(stderr, "%s:%d: exit(%s) in function ‘%s’\n",
__FILE__, __LINE__, #code, __func__); \
_exit(code); \
}
```
22 lines
474 B
C
22 lines
474 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
//FILE *f = fopen("/etc/ssl/certs/ca-certificates.crt", "r");
|
|
FILE *f = fopen("stdio/stdio.in", "r");
|
|
char line[256];
|
|
|
|
while (1) {
|
|
if (fgets(line, 256, f)) {
|
|
fputs(line, stdout);
|
|
} else {
|
|
puts("EOF");
|
|
if (!feof(f)) {
|
|
puts("feof() not updated!");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|