aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-05-02 17:15:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2014-05-02 17:15:58 +0200
commite765b5ac349a8f9305e52b3ab2c3ac78c17bf283 (patch)
tree2dec8a3b34450b7088ae7c3a4b374e953c0a4a73 /libbb
parent15a357e5962634c94ee322fee4da897312090a89 (diff)
downloadbusybox-w32-e765b5ac349a8f9305e52b3ab2c3ac78c17bf283.tar.gz
busybox-w32-e765b5ac349a8f9305e52b3ab2c3ac78c17bf283.tar.bz2
busybox-w32-e765b5ac349a8f9305e52b3ab2c3ac78c17bf283.zip
libbb: rename execable -> executable. No code changes
English speakers complained that it sounded awfully broken. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild.src2
-rw-r--r--libbb/executable.c (renamed from libbb/execable.c)12
2 files changed, 7 insertions, 7 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index a6468f171..6578d1171 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -30,7 +30,7 @@ lib-y += crc32.o
30lib-y += default_error_retval.o 30lib-y += default_error_retval.o
31lib-y += device_open.o 31lib-y += device_open.o
32lib-y += dump.o 32lib-y += dump.o
33lib-y += execable.o 33lib-y += executable.o
34lib-y += fclose_nonstdin.o 34lib-y += fclose_nonstdin.o
35lib-y += fflush_stdout_and_exit.o 35lib-y += fflush_stdout_and_exit.o
36lib-y += fgets_str.o 36lib-y += fgets_str.o
diff --git a/libbb/execable.c b/libbb/executable.c
index a3caea6f9..85ecc3e6c 100644
--- a/libbb/execable.c
+++ b/libbb/executable.c
@@ -13,7 +13,7 @@
13 * return 1 if found; 13 * return 1 if found;
14 * return 0 otherwise; 14 * return 0 otherwise;
15 */ 15 */
16int FAST_FUNC execable_file(const char *name) 16int FAST_FUNC file_is_executable(const char *name)
17{ 17{
18 struct stat s; 18 struct stat s;
19 return (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode)); 19 return (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode));
@@ -23,12 +23,12 @@ int FAST_FUNC execable_file(const char *name)
23 * return allocated string containing full path if found; 23 * return allocated string containing full path if found;
24 * PATHp points to the component after the one where it was found 24 * PATHp points to the component after the one where it was found
25 * (or NULL), 25 * (or NULL),
26 * you may call find_execable again with this PATHp to continue 26 * you may call find_executable again with this PATHp to continue
27 * (if it's not NULL). 27 * (if it's not NULL).
28 * return NULL otherwise; (PATHp is undefined) 28 * return NULL otherwise; (PATHp is undefined)
29 * in all cases (*PATHp) contents will be trashed (s/:/NUL/). 29 * in all cases (*PATHp) contents will be trashed (s/:/NUL/).
30 */ 30 */
31char* FAST_FUNC find_execable(const char *filename, char **PATHp) 31char* FAST_FUNC find_executable(const char *filename, char **PATHp)
32{ 32{
33 /* About empty components in $PATH: 33 /* About empty components in $PATH:
34 * http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html 34 * http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
@@ -49,7 +49,7 @@ char* FAST_FUNC find_execable(const char *filename, char **PATHp)
49 p[0] ? p : ".", /* handle "::" case */ 49 p[0] ? p : ".", /* handle "::" case */
50 filename 50 filename
51 ); 51 );
52 if (execable_file(p)) { 52 if (file_is_executable(p)) {
53 *PATHp = n; 53 *PATHp = n;
54 return p; 54 return p;
55 } 55 }
@@ -63,11 +63,11 @@ char* FAST_FUNC find_execable(const char *filename, char **PATHp)
63 * return 1 if found; 63 * return 1 if found;
64 * return 0 otherwise; 64 * return 0 otherwise;
65 */ 65 */
66int FAST_FUNC exists_execable(const char *filename) 66int FAST_FUNC executable_exists(const char *filename)
67{ 67{
68 char *path = xstrdup(getenv("PATH")); 68 char *path = xstrdup(getenv("PATH"));
69 char *tmp = path; 69 char *tmp = path;
70 char *ret = find_execable(filename, &tmp); 70 char *ret = find_executable(filename, &tmp);
71 free(path); 71 free(path);
72 free(ret); 72 free(ret);
73 return ret != NULL; 73 return ret != NULL;