returns the number of needed escapes for the string */
| 311 | returns the number of needed escapes for the string |
| 312 | */ |
| 313 | static int number_of_escapes(const char delim, const char *str) |
| 314 | { |
| 315 | int nesc = 0; |
| 316 | const char *s = str; |
| 317 | while (*s) { |
| 318 | if (*s == ESCAPE || *s == delim) |
| 319 | nesc++; |
| 320 | s++; |
| 321 | } |
| 322 | debug(fprintf(stderr, "escapes: %d ---%s---\n", nesc, str)); |
| 323 | return nesc; |
| 324 | } |
| 325 | |
| 326 | /* |
| 327 | replace name by replacement at the beginning of buf of bufsize. |