I know execvp can be used to execute simple commands as follows:
char* arg[] = {\"ls\", \"-l\", NULL};
execvp(arg[0],arg);
I w
My intuition is I have to read the file and may be parse it to store the arguments in the arg. However I want to make sure.
Your intuition is largely correct. The cat utility that you're using as an example has two separate code paths:
This behavior is specifically implemented in the cat utility -- it is not implemented at any lower level. In particular, it is definitely not part of the exec system call. The exec system calls do not "look at" arguments at all; they just pass them straight on to the new process in argv, and that process gets to handle them however it sees fit.