Linux Programming/C Programming
This project received 14 bids from talented freelancers with an average bid price of $106 CAD.Get free quotes for a project like this
Project Budget$10 - $30 CAD
Implement the ls command using the stat kernel function. The program should work as follows:
1. Capture the long and short options specified using getopt_long (7 marks)
2. Verify that your program is able to correctly capture all options. (3 marks)
3. Process each of the non-flag related arguments as if they are files in a subroutine - the pattern should be similar to the example used in the demos of the cat command.
4. For any file that fails to stat use perror to report on the problem – and make sure that this feature is tested. (15 marks – note that there are 19 marks available)
5. If there are no non-flag related arguments, process the entire current directory. (5)
6. Create a bash script containing a suite of test commands for your program. Explain your test strategy. (5 marks)
7. Include a commented program listing, sample output and a status report describing which features work, do not work fully (describe your problem) or do not work at all.
The standard flags you should capture are the following:
a) –a --all (1)
b) –i (1)
c) –L (1)
d) –s --size (1)
e) –F --classify (2)
Capture the following new flags that were designed for this assignment
f) –P octal | symbolic display the file permissions either as octal or symbolic (3)
g) --minSize nnn do not display files that are smaller than nnn bytes (1)
h) - -maxSize nnn do not display files that are larger than nnn bytes (1)
i) – time ctime | mtime | atime display the time specified. Note that the - - time
flag can appear multiply so that all times are
j) -g show the group number in decimal (1)
k) - - group show the group name (2)
l) -u show the userid as a number (1)
m) - - author show the users’s real name (ie: James Bond) (2)
n) –n show the number of hard links (1)
Note: Unlike the real ls, if a file is a directory you do not have to show it’s contents. Nor are we asking for the -l (long) option which would display most fields. Your routine do¬¬¬_ls will consist mostly of if statements – if the option is present then display the feature. The minSize and maxSize features should be tested first. If the file is too big or too small then simply return right away, displaying noting.
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online