Question: //filestat.c #include #include #include #include #include int main(int argc, char *argv[]) { mode_t file_perm; /* File permissions */ struct stat file_details; /* Detailed file info

 //filestat.c #include #include #include #include #include int main(int argc, char *argv[])

{ mode_t file_perm; /* File permissions */ struct stat file_details; /* Detailed

//filestat.c

#include

#include

#include

#include

#include

int main(int argc, char *argv[])

{

mode_t file_perm; /* File permissions */

struct stat file_details; /* Detailed file info */

/* Retrieve the file details */

//write your code here

/* Get the file type */

//write your code here

/* Get the time of last access of the file */

//write your code here

/* Get the file permissions */

printf("File Permissions: ");

//write your code here

}

Overview Write a program that takes one file/directory name as command line input and reports the following information on the file: (a) File type (b) Time of last access (c) Read, write and execute permissions Requirements You will write a program (filestat) which will perform the following functions It will run from the command line as shown below: > filestat filename //This will display the following properties of filename: 1) File type, 2) Time of last access, 3) Read, write, and execute permissions for User, Group, and Others. > filestat directory //This will display the following properties of directory: 1) File type, 2) Time of last access, 3) Read, write, and execute permissions for User, Group, and Others.. Arguments: Expects one file name or directory name as argument. You may assume that the user will type the command correctly. Syntax: filestat Instructions 1. Download the file filestat.c 2. Your implementation file MUST be named filestat.c 3. Implement the code for the functions described in the requirements 4. Use system calls e.g. Istat function. 5. Test the code using the given file (filestat.c) 6. Check the results to make sure there are no failures. A sample output is provided for comparison. Your output should be the same as below, except for the "Time of last access". The format of the time should be the same, but the values can be different. o Output sample for the file filestat.c: File type : Regular Time of last access : Tue Oct 13 18:42:29 2020 File Permissions: User: Readable, Writable, Not executable Group : Readable, Not writable, Not executable Others : Readable, Not writable. Not executable Output sample for a directory File type : Directory Time of last access : Tue Oct 13 18:45:28 2020 File Permissions: User: Readable, Writable, Executable Group: Readable, Not writable, Executable Others : Readable, Not writable, Executable

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!