|
|
@ -105,19 +105,17 @@ static char* process_quotes_and_slashes( char* start, char find, char replace_wi
|
|
|
|
char *dataPut = start;
|
|
|
|
char *dataPut = start;
|
|
|
|
int inEscape = 0;
|
|
|
|
int inEscape = 0;
|
|
|
|
int inQuotes = 0;
|
|
|
|
int inQuotes = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (; *start; start++) {
|
|
|
|
for (; *start; start++) {
|
|
|
|
if (inEscape) {
|
|
|
|
if (inEscape) {
|
|
|
|
*dataPut++ = *start; /* Always goes verbatim */
|
|
|
|
*dataPut++ = *start; /* Always goes verbatim */
|
|
|
|
inEscape = 0;
|
|
|
|
inEscape = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (*start == '\\') {
|
|
|
|
if (*start == '\\') {
|
|
|
|
inEscape = 1; /* Do not copy \ into the data */
|
|
|
|
inEscape = 1; /* Do not copy \ into the data */
|
|
|
|
}
|
|
|
|
} else if (*start == '\"') {
|
|
|
|
else if( *start == '\"' ) {
|
|
|
|
|
|
|
|
inQuotes = 1-inQuotes; /* Do not copy " into the data */
|
|
|
|
inQuotes = 1-inQuotes; /* Do not copy " into the data */
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
/* Replace , with |, unless in quotes */
|
|
|
|
/* Replace , with |, unless in quotes */
|
|
|
|
*dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start);
|
|
|
|
*dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start);
|
|
|
|
}
|
|
|
|
}
|
|
|
|