2011-08-27 21:26:11 +00:00
|
|
|
#include <stdio.h>
|
2011-11-26 10:00:45 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <error.h>
|
2012-03-02 14:00:11 +00:00
|
|
|
#include <unistd.h>
|
2011-08-27 21:26:11 +00:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
printf("Please enter the name of one of the following programs:\n");
|
|
|
|
|
|
|
|
const char* programname = "ls";
|
2012-03-02 14:00:11 +00:00
|
|
|
const char* newargv[] = { programname, "/bin", NULL };
|
|
|
|
execv(programname, (char* const*) newargv);
|
2011-11-26 10:00:45 +00:00
|
|
|
error(1, errno, "%s", programname);
|
|
|
|
|
2011-08-27 21:26:11 +00:00
|
|
|
return 1;
|
|
|
|
}
|