#include #include #include #include #include #include int main(int argc, char* argv[]) { int status; char *myArgs[5] = {NULL, NULL, NULL, NULL, NULL}; if (argc < 2) { goto usage_err; } if (strcmp(argv[1], "nopathnoext")==0) { myArgs[0] = "echo"; myArgs[1] = "NoPathNoExt"; /* execvp(myArgs[0], myArgs); */ execlp("echo","echo","NoPath", NULL); perror("nopathnoext"); exit(0); } else if (strcmp(argv[1], "nopathext")==0) { myArgs[0] = "echo.exe"; myArgs[1] = "NoPathExt"; execvp(myArgs[0], myArgs); perror("nopathext"); exit(0); } else if (strcmp(argv[1], "pathnoext")==0) { myArgs[0] = "/usr/bin/echo"; myArgs[1] = "PathNoExt"; execvp(myArgs[0], myArgs); perror("pathnoext"); exit(0); } else if (strcmp(argv[1], "pathext")==0) { myArgs[0] = "/usr/bin/echo.exe"; myArgs[1] = "PathExt"; execvp(myArgs[0], myArgs); perror("pathext"); exit(0); } usage_err: printf("Usage: %s nopathnoext|nopathext|pathnoext|pathext\n", argv[0]); exit(0); }