Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

LO3 Discuss the steps of a typical selection process.

Answered: 1 week ago