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); \
}
```
26 lines
624 B
C
26 lines
624 B
C
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
int main(void) {
|
|
printf("%ld\n", sizeof(struct stat));
|
|
|
|
struct stat buf;
|
|
|
|
if (stat("unistd/stat.c", &buf)) {
|
|
perror("stat");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
printf("st_size: %lu\n", buf.st_size);
|
|
printf("st_blksize: %lu\n", buf.st_blksize);
|
|
printf("st_dev: %lu\n", buf.st_dev);
|
|
printf("st_ino: %lu\n", buf.st_ino);
|
|
printf("st_mode: %o\n", buf.st_mode);
|
|
printf("st_nlink: %lu\n", buf.st_nlink);
|
|
printf("st_uid: %u\n", buf.st_uid);
|
|
printf("st_gid: %u\n", buf.st_gid);
|
|
}
|