comparison win/dw.c @ 1923:ad3a32fd7008

Only add quotes to paramaters during dw_exec() if there are spaces in the parameter.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 12 Oct 2016 00:12:12 +0000
parents 102fca5f2e19
children 0448507827e6
comparison
equal deleted inserted replaced
1922:a2a8145f3148 1923:ad3a32fd7008
12016 12016
12017 newparams = (char **)malloc(sizeof(char *) * (count+1)); 12017 newparams = (char **)malloc(sizeof(char *) * (count+1));
12018 12018
12019 for(z=0;z<count;z++) 12019 for(z=0;z<count;z++)
12020 { 12020 {
12021 newparams[z] = malloc(strlen(params[z])+3); 12021 if(strchr(params[z], ' '))
12022 strcpy(newparams[z], "\""); 12022 {
12023 strcat(newparams[z], params[z]); 12023 newparams[z] = malloc(strlen(params[z])+3);
12024 strcat(newparams[z], "\""); 12024 strcpy(newparams[z], "\"");
12025 strcat(newparams[z], params[z]);
12026 strcat(newparams[z], "\"");
12027 }
12028 else
12029 newparams[z] = strdup(params[z]);
12025 } 12030 }
12026 newparams[count] = NULL; 12031 newparams[count] = NULL;
12027 12032
12028 /* Why does this return intptr_t ... can the PID exceed an integer value? */ 12033 /* Why does this return intptr_t ... can the PID exceed an integer value? */
12029 retcode = (int)_spawnvp(P_NOWAIT, program, (const char * const *)newparams); 12034 retcode = (int)_spawnvp(P_NOWAIT, program, (const char * const *)newparams);