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 // XXX: yes, the printf above says --profile and this execle uses -profile.
42 // Bug 1088430 will change the execle to use --profile.
43 execle(full_path
, full_path
, "-profile", full_profile_path
, NULL
, envp
);
44 error("unable to start");
47 free(full_profile_path
);