Here is the unix v6 code: http://v6shell.org/history/if.c
execv(ncom, nargv, np);
So if execv is successfully executed, we will not reach the next line and return 1. Instead execv will return something (0?) and exit the function doex. But why?
I would except you would have to write this:
if ( execv(ncom, nargv, np) ) return (0);
unix v6 exec - man page: http://man.cat-v.org/unix-6th/2/exec
Best How To :
From the start of the
exec man page you linked:
Exec overlays the calling process with the named file, then transfers to the beginning of the core image of the file. There can be no return from the file; the calling core image is lost.
Just like in today's
exec functions, the
execv call fully replaces the calling process with a new one. If
execv failed for some reason, control will pass to the next line and the function will
return 1. Otherwise, the exit code of the subprocess will be used as the exit code of this process, and no further code from this process will execute.