4 void fold_text(const char *text,
6 int line_cb(void *arg, const char *start, int len),
9 const char *start, *end, *sep;
12 start = end = sep = text;
17 rc = line_cb(arg, start, end - start);
20 } else if (*end == '\0') {
21 line_cb(arg, start, end - start);
24 } else if (end - start >= linelen - 1) {
26 /* split on a previous word boundary, if
28 rc = line_cb(arg, start, sep - start);
31 /* otherwise, break the word */
33 rc = line_cb(arg, start, end - start);
39 /* record our last separator */