#include #include #include #include int main(int argc, char *argv[]) { struct stat stbuf; int i; if (argc == 1){ fprintf(stderr, "Usage: %s file [ file . . .]\n", argv[0]); return(1); } for(i = 1; i < argc; i++){ if (stat(argv[i], &stbuf) < 0){ perror(argv[i]); continue; } printf("Information about %s:\n", argv[i]); printf("\tID of device containing file: %ld\n", stbuf.st_dev); printf("\tinode number: %ld\n", stbuf.st_ino); printf("\tprotection mode: %04o\n", stbuf.st_mode); printf("\tnumber of hard links: %ld\n", stbuf.st_nlink); printf("\tuser ID of owner: %d\n", stbuf.st_uid); printf("\tgroup ID of owner: %d\n", stbuf.st_gid); printf("\tdevice ID (if special file): %ld\n", stbuf.st_rdev); printf("\tsize of file in bytes %ld\n", stbuf.st_size); printf("\tfile system I/O block size: %ld\n", stbuf.st_blksize); printf("\tnumber of 512-byte blocks: %ld\n", stbuf.st_blocks); printf("\ttime of last access: %s", ctime(&stbuf.st_atime)); printf("\ttime of last modification: %s", ctime(&stbuf.st_mtime)); printf("\ttime of last status change: %s", ctime(&stbuf.st_ctime)); } return(0); }