| * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu> |
| * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
| /* check if path points to an executable file; |
| int execable_file(const char *name) |
| return (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode)); |
| /* search $PATH for an executable file; |
| * return allocated string containing full path if found; |
| char *find_execable(const char *filename) |
| p = path = xstrdup(getenv("PATH")); |
| if (*p != '\0') { /* it's not a PATH="foo::bar" situation */ |
| p = concat_path_file(p, filename); |
| /* search $PATH for an executable file; |
| int exists_execable(const char *filename) |
| char *ret = find_execable(filename); |
| #if ENABLE_FEATURE_PREFER_APPLETS |
| /* just like the real execvp, but try to launch an applet named 'file' first |
| int bb_execvp(const char *file, char *const argv[]) |
| return execvp(find_applet_by_name(file) ? bb_busybox_exec_path : file, |