8 #define B2G_NAME "b2g-bin"
11 #define GAIA_PATH "gaia/profile"
13 #define NOMEM "Could not allocate enough memory"
15 void error(char* msg
){
16 fprintf(stderr
, "ERROR: %s\n", msg
);
19 int main(int argc
, char* argv
[], char* envp
[]){
21 char* full_path
= NULL
;
22 char* full_profile_path
= NULL
;
23 printf("Starting %s\n", B2G_NAME
);
24 cwd
= realpath(dirname(argv
[0]), NULL
);
25 full_path
= (char*) malloc(strlen(cwd
) + strlen(B2G_NAME
) + 2);
30 full_profile_path
= (char*) malloc(strlen(cwd
) + strlen(GAIA_PATH
) + 2);
31 if (!full_profile_path
) {
35 sprintf(full_path
, "%s/%s", cwd
, B2G_NAME
);
36 sprintf(full_profile_path
, "%s/%s", cwd
, GAIA_PATH
);
38 printf("Running: %s -profile %s\n", full_path
, full_profile_path
);
41 execle(full_path
, full_path
, "-profile", full_profile_path
, NULL
, envp
);
42 error("unable to start");
45 free(full_profile_path
);