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