Emit the current token if non-empty. Returns updated count. */
| 19 | |
| 20 | /* Emit the current token if non-empty. Returns updated count. */ |
| 21 | static int emit_token(char *current, int *clen, char **out, int count, int max_out) { |
| 22 | if (*clen > 0 && count < max_out) { |
| 23 | current[*clen] = '\0'; |
| 24 | out[count++] = strdup(current); |
| 25 | *clen = 0; |
| 26 | } |
| 27 | return count; |
| 28 | } |
| 29 | |
| 30 | int cbm_split_command(const char *cmd, char **out, int max_out) { |
| 31 | if (!cmd || !out || max_out <= 0) { |