Implement the stat command in
C. Write a C program
called my_stat that implements the default behavior
of the UNIX stat command. Your output
should exactly match the default output of the stat
command. For instance:
File: "/usr/bin/stat"
Size: 7212
Blocks:
16
IO Block: 4096 Regular File
Device: 303h/771d Inode:
311082 Links:
1
Access: (0755/-rwxr-xr-x) Uid:
( 0/
root) Gid: (
0/ root)
Access: Wed Jul 10 23:00:30 2002
Modify: Wed Aug 8 10:49:41 2001
Change: Thu Apr 4 12:34:28 2002
Hint: "man stat" and "man 2 stat".
Again, the output of your stat program with the option should
match the output of the original stat program. For those of
you using
Molay's text, you will find his discussion on the stat call on pages
82ff
quite helpful in using the stat call and formatting the output
correctly.
For extra credit (2 points): Implement
handling of any one of the following two
flags:
-L (follow Links)
-c --format (implement a subset of 5 of the formatting options (your
choice which 5))
DELIVERABLES: your source file(s)
(e.g., my_stat.c), a makefile, and a README as
described in the
submission faq