26 lines
442 B
C
26 lines
442 B
C
#include <err.h>
|
|
#include <stdlib.h>
|
|
#include <sys/wait.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc < 2)
|
|
errx(1, "Not enough args");
|
|
|
|
int id = fork();
|
|
if (id < 0)
|
|
errx(1, "Cannot fork");
|
|
|
|
if (id == 0)
|
|
{
|
|
int res = 0;
|
|
wait(&res);
|
|
return res;
|
|
}
|
|
else
|
|
{
|
|
int res = execl("/bin/sh", "supershell", "-c", argv[1], NULL);
|
|
exit(res);
|
|
}
|
|
}
|