Escape token for output as CSV string.
| 1204 | |
| 1205 | // Escape token for output as CSV string. |
| 1206 | void CSV_escape(FILE *out, const char *token) |
| 1207 | { |
| 1208 | const char *p; |
| 1209 | // start CSV string: |
| 1210 | fputc('"', out); |
| 1211 | for (p = token; *p; p++) { |
| 1212 | if (*p == '\n') { // escape embedded real new lines |
| 1213 | fputs("\\n", out); |
| 1214 | continue; |
| 1215 | } |
| 1216 | if (*p == '"') |
| 1217 | fputc('"', out); |
| 1218 | fputc(*p, out); |
| 1219 | } |
| 1220 | // end CSV string: |
| 1221 | fputc('"', out); |
| 1222 | } |
| 1223 | |
| 1224 | // Escape token for output as JSON string. |
| 1225 | void JSON_escape(FILE *out, const char *token) |