No.8524
How do I read flags as well as multiple arguments? For example, ls. If you provide 2 directories, you get a list of both directories and the flags specified also work. How do I replicate this? I've tried looking at GNU ls, BSD ls, and BusyBox ls but I couldn't make heads or tails of anything.
____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8530
>>8524
>ls
I don't think C standard library has a method for searching directory contents, you need to make calls to the operating system. The method changes depending on what OS you're on, look up the documentation for it.
>how do I read multiple arguments
Did you even try to read a tutorial on C?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8534
>>8524
Argp is the library you're looking for for parsing command-line arguments. However, if you're at the stage where you didn't know about argc, argv and multiple arguments, its going to be a pain to get your head around.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8535
>>8534
Oh yeah, try and find a PDF of 'step by step into argp.'
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.