Mail Archives: djgpp-workers/2003/05/11/10:35:18
> From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
> Date: Sat, 10 May 2003 23:06:49 -0500 (CDT)
>
> (yes, I know it could be more defensive on buffer sizes, but I've been
> up for over 24 hours straight right now flying back from europe and I
> really don't care ;-P
How about making the buffer where you assemble the command line be 64K
long? The transfer buffer can never be larger, not until MWDPMI hits
the street, anyway ;-)
> +static int myspawn(const char **argv)
> +{
> + char cmd[10240];
> + strcpy(cmd, argv[0]);
> + argv++;
> + while (argv[0]) {
> + strcat(cmd, " ");
> + strcat(cmd, argv[0]);
> + argv++;
> + };
> + return system(cmd);
> +}
I have one more concern about replacing `spawn*' with `system': they
behave differently as far as argument quoting is considered. Thus, if
some file names include whitespace or other characters that need to be
quoted (like quote characters themselves), we are up for a bumpy
ride...
To remedy this, we need to quote every arg that needs it (or maybe
just quote all of them).
- Raw text -