* spawn.cc (spawn_guts): Attempt to accomodate archaic windows quoting
mechanism when dealing with '\' and '"'.
This commit is contained in:
parent
03de9775c4
commit
e564846577
|
@ -1,3 +1,8 @@
|
|||
Wed Sep 27 01:10:07 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* spawn.cc (spawn_guts): Attempt to accomodate archaic windows quoting
|
||||
mechanism when dealing with '\' and '"'.
|
||||
|
||||
Mon Sep 25 20:47:04 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.
|
||||
|
|
|
@ -235,3 +235,13 @@ cstrdup (const char *s)
|
|||
strcpy (p, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
extern "C" char *__stdcall
|
||||
cstrdup1 (const char *s)
|
||||
{
|
||||
char *p = (char *) cmalloc (HEAP_1_STR, strlen (s) + 1);
|
||||
if (!p)
|
||||
return NULL;
|
||||
strcpy (p, s);
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,12 @@ enum cygheap_types
|
|||
HEAP_FHANDLER,
|
||||
HEAP_STR,
|
||||
HEAP_ARGV,
|
||||
HEAP_EXEC,
|
||||
HEAP_BUF
|
||||
HEAP_BUF,
|
||||
HEAP_1_START,
|
||||
HEAP_1_STR,
|
||||
HEAP_1_ARGV,
|
||||
HEAP_1_BUF,
|
||||
HEAP_1_EXEC
|
||||
};
|
||||
|
||||
#define CYGHEAPSIZE ((1000 * sizeof (fhandler_union)) + (2 * 65536))
|
||||
|
@ -34,4 +38,5 @@ void *__stdcall cmalloc (cygheap_types, DWORD);
|
|||
void *__stdcall crealloc (void *, DWORD);
|
||||
void *__stdcall ccalloc (cygheap_types, DWORD, DWORD);
|
||||
char *__stdcall cstrdup (const char *);
|
||||
char *__stdcall cstrdup1 (const char *);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ public:
|
|||
int argc;
|
||||
av (int ac, const char * const *av) : calloced (0), argc (ac)
|
||||
{
|
||||
argv = (char **) cmalloc (HEAP_ARGV, (argc + 1) * sizeof (char *));
|
||||
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 1) * sizeof (char *));
|
||||
memcpy (argv, av, (argc + 1) * sizeof (char *));
|
||||
}
|
||||
~av ()
|
||||
|
@ -269,19 +269,19 @@ public:
|
|||
/* Note: Assumes that argv array has not yet been "unshifted" */
|
||||
if (!calloced)
|
||||
{
|
||||
argv[0] = cstrdup (arg0);
|
||||
argv[0] = cstrdup1 (arg0);
|
||||
calloced = 1;
|
||||
}
|
||||
}
|
||||
void dup_maybe (int i)
|
||||
{
|
||||
if (i >= calloced)
|
||||
argv[i] = cstrdup (argv[i]);
|
||||
argv[i] = cstrdup1 (argv[i]);
|
||||
}
|
||||
void dup_all ()
|
||||
{
|
||||
for (int i = calloced; i < argc; i++)
|
||||
argv[i] = cstrdup (argv[i]);
|
||||
argv[i] = cstrdup1 (argv[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -304,7 +304,7 @@ av::unshift (const char *what, int conv)
|
|||
*p = '\0';
|
||||
what = buf;
|
||||
}
|
||||
*argv = cstrdup (what);
|
||||
*argv = cstrdup1 (what);
|
||||
argc++;
|
||||
calloced++;
|
||||
return 1;
|
||||
|
@ -367,7 +367,7 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
|||
return -1;
|
||||
}
|
||||
|
||||
ciresrv.moreinfo = (cygheap_exec_info *) ccalloc (HEAP_EXEC, 1, sizeof (cygheap_exec_info));
|
||||
ciresrv.moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info));
|
||||
ciresrv.moreinfo->old_title = old_title ? cstrdup (old_title) : NULL;
|
||||
ciresrv.moreinfo->fds = fdtab;
|
||||
ciresrv.moreinfo->nfds = fdtab.size;
|
||||
|
@ -506,7 +506,7 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
|||
for (; (p = strpbrk (a, "\"\\")); a = ++p)
|
||||
{
|
||||
one_line.add (a, p - a);
|
||||
if (*p == '\\' || *p == '"')
|
||||
if ((*p == '\\' && p[1] == '"') || *p == '"')
|
||||
one_line.add ("\\", 1);
|
||||
one_line.add (p, 1);
|
||||
}
|
||||
|
@ -534,11 +534,11 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
|||
cygcwd.copy (ciresrv.moreinfo->cwd_posix, ciresrv.moreinfo->cwd_win32,
|
||||
ciresrv.moreinfo->cwd_hash);
|
||||
|
||||
ciresrv.moreinfo->environ = (char **) cmalloc (HEAP_ARGV, envsize (envp, 1));
|
||||
ciresrv.moreinfo->environ = (char **) cmalloc (HEAP_1_ARGV, envsize (envp, 1));
|
||||
char **c;
|
||||
const char * const *e;
|
||||
for (c = ciresrv.moreinfo->environ, e = envp; *e;)
|
||||
*c++ = cstrdup (*e++);
|
||||
*c++ = cstrdup1 (*e++);
|
||||
*c = NULL;
|
||||
if (mode != _P_OVERLAY ||
|
||||
!DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv.moreinfo->myself_pinfo, 0,
|
||||
|
|
Loading…
Reference in New Issue