As simple as listing the files in a directory.
- C 85.6%
- Makefile 14.4%
|
|
||
|---|---|---|
| include/ls | ||
| libft@6675f73e27 | ||
| src | ||
| .gitignore | ||
| .gitmodules | ||
| Makefile | ||
| README.md | ||
| testgetopt.c | ||
| tests.md | ||
ft_ls
For knowing the filesystem inside out, and how files and directories are sorted, you will code by yourself one of the most used command: ls.
Features
Mandatory features:
- Support of the following flags/options:
-l, displays the files in a column style, showing more information-a, displays hidden files too-r, reverses the order of the files-t, sorts files based on their last modified time-R, displays subfolder contents recursively
- An identical as possible display to the original
ls
Bonus stuff:
- Management of ACL & extended attributes
- Management of columns without
-l(using/dev/ttyandioctl) - Usage of the
LS_COLORSenvironment variable and the--colorflag - Support of the following flags/options:
--zero, ends each line with aNULcharacter, not a newline-A, displays almost all hidden files (this excludes.and..)-1, lists only one file per line
Bonus functions
Since the subject allows for uses of other functions for the bonus part, here are the functions used:
| function name | header | usage |
|---|---|---|
ioctl |
<sys/ioctl.h> |
getting the current TTY's display size |
References
- Parsing
LS_COLORS: https://linuxhint.com/ls_colors_bash/ - Understanding some flags: https://github.com/coreutils/coreutils/blob/master/src/ls.c