Home | History | Annotate | Download | only in other
      1 #include <stdlib.h>
      2 #include <stdio.h>
      3 #include <sys/wait.h>
      4 #include <errno.h>
      5 
      6 int
      7 main(int argc, char *argv[])
      8 {
      9     int rv;
     10 
     11     if (argc < 2)
     12         return -1;
     13 
     14     rv = system(argv[1]);
     15     if (rv < 0) {
     16         fprintf(stderr, "Error calling system(): %d\n", errno);
     17         return 1;
     18     }
     19 
     20     printf("Done!\n");
     21 
     22     if (WEXITSTATUS(rv) != 0) {
     23         fprintf(stderr, "Command returned non-zero exit code: %d\n",
     24                 WEXITSTATUS(rv));
     25         return 1;
     26     }
     27     return 0;
     28 }
     29