3.8 ls
In C, using UNIX system calls, implement a basic version of ls.
Your program should will receive any number of command-line arguments. If it receives none, run in all mode. If it receive some, run in some mode.
In all mode, read the current working directory and run in some mode as if every file were given as arguments. (Use man opendir.)
In some mode, treat each argument as the name of file and output a file info line for it. (Use man lstat.)
A file info line has the format TYPE PERMS LINK-COUNT OWNER GROUP SIZE MTIME INODE FILENAME. TYPE is either - for ordinary files, d for directories, and l for symbolic links. PERMS is the permissions, in the same format as ls -l. LINK-COUNT is the link count (a field that comes from lstat). OWNER is the owner as a string. GROUP is the group as a string. SIZE is the size in bytes. MTIME is the modification time as formatted by man ctime. INODE is the inode number. FILENAME is the name of the file.
Your program should have no other output.
A README file that contains a short write-up of your project. It should discuss the approach you took to solving the problem, it should discuss any problems or issues that still remain, it should discuss any interesting things that you learned in the course of the project. Finally, it should provide the grade you believe the project deserves with a detailed explanation of why. This explanation should almost certainly focus on why you believe the program is correct.
You should quote your tests and their output.
This file must be in plain-text. If you need formatting, use Markdown. It must be limited to 80 characters wide, unless you are quoting program output.
Your source code, named a6.c.
A test output files, named however you want, for use during testing.
A Makefile that first builds the program and then tests it by running it on a bunch of different arguments demonstrating each of the features, comparing the output with your expected output files.
This assignment will be graded based on its correctness and your ability to articulate why it is correct.