rendered paste bodyvector<char*> splitArgs(char *command) { vector<char*> args; int len = (int)strlen(command); bool inQuotes = false; int lastIndex = 0; for(int i = 0; i < len; i++) { if(command[i] == ' ') { if(!inQuotes) { args.push_back(substring(command, lastIndex, i)); lastIndex = i + 1; } } else if(command[i] == '\"') { if(!inQuotes) { lastIndex = i; inQuotes = true; } else { args.push_back(substring(command, lastIndex + 1, i)); lastIndex = (i += 1); inQuotes = false; } } else if((i + 1) == len) { args.push_back(substring(command, lastIndex + 1, i + 1)); } } return args;}