Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me implementing the version of the following question parts according to the question below? =============================================================== This the source code I need to

Can you help me implementing the version of the following question parts according to the question below? image text in transcribedimage text in transcribed =============================================================== This the source code I need to make the functionality of it to work according the above question? image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

3. Implement a 2nd version of your program which implements the following using C functions a. Instead of "command not found", if your interpret routine does not find the command have the C system call execute it and use the return code from the system call to display the status of the command. ( 2 marks) b. export name=value ( 2 marks) unset name Set the environment variable name to the value. Verify that name is set by issuing a echo command which, since it's not in the list, will be executed by system in a sub shell. An unset variable will display nothing when you attempt to echo it. c. chdir dirname (3) Change your cmdline prompt|so that it always shows the current directory. (1) Have your function use the C chdir function to change directories and test by issuing a command to (1) Testing: i. Change to an absolute directory path ii. Change to a relative directory iii. Attempt to change to a directory that doesn't exist. iv. Have your program use perror to display an error message if chdir fails. (1) d. access file 1 file 2 file3 Use the access function to test and report each of the 4 access properties separately for each file. If the file does not exist then only do that test and ignore the others. e. chmod octalPermission file 1 file 2 file3.... (3) Use sscanf to convert the octalPermission string to a number. Use the C chmod function to change the permissions of the files. If chmod fails use strerror to report the problem. Verify that the changes took place. f. path file 1 file 2 file3 (2) Display the realpath (full name), dirname and basename of each file. Your test cases should have g. touch m t1 -a t2 file 1 file 2 file3 .... (4 marks) i. Implement a small getopt loop in your function to implement this command. Set the default times for the modify and access flags to the current time seconds since the epoch. Use the getopt loop to capture mt1 and at2, if they are present where t1 and t2 are large integers representing ii. Verify that each file exists. 1. If it does use utimes to set both times 2. If it doesn't,, use creat to create it, verify that you were successful, use futimes to set both times and then close the file. 3. Verify using the stat command that you were successful. h. Link -s -f file 1 file 2 (4) In your function write a getopt loop to capture the s and/or f flags if they are present. If the f (force) option is present use the appropriate "little" function to delete file 2. If the -s (symbolic) option is present use the appropriate "little" function to create a Note that the stub routines only return a message indicating that they are not yet implemented, and they will need to be updated with the actual functionality for each command. Also, the lookup table only contains the command names and function pointers for the stub routines, and they will need to be updated with the correct function pointers for the actual implementation of each command

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions