BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionUserland / blob / 2e110925c3be315a94bfbf15cecbdaa0746bfe32 / sh / parser.c

// Related

OrionUserland

Barry Using POSIX names in structs 2e11092 (2 years, 4 months ago)
#include <string.h>

/* Split a string into separate strings */
int
argparser(char sep, char *str, char **res)
{
	int count = 0;
	char *finder;

	memset(res, 0, 1024);
	finder = str;
	while (*finder == sep) finder++;
	res[count++] = finder;
	while (*finder) {
		if (*finder == sep) {
			res[count++] = finder + 1;
			*finder = '\0';
		}
		finder++;
	}
	res[count] = NULL;

	return count;
}