Created
December 31, 2013 16:24
-
-
Save dagon666/8199128 to your computer and use it in GitHub Desktop.
count arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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