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); \
}
```
14 lines
219 B
C
14 lines
219 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
ungetc('h', stdin);
|
|
char c;
|
|
if ((c = getchar()) == 'h') {
|
|
printf("Worked!\n");
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
printf("failed :( %c\n", c);
|
|
exit(EXIT_FAILURE);
|
|
}
|