summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-04-01 10:21:42 +0100
committerRon Yorston <rmy@pobox.com>2019-04-01 10:21:42 +0100
commit8b340122e5c5014358a4919d1e87ef2f81c83b6f (patch)
tree2aa63b22070dd9ccd5d54104b092b7e5c060b2b0
parentf6228015354adbdbbc736b33296112bebbc96cf3 (diff)
downloadbusybox-w32-8b340122e5c5014358a4919d1e87ef2f81c83b6f.tar.gz
busybox-w32-8b340122e5c5014358a4919d1e87ef2f81c83b6f.tar.bz2
busybox-w32-8b340122e5c5014358a4919d1e87ef2f81c83b6f.zip
df: display origin of mapped drive
When a drive is mapped to a network share or a path display the mapping in the 'Filesystem' column of df's output. Since this changes the mnt_fsname field of the mntent structure a slight alteration is needed to print_all_cwd() in ash. Revert the change in commit a8c63f25b that enabled FEATURE_DF_FANCY in the default configuration. None of the additional options is very useful. See GitHub issue #164.
-rw-r--r--configs/mingw32_defconfig2
-rw-r--r--configs/mingw64_defconfig2
-rw-r--r--shell/ash.c3
-rw-r--r--win32/mntent.c9
4 files changed, 12 insertions, 4 deletions
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig
index 656a0ab7c..c3ba17a46 100644
--- a/configs/mingw32_defconfig
+++ b/configs/mingw32_defconfig
@@ -234,7 +234,7 @@ CONFIG_DD=y
234CONFIG_FEATURE_DD_IBS_OBS=y 234CONFIG_FEATURE_DD_IBS_OBS=y
235CONFIG_FEATURE_DD_STATUS=y 235CONFIG_FEATURE_DD_STATUS=y
236CONFIG_DF=y 236CONFIG_DF=y
237CONFIG_FEATURE_DF_FANCY=y 237# CONFIG_FEATURE_DF_FANCY is not set
238CONFIG_DIRNAME=y 238CONFIG_DIRNAME=y
239CONFIG_DOS2UNIX=y 239CONFIG_DOS2UNIX=y
240CONFIG_UNIX2DOS=y 240CONFIG_UNIX2DOS=y
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig
index 8db906466..721420c06 100644
--- a/configs/mingw64_defconfig
+++ b/configs/mingw64_defconfig
@@ -234,7 +234,7 @@ CONFIG_DD=y
234CONFIG_FEATURE_DD_IBS_OBS=y 234CONFIG_FEATURE_DD_IBS_OBS=y
235CONFIG_FEATURE_DD_STATUS=y 235CONFIG_FEATURE_DD_STATUS=y
236CONFIG_DF=y 236CONFIG_DF=y
237CONFIG_FEATURE_DF_FANCY=y 237# CONFIG_FEATURE_DF_FANCY is not set
238CONFIG_DIRNAME=y 238CONFIG_DIRNAME=y
239CONFIG_DOS2UNIX=y 239CONFIG_DOS2UNIX=y
240CONFIG_UNIX2DOS=y 240CONFIG_UNIX2DOS=y
diff --git a/shell/ash.c b/shell/ash.c
index 8a3c3ae35..68512799e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -3185,7 +3185,8 @@ print_all_cwd(void)
3185 mnt = setmntent(bb_path_mtab_file, "r"); 3185 mnt = setmntent(bb_path_mtab_file, "r");
3186 if (mnt) { 3186 if (mnt) {
3187 while ((entry=getmntent(mnt)) != NULL) { 3187 while ((entry=getmntent(mnt)) != NULL) {
3188 if (get_drive_cwd(entry->mnt_fsname, buffer, PATH_MAX) != NULL) 3188 entry->mnt_dir[2] = '\0';
3189 if (get_drive_cwd(entry->mnt_dir, buffer, PATH_MAX) != NULL)
3189 out1fmt("%s\n", buffer); 3190 out1fmt("%s\n", buffer);
3190 } 3191 }
3191 endmntent(mnt); 3192 endmntent(mnt);
diff --git a/win32/mntent.c b/win32/mntent.c
index 6d6ba319f..7ab51239d 100644
--- a/win32/mntent.c
+++ b/win32/mntent.c
@@ -8,7 +8,7 @@ struct mntdata {
8 DWORD flags; 8 DWORD flags;
9 int index; 9 int index;
10 struct mntent me; 10 struct mntent me;
11 char mnt_fsname[4]; 11 char mnt_fsname[PATH_MAX];
12 char mnt_dir[4]; 12 char mnt_dir[4];
13 char mnt_type[100]; 13 char mnt_type[100];
14 char mnt_opts[4]; 14 char mnt_opts[4];
@@ -33,6 +33,7 @@ struct mntent *getmntent(FILE *stream)
33 struct mntdata *data = (struct mntdata *)stream; 33 struct mntdata *data = (struct mntdata *)stream;
34 struct mntent *entry; 34 struct mntent *entry;
35 UINT drive_type; 35 UINT drive_type;
36 char buf[PATH_MAX];
36 37
37 data->me.mnt_fsname = data->mnt_fsname; 38 data->me.mnt_fsname = data->mnt_fsname;
38 data->me.mnt_dir = data->mnt_dir; 39 data->me.mnt_dir = data->mnt_dir;
@@ -63,6 +64,12 @@ struct mntent *getmntent(FILE *stream)
63 continue; 64 continue;
64 } 65 }
65 66
67 if (realpath(data->mnt_dir, buf) != NULL) {
68 if (isalpha(buf[0]) && strcmp(buf+1, ":/") == 0)
69 buf[2] = '\0';
70 strcpy(data->mnt_fsname, buf);
71 }
72
66 entry = &data->me; 73 entry = &data->me;
67 break; 74 break;
68 } 75 }