From 8b340122e5c5014358a4919d1e87ef2f81c83b6f Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 1 Apr 2019 10:21:42 +0100 Subject: 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. --- win32/mntent.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'win32') 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 { DWORD flags; int index; struct mntent me; - char mnt_fsname[4]; + char mnt_fsname[PATH_MAX]; char mnt_dir[4]; char mnt_type[100]; char mnt_opts[4]; @@ -33,6 +33,7 @@ struct mntent *getmntent(FILE *stream) struct mntdata *data = (struct mntdata *)stream; struct mntent *entry; UINT drive_type; + char buf[PATH_MAX]; data->me.mnt_fsname = data->mnt_fsname; data->me.mnt_dir = data->mnt_dir; @@ -63,6 +64,12 @@ struct mntent *getmntent(FILE *stream) continue; } + if (realpath(data->mnt_dir, buf) != NULL) { + if (isalpha(buf[0]) && strcmp(buf+1, ":/") == 0) + buf[2] = '\0'; + strcpy(data->mnt_fsname, buf); + } + entry = &data->me; break; } -- cgit v1.2.3-55-g6feb