libtbx_build = getenv("LIBTBX_BUILD"); assert(libtbx_build != NULL); dispatcher = malloc(strlen(libtbx_build) + strlen(dispatcher_name) + 1); assert(dispatcher != NULL); strcpy(dispatcher, libtbx_build);
strcpy(env_var_name, application_prefix); strcat(env_var_name, "_BUILD"); env_build = getenv_certain(argv[0], env_var_name); dispatcher = malloc_certain( argv[0], strlen(env_build) + strlen(dispatcher_name) + 1); strcpy(dispatcher, env_build);
main(int argc, char *const argv[]){  char* libtbx_python_exe;  char* libtbx_build;  char* dispatcher;  char** extended_argv;  int n, i;  const char* dispatcher_name = "\\dispatcher";  _putenv("PYTHONHOME=");  libtbx_python_exe = getenv("LIBTBX_PYTHON_EXE");  assert(libtbx_python_exe != NULL);  extended_argv = malloc((argc + 3) * sizeof(char*));  assert(extended_argv != NULL);  extended_argv[0] = libtbx_python_exe;  n = 1;  i = 1;  if (!is_python_exe(argv[0])) {    libtbx_build = getenv("LIBTBX_BUILD");    assert(libtbx_build != NULL);    dispatcher = malloc(strlen(libtbx_build) + strlen(dispatcher_name) + 1);    assert(dispatcher != NULL);    strcpy(dispatcher, libtbx_build);    strcat(dispatcher, dispatcher_name);    extended_argv[n++] = dispatcher;    i = 0;  }  for(;i<argc;i++,n++) {    extended_argv[n] = malloc(strlen(argv[i]) + 3);    assert(extended_argv[n] != NULL);    strcpy(extended_argv[n], "\"");    strcat(extended_argv[n], argv[i]);    strcat(extended_argv[n], "\"");  }  extended_argv[n] = NULL;  spawnv(P_WAIT, extended_argv[0], extended_argv);  if (errno) {    perror(argv[0]);    return 1;  }  return 0;}