Writing a basic C Shell - understanding argv[] [on hold]
- by Flame
I have an assignment for my class to write a basic C Shell. I have found many pages that explain parts of it and some fully implemented code. I'm not going to copy, i'm just using it right now as a way to get started.
So I'm at the beginning of this project obviously. One example I am looking at parses the user's input and stores a pointer to the beginning of the argument in char *argv[3];
Am I just misunderstanding this or would this technically break if there are more than 3 arguments? (say /a.out arg1 arg2 arg3 etc). Would I wanna malloc this somehow?
I know a.out is considered argv[0], and the arguments argv1 - however many there are. It's probably bad practice to have too many arguments for a program, but I still would at least want to address it as I don't know what my TA's are going to use to test my shell.