isescaped(): * Return true if the character in *p that belongs to a string * that starts in *sp, is escaped by the escape character esc. */
| 49 | * that starts in *sp, is escaped by the escape character esc. |
| 50 | */ |
| 51 | static int |
| 52 | isescaped(const char *sp, const char *p, int esc) |
| 53 | { |
| 54 | const char *cp; |
| 55 | size_t ne; |
| 56 | |
| 57 | #if 0 |
| 58 | _DIAGASSERT(sp != NULL); |
| 59 | _DIAGASSERT(p != NULL); |
| 60 | #endif |
| 61 | |
| 62 | /* No escape character */ |
| 63 | if (esc == '\0') |
| 64 | return 0; |
| 65 | |
| 66 | /* Count the number of escape characters that precede ours */ |
| 67 | for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++) |
| 68 | continue; |
| 69 | |
| 70 | /* Return true if odd number of escape characters */ |
| 71 | return (ne & 1) != 0; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | /* fparseln(): |