1 #include 2 #include 3 #include 4 main() 5 { int result; 6 char prog[100]; 7 8 printf( "\nWelcome to the Dshell...\n" ); 9 printf( "Running as real UID %d and effective UID %d\n\n",getuid(),geteuid()); 10 while (1) 11 { 12 printf("What executable should the child run? "); 13 scanf( "%s", &prog); 14 result = fork(); 15 if ( result == 0 ) 16 { execl(prog,prog,NULL); 17 exit(0); } 18 else 19 { wait(NULL); 20 printf("\n...done waiting. Welcome back!\n----------\n\n"); } 21 } 22 } 23