Question: Your program should take two possible command line arguments. For example . / myls - a ~ / Document 2 . The first argument is

Your program should take two possible command line arguments. For example
./myls -a ~/Document
2. The first argument is an option started with a dash -. Legitimate options are -a
and -l.
3. If -a is giving, you need to list all files including hidden file start with ..
4. If -l is giving, you need to list one file per line with detailed information (file type,
permission, link number, user, group, size, modification time, and file name). The
format should be the same as the real ls -l.
5. If no dash option is given, you only list file names with hidden file excluded.
6. The second argument is a path (relative or absolute) to a directory. If present, list
the files in the specified directory. If no second argument is given, list the files in
current directory.
7. Your project submission should include the implementation files myls.c, header file
(optional), Makefile (optional), and a README file.
8. All the file names need to be listed in ascending order. You can compare the outputs
with real ls.
II. Important:
1. You will need to do your own research on how to use masking, getpwuid(),
getgrgid(), ctime() to decode the file type, permission, user name, group name,
modification time in the stat structure.
2. You can write your own sorting function or research on how to use qsort().
III. Grading Criteria:
Please make sure your program compiles, otherwise your submission will not be

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!