/*-------------------------------------------------------------------*/ /* textexec.c */ /* The exec and perror system calls. */ /*-------------------------------------------------------------------*/ #include #include int main(int argc, char *argv[]) { char *ppcArgv[2]; printf("testexec process (%ld)\n", (long)getpid()); ppcArgv[0] = "hello"; ppcArgv[1] = NULL; execvp(ppcArgv[0], ppcArgv); perror(argv[0]); return 1; } /* Sample executions: $ gcc -Wall -ansi -pedantic -o hello hello.c $ gcc -Wall -ansi -pedantic -o testexec testexec.c $ testexec testexec process (23674) hello process (23674) $ mv hello nothello $ testexec testexec process (23708) testexec: No such file or directory $ mv nothello hello $ testexec testexec process (23724) hello process (23724) $ */