[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.7,1.8 spawn.c,1.5,1.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.7,1.8 spawn.c,1.5,1.6 |
Date: |
Mon, 16 Dec 2002 01:26:17 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv7025/support
Modified Files:
cmdline.c spawn.c
Log Message:
Improve response file handling for mingw32 systems.
Index: cmdline.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/cmdline.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** cmdline.c 14 Dec 2002 22:16:59 -0000 1.7
--- cmdline.c 16 Dec 2002 06:26:13 -0000 1.8
***************
*** 353,358 ****
}
- #ifndef IL_WIN32_NATIVE
-
/*
* Abort due to insufficient memory.
--- 353,356 ----
***************
*** 395,403 ****
char buffer[BUFSIZ];
char *temp;
/* See if we have any response file references first */
for(arg = 1; arg < *argc; ++arg)
{
! if((*argv)[arg][0] == '@' && (*argv)[arg][1] == '"')
{
break;
--- 393,402 ----
char buffer[BUFSIZ];
char *temp;
+ char *respfile;
/* See if we have any response file references first */
for(arg = 1; arg < *argc; ++arg)
{
! if((*argv)[arg][0] == '@')
{
break;
***************
*** 417,432 ****
for(arg = 1; arg < *argc; ++arg)
{
! if((*argv)[arg][0] == '@' && (*argv)[arg][1] == '"')
{
/* Response file reference */
! len = strlen((*argv)[arg]);
! if(len >= 3 && (*argv)[arg][len - 1] == '"')
{
! filename = ILDupString((*argv)[arg] + 2);
if(!filename)
{
OutOfMemory();
}
- filename[len - 3] = '\0';
if((file = fopen(filename, "r")) == NULL)
{
--- 416,443 ----
for(arg = 1; arg < *argc; ++arg)
{
! if((*argv)[arg][0] == '@')
{
/* Response file reference */
! respfile = (*argv)[arg] + 1;
! if(*respfile == '"')
! {
! ++respfile;
! len = strlen(respfile);
! if(len > 0 && respfile[len - 1] == '"')
! {
! --len;
! }
! }
! else
{
! len = strlen(respfile);
! }
! if(len > 0)
! {
! filename = ILDupNString(respfile, len);
if(!filename)
{
OutOfMemory();
}
if((file = fopen(filename, "r")) == NULL)
{
***************
*** 482,509 ****
*argv = newArgv;
}
-
- #else /* IL_WIN32_NATIVE */
-
- void ILCmdLineExpand(int *argc, char ***argv)
- {
- /* Visual Studio's command-line parser already expands response files */
- }
-
- /*
- * This function stub forces Visual Studio to use a
- * command-line argument parser that supports wildcards.
- */
-
- #if !defined(__MINGW32__)
-
- void __cdecl _setargv(void)
- {
- extern void __cdecl __setargv(void);
- __setargv();
- }
-
- #endif /* !__MINGW32__ */
-
- #endif /* IL_WIN32_NATIVE */
void ILCmdLineSuppressSlash(void)
--- 493,496 ----
Index: spawn.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/spawn.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** spawn.c 13 Dec 2002 11:24:47 -0000 1.5
--- spawn.c 16 Dec 2002 06:26:13 -0000 1.6
***************
*** 57,61 ****
#endif
! #ifdef _WIN32
/*
--- 57,61 ----
#endif
! #ifdef IL_WIN32_NATIVE
/*
***************
*** 68,71 ****
--- 68,73 ----
char **newargv = 0;
char *tempfile = 0;
+ char *quotedprog = 0;
+ char *program = argv[0];
int status;
char temppath[MAX_PATH];
***************
*** 78,82 ****
fit in the system's command-line buffer. If so, we
must write the options to a temporary file instead */
! arg = 1;
len = 0;
useResponseFile = 0;
--- 80,84 ----
fit in the system's command-line buffer. If so, we
must write the options to a temporary file instead */
! arg = 0;
len = 0;
useResponseFile = 0;
***************
*** 110,113 ****
--- 112,119 ----
++arg;
}
+ if(!arg && useResponseFile)
+ {
+ ++arg;
+ }
/* Does the command-line need quoting? */
***************
*** 158,162 ****
return -1;
}
! for(arg = 0; arg < responsePosn; ++arg)
{
newargv[arg] = argv[arg];
--- 164,179 ----
return -1;
}
! quotedprog = (char *)ILMalloc(strlen(argv[0]) + 3);
! if(!quotedprog)
! {
! ILFree(newargv);
! DeleteFile(tempfile);
! return -1;
! }
! quotedprog[0] = '"';
! strcpy(quotedprog + 1, argv[0]);
! strcat(quotedprog, "\"");
! newargv[0] = quotedprog;
! for(arg = 1; arg < responsePosn; ++arg)
{
newargv[arg] = argv[arg];
***************
*** 168,172 ****
/* Spawn the child process and wait for it to exit */
! status = spawnvp(_P_WAIT, argv[0], (char * const *)argv);
/* Delete the temporary option file */
--- 185,189 ----
/* Spawn the child process and wait for it to exit */
! status = spawnvp(_P_WAIT, program, (char * const *)argv);
/* Delete the temporary option file */
***************
*** 180,183 ****
--- 197,204 ----
{
ILFree(newargv);
+ }
+ if(quotedprog)
+ {
+ ILFree(quotedprog);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.7,1.8 spawn.c,1.5,1.6,
Rhys Weatherley <address@hidden> <=