/* * SPDsoft 1999 * Do Exec * Wed Nov 10 17:07:03 MET 1999 */ #include #include #include #include #include #include #include #include main(int argc, char *argv[], char **envp) { int error; char *argv0; char *argve; int opt; extern int errno; if ( argc == 1 ) { fprintf(stderr,"Usage: %s [-n cmd] cmd [args]\n", argv[0]); exit(-1); } argv0=NULL; while ( (opt=getopt(argc,argv,"n:")) != EOF ) { switch(opt) { case 'n': argv0 = optarg; break; default: exit (-1); break; } } if ( NULL != argv0 ) { argve = strdup(argv[optind]); argv[optind] = argv0; } execvp( argve, &argv[optind]); perror(argv[0]); }