Originally Posted by
Paul22000
"file is the basename stripped of its path"
Semantically speaking, yes that's what it should be though nothing prevents anybody from putting something else there (sort of like what you did). Only caveat or downside is that the exec() family of functions does not enforce the fact that "file is the basename of the program".
Originally Posted by
Paul22000
Sure but what is the purpose of it? Notice what I put in the example in my first post. It seems like it doesn't matter what you put at all.
No purpose except that it's the string that argv[0] points to within the exec()'d file; so for ex. if "oneprog" calls "someprog" as in:
Code:
execl("/full/path/to/someprog", "no effect whatsoever", "firstarg", "secondarg", (char*)0); /* inside oneprog */
When someprog is executed the arguments passed to its main() function would be:
Code:
argv[0] points to "no effect whatsover"
argv[1] points to "firstarg"
argv[2] points to "secondarg"
Which is semantically incorrect since argv[0] is the name of the program which in this case should be "someprog" and not "no effect whatsoever" as in.
Code:
execl("/full/path/to/someprog", "someprog", "firstarg", "secondarg", (char*)0);