non-busybox dhcp clients (was: PATCH: ifupdown.c, udhcpc, and standalone shell)
Gabriel L. Somlo
somlo at cmu.edu
Thu Oct 5 15:37:29 UTC 2006
>> What if you build busybox with 'which' turned off ?
>
> this problem is already well-solved. the code goes into libbb, where
> any applet that needs it can use it.
We're talking about this much code:
static int execable(char *program)
{
struct stat buf;
char *path = xstrdup(getenv("PATH"));
char *p;
int found = 0;
for (p = strtok(path, ":"); p && !found; p = strtok(NULL, ":")) {
p = xasprintf("%s/%s", p, program);
found = (stat(p, &buf) == 0) &&
S_ISREG(buf.st_mode) && (S_IXUSR & buf.st_mode);
free(p);
}
free(path);
return found;
}
Is there anything in libbb that I can use instead of this ? If not,
and you guys want to add something in there, let me know and I'll use
it :)
Thanks,
Gabriel
More information about the busybox
mailing list