strsep is nice, but not standard enough to use in the JDK. OTOH, strcspn is already used in the JDK, but doesn't really buy much:
for (i = 0; i < count; i++) {
int len = strcspn(p, ":");
pathv[i] = (len == 0) ? "." : p;
p[len] = '\0';
p += len + 1;
}
On Thu, Mar 28, 2013 at 12:10 PM, Christos Zoulas <[email protected]>wrote:
>
> + for (i = 0; (pathv[i] = strsep(&p, ":")) != NULL; i++)
> + if (!pathv[i][0])
> + pathv[i] = ".";
>
> christos
>
