Why not just take the source code for the Linux ls command, and hack it to your liking, so that it automatically includes those options? Then, you could compile it, rename it, and use it as you wish.
I haven't looked at the source, but I imagine each of those options is a function, and you could just have it call those functions in addition to its default behaviour. Why reinvent the wheel?
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
>but i dont want to use exec ls command
Why not? It does the job and is much easier to get right than the equivalent code using opendir, readdir, closedir, and stat.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>but i dont want to use exec ls command
Why not? It does the job and is much easier to get right than the equivalent code using opendir, readdir, closedir, and stat.
Maybe it's an exercise in using those functions? Just a guess here.
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
>Maybe it's an exercise in using those functions?
Homework, possibly. Though I doubt it's a specific exercise otherwise the OP would have a good idea of what to search for and the question would not have been nearly as vague.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401