Fixed modification of parameters

Monitor parameters were being modified in externcmd_allocate which caused truncation
of the arguments to the commands.
This commit is contained in:
Markus Makela
2015-11-11 15:17:29 +02:00
parent 8363673be6
commit c5c416e7fe

View File

@ -6,15 +6,17 @@
* @param argv Array of char pointers to be filled with tokenized arguments * @param argv Array of char pointers to be filled with tokenized arguments
* @return 0 on success, -1 on error * @return 0 on success, -1 on error
*/ */
int tokenize_arguments(char* args, char** argv) int tokenize_arguments(char* argstr, char** argv)
{ {
int i = 0; int i = 0;
bool quoted = false; bool quoted = false;
bool read = false; bool read = false;
bool escaped = false; bool escaped = false;
char *ptr,*start; char *ptr,*start;
char args[strlen(argstr)];
char qc; char qc;
strcpy(args, argstr);
start = args; start = args;
ptr = start; ptr = start;