child_create_inferior (char *exec_file, char *allargs, char **env)
child_create_inferior (char *exec_file, char *allargs, char **env, int from_tty)
child_create_inferior (char *exec_file, char *allargs, char **env){  char *winenv;  char *temp;  int envlen;  int i;  STARTUPINFO si;  PROCESS_INFORMATION pi;  BOOL ret;  DWORD flags;  char *args;  char real_path[MAXPATHLEN];  char *toexec;  char shell[MAX_PATH + 1]; /* Path to shell */  const char *sh;  int tty;  int ostdin, ostdout, ostderr;  if (!exec_file)    error ("No executable specified, use `target exec'.\n");  memset (&si, 0, sizeof (si));  si.cb = sizeof (si);  if (!useshell)    {      flags = DEBUG_ONLY_THIS_PROCESS;      cygwin_conv_to_win32_path (exec_file, real_path);      toexec = real_path;    }  else    {      char *newallargs;      sh = getenv ("SHELL");      if (!sh)	sh = "/bin/sh";      cygwin_conv_to_win32_path (sh, shell);      newallargs = alloca (sizeof (" -c 'exec  '") + strlen (exec_file)			   + strlen (allargs) + 2);      sprintf (newallargs, " -c 'exec %s %s'", exec_file, allargs);      allargs = newallargs;      toexec = shell;      flags = DEBUG_PROCESS;    }  if (new_group)    flags |= CREATE_NEW_PROCESS_GROUP;  if (new_console)    flags |= CREATE_NEW_CONSOLE;  attach_flag = 0;  args = alloca (strlen (toexec) + strlen (allargs) + 2);  strcpy (args, toexec);  strcat (args, " ");  strcat (args, allargs);  /* Prepare the environment vars for CreateProcess.  */  {    /* This code used to assume all env vars were file names and would       translate them all to win32 style.  That obviously doesn't work in the       general case.  The current rule is that we only translate PATH.       We need to handle PATH because we're about to call CreateProcess and       it uses PATH to find DLL's.  Fortunately PATH has a well-defined value       in both posix and win32 environments.  cygwin.dll will change it back       to posix style if necessary.  */    static const char *conv_path_names[] =    {      "PATH=",      0    };    /* CreateProcess takes the environment list as a null terminated set of       strings (i.e. two nulls terminate the list).  */    /* Get total size for env strings.  */    for (envlen = 0, i = 0; env[i] && *env[i]; i++)      {	int j, len;	for (j = 0; conv_path_names[j]; j++)	  {	    len = strlen (conv_path_names[j]);	    if (strncmp (conv_path_names[j], env[i], len) == 0)	      {		if (cygwin_posix_path_list_p (env[i] + len))		  envlen += len		    + cygwin_posix_to_win32_path_list_buf_size (env[i] + len);		else		  envlen += strlen (env[i]) + 1;		break;	      }	  }	if (conv_path_names[j] == NULL)	  envlen += strlen (env[i]) + 1;      }    winenv = alloca (envlen + 1);    /* Copy env strings into new buffer.  */    for (temp = winenv, i = 0; env[i] && *env[i]; i++)      {	int j, len;	for (j = 0; conv_path_names[j]; j++)	  {	    len = strlen (conv_path_names[j]);	    if (strncmp (conv_path_names[j], env[i], len) == 0)	      {		if (cygwin_posix_path_list_p (env[i] + len))		  {		    memcpy (temp, env[i], len);		    cygwin_posix_to_win32_path_list (env[i] + len, temp + len);		  }		else		  strcpy (temp, env[i]);		break;	      }	  }	if (conv_path_names[j] == NULL)	  strcpy (temp, env[i]);	temp += strlen (temp) + 1;      }    /* Final nil string to terminate new env.  */    *temp = 0;  }  if (!inferior_io_terminal)    tty = ostdin = ostdout = ostderr = -1;  else    {      tty = open (inferior_io_terminal, O_RDWR | O_NOCTTY);      if (tty < 0)	{	  print_sys_errmsg (inferior_io_terminal, errno);	  ostdin = ostdout = ostderr = -1;	}      else	{	  ostdin = dup (0);	  ostdout = dup (1);	  ostderr = dup (2);	  dup2 (tty, 0);	  dup2 (tty, 1);	  dup2 (tty, 2);	}    }  ret = CreateProcess (0,		       args,	/* command line */		       NULL,	/* Security */		       NULL,	/* thread */		       TRUE,	/* inherit handles */		       flags,	/* start flags */		       winenv,		       NULL,	/* current directory */		       &si,		       &pi);  if (tty >= 0)    {      close (tty);      dup2 (ostdin, 0);      dup2 (ostdout, 1);      dup2 (ostderr, 2);      close (ostdin);      close (ostdout);      close (ostderr);    }  if (!ret)    error ("Error creating process %s, (error %d)\n", exec_file, (unsigned) GetLastError ());  CloseHandle (pi.hThread);  CloseHandle (pi.hProcess);  if (useshell && shell[0] != '\0')    saw_create = -1;  else    saw_create = 0;  do_initial_child_stuff (pi.dwProcessId);  /* child_continue (DBG_CONTINUE, -1); */  proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0);}