Question: C++ implement your own version of the stat systems program (stat.cpp) , a standard Unix utility that displays a file's status information. Your implementation should

C++ implement your own version of the stat systems program (stat.cpp), a standard Unix utility that displays a file's status information.

Your implementation should match the output of the existing stat(1) utility, except where timestamps are concerned. Your program may use the output produced by ctime(3) for timestamps. The Access part of your programs output (derived from st mode in stat(2)s stat structure) needs to handle the set-UID, set-GID, and sticky bits (see stat(2)). If one of the input filenames is specified as a single hyphen (-), then stat will assume standard input at that point in the sequence. If no files are specified, stat reads from standard input only.

USER CAN TYPE FILENAMES AND '-' AS MUCH AS THEY WANT TO TO SEE STATUS INFORMATION OF THOSE FILES

NOT allowed to use the exec, system, popen, and pclose system calls or functions in your implementation.

For example, when ./stat filename - is typed:

C++ implement your own version of the stat systems program (stat.cpp), a

File filename Blocks: 8 IO Block: 4096 regular file Size: 6 Device: fd02h 64770d Inode: 16793567 Links: 1 (0644 -rw-r Access Access: 2017-03-29 10:56:16.481256416 -0400 Modify: 2017-03-29 10:56:16.481256416 -0400 Change: 2017-03-29 10:56:16.481256416 -0400 File IO Block: 1024 character special file Size: 0 Blocks: 0 Links: 1 Device type 88,2b Device bh/11d Inode: 46 Access (0620 crw--w----) Uid: Gid: 6/ Access: 2017-03-29 10:56:47.359481662 -0400 Modify: 2017-03-29 10:56:47.372482727 -0400 Change: 2017-03-29 10:55:48.531146314 -0400 File filename Blocks: 8 IO Block: 4096 regular file Size: 6 Device: fd02h 64770d Inode: 16793567 Links: 1 (0644 -rw-r Access Access: 2017-03-29 10:56:16.481256416 -0400 Modify: 2017-03-29 10:56:16.481256416 -0400 Change: 2017-03-29 10:56:16.481256416 -0400 File IO Block: 1024 character special file Size: 0 Blocks: 0 Links: 1 Device type 88,2b Device bh/11d Inode: 46 Access (0620 crw--w----) Uid: Gid: 6/ Access: 2017-03-29 10:56:47.359481662 -0400 Modify: 2017-03-29 10:56:47.372482727 -0400 Change: 2017-03-29 10:55:48.531146314 -0400

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!