/* * stattest — exercise POSIX stat() and fstat() over ESTEX file metadata. * * Calls: * stat() on a file by path * stat() on a directory (current dir) * stat() on a non-existent file (expects errno=ENOENT) * fstat() on a freshly opened file */ #include #include #include #include #include #include #include #include int main(int argc, char **argv) { struct stat st; puts("stattest: stat() / fstat() smoke test"); ffblk_t ffb; if (ffirst(argv[0], &ffb, FA_DIREC) == 0) { printf("File %s, size = %d\n", argv[0], ffb.size); } else { printf("File %s, error\n", argv[0]); } if (argc > 1) { if (ffirst(argv[1], &ffb, FA_DIREC) == 0) { printf("File %s, size = %d\n", argv[1], ffb.size); } else { printf("File %s, error\n", argv[1]); } } return 0; }