In our Systems Programming class, we were given the assignment of recreating a simple 'ls' style program.
I am near completion and needed some guidance on how to determine which functions to execute based off of which flags were passed in.
I am able to loop through the char* argv[] array to determine which flags were used, but with 4 different options, I'm stuck on trying to find an efficient way to call functions.
The flags can be:
- -l for long listing
- -a for exposing hidden files
- -U for unsorted listing
- -s for sorted listing
These can be passed in any order.
Any tips?
Thanks all