diff options
author | Ron Yorston <rmy@pobox.com> | 2013-04-03 12:09:21 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-04-03 12:09:21 +0100 |
commit | 8782950636f76faa8db0ed8c5d698ab0bd1fbf45 (patch) | |
tree | 05f57d81916e41f7ca802ff7eb1934c4d72518a1 /libbb | |
parent | e4f28beec255ea2e233e0f016d4795d13a24bfae (diff) | |
download | busybox-w32-8782950636f76faa8db0ed8c5d698ab0bd1fbf45.tar.gz busybox-w32-8782950636f76faa8db0ed8c5d698ab0bd1fbf45.tar.bz2 busybox-w32-8782950636f76faa8db0ed8c5d698ab0bd1fbf45.zip |
df: limited implementation for WIN32
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/find_mount_point.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c index 9676b5f52..b9bc1dd76 100644 --- a/libbb/find_mount_point.c +++ b/libbb/find_mount_point.c | |||
@@ -24,10 +24,18 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) | |||
24 | struct mntent *mountEntry; | 24 | struct mntent *mountEntry; |
25 | dev_t devno_of_name; | 25 | dev_t devno_of_name; |
26 | bool block_dev; | 26 | bool block_dev; |
27 | #if ENABLE_PLATFORM_MINGW32 | ||
28 | static char mnt_fsname[4]; | ||
29 | static char mnt_dir[4]; | ||
30 | struct mntent my_mount_entry = { mnt_fsname, mnt_dir, "", "", 0, 0 }; | ||
31 | char *current, *path; | ||
32 | DWORD len; | ||
33 | #endif | ||
27 | 34 | ||
28 | if (stat(name, &s) != 0) | 35 | if (stat(name, &s) != 0) |
29 | return NULL; | 36 | return NULL; |
30 | 37 | ||
38 | #if !ENABLE_PLATFORM_MINGW32 | ||
31 | devno_of_name = s.st_dev; | 39 | devno_of_name = s.st_dev; |
32 | block_dev = 0; | 40 | block_dev = 0; |
33 | /* Why S_ISCHR? - UBI volumes use char devices, not block */ | 41 | /* Why S_ISCHR? - UBI volumes use char devices, not block */ |
@@ -64,6 +72,35 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) | |||
64 | break; | 72 | break; |
65 | } | 73 | } |
66 | endmntent(mtab_fp); | 74 | endmntent(mtab_fp); |
75 | #else | ||
76 | mountEntry = NULL; | ||
77 | path = NULL; | ||
78 | current = NULL; | ||
79 | |||
80 | if ( isalpha(name[0]) && name[1] == ':' ) { | ||
81 | path = name; | ||
82 | } | ||
83 | else { | ||
84 | if ( (len=GetCurrentDirectory(0, NULL)) > 0 && | ||
85 | (current=malloc(len+1)) != NULL && | ||
86 | GetCurrentDirectory(len, current) ) { | ||
87 | path = current; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | if ( path && isalpha(path[0]) && path[1] == ':' ) { | ||
92 | mnt_fsname[0] = path[0]; | ||
93 | mnt_fsname[1] = path[1]; | ||
94 | mnt_fsname[2] = '\0'; | ||
95 | mnt_dir[0] = path[0]; | ||
96 | mnt_dir[1] = path[1]; | ||
97 | mnt_dir[2] = '\\'; | ||
98 | mnt_dir[3] = '\0'; | ||
99 | |||
100 | mountEntry = &my_mount_entry; | ||
101 | } | ||
102 | free(current); | ||
103 | #endif | ||
67 | 104 | ||
68 | return mountEntry; | 105 | return mountEntry; |
69 | } | 106 | } |