OrionUserland
Barry Importing existing Orion Userland 19aefaa (2 years, 4 months ago)diff --git a/sh/parser.c b/sh/parser.c new file mode 100644 index 0000000..6c0af04 --- /dev/null +++ b/sh/parser.c @@ -0,0 +1,24 @@ +#include <string.h> + +/* Split a string into separate strings */ +int +argparser(char *str, char **res) +{ + int count = 0; + char *finder; + + memset(res, 0, 1024); + finder = str; + while (*finder == ' ') finder++; + res[count++] = finder; + while (*finder) { + if (*finder == ' ') { + res[count++] = finder + 1; + *finder = '\0'; + } + finder++; + } + res[count] = NULL; + + return count; +}