I am designing an ftp client prompt in C (unix environment).
At this point, I have an infinite loop with an fprintf of the prompt on stdout and an fgets for reading user input.
I need help with the structure of my program. How do I implement this?
I have two char* arrays. One contains a listing of commands the client will use and the other contains a one line help description of each command in the first array (the order corresponds with each command location in the first array).
Provided I do an sscanf on the user input to find out the command and (1) optional argument if applicable, what is the best way to implement this? I'm guessing at some point I will need a switch statement.
Let's start with the help command. It will have the exact same functionality as a help command in an ftp client. help alone prints a listing of all commands and help arg prints help on a specific command.
Thanks for any help you can provide.