Update _call_proc for Windows

This commit is contained in:
Fierelier 2024-02-22 19:26:25 +01:00
parent 8826d32912
commit bf640567d4

View File

@ -66,14 +66,28 @@ int _call_proc(char * argv[]) {
int i;
for (i = 0; argv[i] != NULL; i++) {
commandLength += strlen(argv[i]) + 3;
int si;
for (si = 0; argv[i][si] != 0; si++) {
if (argv[i][si] == '"') {
commandLength++;
}
}
}
commandLength += 1;
command = malloc(commandLength);
command[0] = 0;
for (i = 0; argv[i] != NULL; i++) {
int si;
strcat(command,"\"");
strcat(command,argv[i]);
for (si = 0; argv[i][si] != 0; si++) {
if (argv[i][si] == '"') {
strcat(command,"\\");
}
strncat(command,(char *)&argv[i][si],1);
}
strcat(command,"\" ");
}
command[commandLength - 2] = 0;