1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <unistd.h> 4 5 /* There is a global_i in foll-exec, which exec's us. We 6 should not be able to see that other definition of global_i 7 after we are exec'd. 8 */ 9 int global_i = 0; 10 11 #ifdef PROTOTYPES 12 int main (int argc, char **argv) 13 #else 14 main (argc, argv) 15 int argc; 16 char * argv[]; 17 #endif 18 { 19 /* There is a local_j in foll-exec, which exec's us. We 20 should not be able to see that other definition of local_j 21 after we are exec'd. 22 */ 23 int local_j = argc; 24 char * s; 25 26 printf ("Hello from execd-prog...\n"); 27 if (argc != 2) 28 { 29 printf ("expected one string argument\n"); 30 exit (-1); 31 } 32 s = argv[1]; 33 printf ("argument received: %s\n", s); 34 } 35