Split `s` in place at tabs into at most `max` fields; returns the count. */
| 760 | |
| 761 | /* Split `s` in place at tabs into at most `max` fields; returns the count. */ |
| 762 | static int split_fields(char *s, char **out, int max) { |
| 763 | int n = 0; |
| 764 | out[n++] = s; |
| 765 | for (char *p = s; *p && n < max; p++) { |
| 766 | if (*p == '\t') { |
| 767 | *p = '\0'; |
| 768 | out[n++] = p + SKIP_ONE; |
| 769 | } |
| 770 | } |
| 771 | return n; |
| 772 | } |
| 773 | |
| 774 | static int count_list(const char *s, char sep) { |
| 775 | if (!s || !s[0]) { |