* 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>
|
Mon Sep 25 20:47:04 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.
|
* dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.
|
||||||
|
@ -235,3 +235,13 @@ cstrdup (const char *s)
|
|||||||
strcpy (p, s);
|
strcpy (p, s);
|
||||||
return p;
|
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_FHANDLER,
|
||||||
HEAP_STR,
|
HEAP_STR,
|
||||||
HEAP_ARGV,
|
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))
|
#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 crealloc (void *, DWORD);
|
||||||
void *__stdcall ccalloc (cygheap_types, DWORD, DWORD);
|
void *__stdcall ccalloc (cygheap_types, DWORD, DWORD);
|
||||||
char *__stdcall cstrdup (const char *);
|
char *__stdcall cstrdup (const char *);
|
||||||
|
char *__stdcall cstrdup1 (const char *);
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public:
|
|||||||
int argc;
|
int argc;
|
||||||
av (int ac, const char * const *av) : calloced (0), argc (ac)
|
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 *));
|
memcpy (argv, av, (argc + 1) * sizeof (char *));
|
||||||
}
|
}
|
||||||
~av ()
|
~av ()
|
||||||
@ -269,19 +269,19 @@ public:
|
|||||||
/* Note: Assumes that argv array has not yet been "unshifted" */
|
/* Note: Assumes that argv array has not yet been "unshifted" */
|
||||||
if (!calloced)
|
if (!calloced)
|
||||||
{
|
{
|
||||||
argv[0] = cstrdup (arg0);
|
argv[0] = cstrdup1 (arg0);
|
||||||
calloced = 1;
|
calloced = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void dup_maybe (int i)
|
void dup_maybe (int i)
|
||||||
{
|
{
|
||||||
if (i >= calloced)
|
if (i >= calloced)
|
||||||
argv[i] = cstrdup (argv[i]);
|
argv[i] = cstrdup1 (argv[i]);
|
||||||
}
|
}
|
||||||
void dup_all ()
|
void dup_all ()
|
||||||
{
|
{
|
||||||
for (int i = calloced; i < argc; i++)
|
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';
|
*p = '\0';
|
||||||
what = buf;
|
what = buf;
|
||||||
}
|
}
|
||||||
*argv = cstrdup (what);
|
*argv = cstrdup1 (what);
|
||||||
argc++;
|
argc++;
|
||||||
calloced++;
|
calloced++;
|
||||||
return 1;
|
return 1;
|
||||||
@ -367,7 +367,7 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
|||||||
return -1;
|
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->old_title = old_title ? cstrdup (old_title) : NULL;
|
||||||
ciresrv.moreinfo->fds = fdtab;
|
ciresrv.moreinfo->fds = fdtab;
|
||||||
ciresrv.moreinfo->nfds = fdtab.size;
|
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)
|
for (; (p = strpbrk (a, "\"\\")); a = ++p)
|
||||||
{
|
{
|
||||||
one_line.add (a, p - a);
|
one_line.add (a, p - a);
|
||||||
if (*p == '\\' || *p == '"')
|
if ((*p == '\\' && p[1] == '"') || *p == '"')
|
||||||
one_line.add ("\\", 1);
|
one_line.add ("\\", 1);
|
||||||
one_line.add (p, 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,
|
cygcwd.copy (ciresrv.moreinfo->cwd_posix, ciresrv.moreinfo->cwd_win32,
|
||||||
ciresrv.moreinfo->cwd_hash);
|
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;
|
char **c;
|
||||||
const char * const *e;
|
const char * const *e;
|
||||||
for (c = ciresrv.moreinfo->environ, e = envp; *e;)
|
for (c = ciresrv.moreinfo->environ, e = envp; *e;)
|
||||||
*c++ = cstrdup (*e++);
|
*c++ = cstrdup1 (*e++);
|
||||||
*c = NULL;
|
*c = NULL;
|
||||||
if (mode != _P_OVERLAY ||
|
if (mode != _P_OVERLAY ||
|
||||||
!DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv.moreinfo->myself_pinfo, 0,
|
!DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv.moreinfo->myself_pinfo, 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user