aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-03-01 11:48:04 +0000
committerRon Yorston <rmy@pobox.com>2021-03-01 11:48:04 +0000
commite2e8e16b465d34759678b8170c44ce62c5b74eb0 (patch)
treeabc31e3e2c1d0de089ae5e1e6d37672394757af9 /libbb/lineedit.c
parentb5cd41cdf4e6afd475fe34b755f99578e20b08ca (diff)
parent9b6bcfda0e11c0e73a966a77110f6c68425cff34 (diff)
downloadbusybox-w32-e2e8e16b465d34759678b8170c44ce62c5b74eb0.tar.gz
busybox-w32-e2e8e16b465d34759678b8170c44ce62c5b74eb0.tar.bz2
busybox-w32-e2e8e16b465d34759678b8170c44ce62c5b74eb0.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 55141e141..205044630 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -829,8 +829,6 @@ static unsigned path_parse(char ***p)
829 if (!tmp) 829 if (!tmp)
830 break; 830 break;
831 tmp++; 831 tmp++;
832 if (*tmp == '\0')
833 break; /* :<empty> */
834 npth++; 832 npth++;
835 } 833 }
836 834
@@ -842,8 +840,6 @@ static unsigned path_parse(char ***p)
842 if (!tmp) 840 if (!tmp)
843 break; 841 break;
844 *tmp++ = '\0'; /* ':' -> '\0' */ 842 *tmp++ = '\0'; /* ':' -> '\0' */
845 if (*tmp == '\0')
846 break; /* :<empty> */
847 res[npth++] = tmp; 843 res[npth++] = tmp;
848 } 844 }
849 /* special case: "match subdirectories of the current directory" */ 845 /* special case: "match subdirectories of the current directory" */
@@ -925,9 +921,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
925 struct dirent *next; 921 struct dirent *next;
926 struct stat st; 922 struct stat st;
927 char *found; 923 char *found;
928#if ENABLE_PLATFORM_MINGW32 924 const char *lpath;
929 char *lpath;
930#endif
931 925
932 if (paths[i] == NULL) { /* path_parse()'s last component? */ 926 if (paths[i] == NULL) { /* path_parse()'s last component? */
933 /* in PATH completion, current dir's subdir names 927 /* in PATH completion, current dir's subdir names
@@ -937,12 +931,11 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
937 paths[i] = (char *)"."; 931 paths[i] = (char *)".";
938 } 932 }
939 933
934 lpath = *paths[i] ? paths[i] : ".";
940#if ENABLE_PLATFORM_MINGW32 935#if ENABLE_PLATFORM_MINGW32
941 lpath = auto_string(alloc_system_drive(paths[i])); 936 lpath = auto_string(alloc_system_drive(lpath));
942 dir = opendir(lpath);
943#else
944 dir = opendir(paths[i]);
945#endif 937#endif
938 dir = opendir(lpath);
946 if (!dir) 939 if (!dir)
947 continue; /* don't print an error */ 940 continue; /* don't print an error */
948 941
@@ -957,11 +950,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
957 if (strncmp(basecmd, name_found, baselen) != 0) 950 if (strncmp(basecmd, name_found, baselen) != 0)
958 continue; /* no */ 951 continue; /* no */
959 952
960#if ENABLE_PLATFORM_MINGW32
961 found = concat_path_file(lpath, name_found); 953 found = concat_path_file(lpath, name_found);
962#else
963 found = concat_path_file(paths[i], name_found);
964#endif
965 /* NB: stat() first so that we see is it a directory; 954 /* NB: stat() first so that we see is it a directory;
966 * but if that fails, use lstat() so that 955 * but if that fails, use lstat() so that
967 * we still match dangling links */ 956 * we still match dangling links */