aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--debianutils/which.c10
-rw-r--r--docs/ifupdown_design.txt2
-rw-r--r--include/libbb.h6
-rw-r--r--libbb/Kbuild.src2
-rw-r--r--libbb/executable.c (renamed from libbb/execable.c)12
-rw-r--r--networking/ifupdown.c4
6 files changed, 18 insertions, 18 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 15fd598b7..760bcdcad 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -46,7 +46,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
46#if ENABLE_DESKTOP 46#if ENABLE_DESKTOP
47/* Much bloat just to support -a */ 47/* Much bloat just to support -a */
48 if (strchr(*argv, '/')) { 48 if (strchr(*argv, '/')) {
49 if (execable_file(*argv)) { 49 if (file_is_executable(*argv)) {
50 puts(*argv); 50 puts(*argv);
51 continue; 51 continue;
52 } 52 }
@@ -55,7 +55,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
55 char *path2 = xstrdup(path); 55 char *path2 = xstrdup(path);
56 char *tmp = path2; 56 char *tmp = path2;
57 57
58 p = find_execable(*argv, &tmp); 58 p = find_executable(*argv, &tmp);
59 if (!p) 59 if (!p)
60 status = EXIT_FAILURE; 60 status = EXIT_FAILURE;
61 else { 61 else {
@@ -65,7 +65,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
65 if (opt) { 65 if (opt) {
66 /* -a: show matches in all PATH components */ 66 /* -a: show matches in all PATH components */
67 if (tmp) { 67 if (tmp) {
68 p = find_execable(*argv, &tmp); 68 p = find_executable(*argv, &tmp);
69 if (p) 69 if (p)
70 goto print; 70 goto print;
71 } 71 }
@@ -76,14 +76,14 @@ int which_main(int argc UNUSED_PARAM, char **argv)
76#else 76#else
77/* Just ignoring -a */ 77/* Just ignoring -a */
78 if (strchr(*argv, '/')) { 78 if (strchr(*argv, '/')) {
79 if (execable_file(*argv)) { 79 if (file_is_executable(*argv)) {
80 puts(*argv); 80 puts(*argv);
81 continue; 81 continue;
82 } 82 }
83 } else { 83 } else {
84 char *path2 = xstrdup(path); 84 char *path2 = xstrdup(path);
85 char *tmp = path2; 85 char *tmp = path2;
86 p = find_execable(*argv, &tmp); 86 p = find_executable(*argv, &tmp);
87 free(path2); 87 free(path2);
88 if (p) { 88 if (p) {
89 puts(p); 89 puts(p);
diff --git a/docs/ifupdown_design.txt b/docs/ifupdown_design.txt
index 8ab4e51ad..39e28a9f4 100644
--- a/docs/ifupdown_design.txt
+++ b/docs/ifupdown_design.txt
@@ -21,7 +21,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
21#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 21#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
22 int i ; 22 int i ;
23 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { 23 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
24 if (exists_execable(ext_dhcp_clients[i].name)) 24 if (executable_exists(ext_dhcp_clients[i].name))
25 return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); 25 return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
26 } 26 }
27 bb_error_msg("no dhcp clients found, using static interface shutdown"); 27 bb_error_msg("no dhcp clients found, using static interface shutdown");
diff --git a/include/libbb.h b/include/libbb.h
index 29cf6bc6d..afdee38c4 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -912,9 +912,9 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const
912#endif 912#endif
913 913
914 914
915int execable_file(const char *name) FAST_FUNC; 915int file_is_executable(const char *name) FAST_FUNC;
916char *find_execable(const char *filename, char **PATHp) FAST_FUNC; 916char *find_executable(const char *filename, char **PATHp) FAST_FUNC;
917int exists_execable(const char *filename) FAST_FUNC; 917int executable_exists(const char *filename) FAST_FUNC;
918 918
919/* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff), 919/* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff),
920 * but it may exec busybox and call applet instead of searching PATH. 920 * but it may exec busybox and call applet instead of searching PATH.
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;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index e1ea351a4..c35d97a1a 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -555,7 +555,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
555 return 0; 555 return 0;
556# endif 556# endif
557 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { 557 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
558 if (exists_execable(ext_dhcp_clients[i].name)) 558 if (executable_exists(ext_dhcp_clients[i].name))
559 return execute(ext_dhcp_clients[i].startcmd, ifd, exec); 559 return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
560 } 560 }
561 bb_error_msg("no dhcp clients found"); 561 bb_error_msg("no dhcp clients found");
@@ -592,7 +592,7 @@ static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
592 unsigned i; 592 unsigned i;
593 593
594 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { 594 for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
595 if (exists_execable(ext_dhcp_clients[i].name)) { 595 if (executable_exists(ext_dhcp_clients[i].name)) {
596 result = execute(ext_dhcp_clients[i].stopcmd, ifd, exec); 596 result = execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
597 if (result) 597 if (result)
598 break; 598 break;