Skip to content

Instantly share code, notes, and snippets.

@dagon666
Created December 31, 2013 16:24
Show Gist options
  • Save dagon666/8199128 to your computer and use it in GitHub Desktop.
Save dagon666/8199128 to your computer and use it in GitHub Desktop.
count arguments
static unsigned char _cli_count_arguments(t_cli_ctx *a_ctx) {
char *cur = a_ctx->cmd;
unsigned char cnt = 0;
for(;;) {
while (*cur == ' ') cur++;
if (*cur == '\0') break;
cnt++;
while (*cur != '\0' && *cur != ' ') {
cur++;
}
}
return cnt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment