Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/df.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/coreutils/df.c
r3232 r3621 26 26 //usage: "[-Pk" 27 27 //usage: IF_FEATURE_HUMAN_READABLE("mh") 28 //usage: "T" 28 29 //usage: IF_FEATURE_DF_FANCY("ai] [-B SIZE") 29 30 //usage: "] [FILESYSTEM]..." … … 36 37 //usage: "\n -h Human readable (e.g. 1K 243M 2G)" 37 38 //usage: ) 39 //usage: "\n -T Print filesystem type" 38 40 //usage: IF_FEATURE_DF_FANCY( 39 41 //usage: "\n -a Show all filesystems" … … 84 86 OPT_KILO = (1 << 0), 85 87 OPT_POSIX = (1 << 1), 86 OPT_ALL = (1 << 2) * ENABLE_FEATURE_DF_FANCY, 87 OPT_INODE = (1 << 3) * ENABLE_FEATURE_DF_FANCY, 88 OPT_BSIZE = (1 << 4) * ENABLE_FEATURE_DF_FANCY, 89 OPT_HUMAN = (1 << (2 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, 90 OPT_MEGA = (1 << (3 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, 88 OPT_FSTYPE = (1 << 2), 89 OPT_ALL = (1 << 3) * ENABLE_FEATURE_DF_FANCY, 90 OPT_INODE = (1 << 4) * ENABLE_FEATURE_DF_FANCY, 91 OPT_BSIZE = (1 << 5) * ENABLE_FEATURE_DF_FANCY, 92 OPT_HUMAN = (1 << (3 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, 93 OPT_MEGA = (1 << (4 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, 91 94 }; 92 95 const char *disp_units_hdr = NULL; … … 100 103 opt_complementary = "k-m:m-k"; 101 104 #endif 102 opt = getopt32(argv, "kP "105 opt = getopt32(argv, "kPT" 103 106 IF_FEATURE_DF_FANCY("aiB:") 104 107 IF_FEATURE_HUMAN_READABLE("hm") … … 135 138 #endif 136 139 } 137 printf("Filesystem %-15sUsed Available %s Mounted on\n", 138 disp_units_hdr, (opt & OPT_POSIX) ? "Capacity" : "Use%"); 140 141 printf("Filesystem %s%-15sUsed Available %s Mounted on\n", 142 (opt & OPT_FSTYPE) ? "Type " : "", 143 disp_units_hdr, 144 (opt & OPT_POSIX) ? "Capacity" : "Use%"); 139 145 140 146 mount_table = NULL; … … 149 155 const char *device; 150 156 const char *mount_point; 157 const char *fs_type; 151 158 152 159 if (mount_table) { … … 171 178 device = mount_entry->mnt_fsname; 172 179 mount_point = mount_entry->mnt_dir; 180 fs_type = mount_entry->mnt_type; 173 181 174 182 if (statfs(mount_point, &s) != 0) { … … 219 227 } 220 228 free(uni_dev); 229 if (opt & OPT_FSTYPE) { 230 char *uni_type = unicode_conv_to_printable(&uni_stat, fs_type); 231 if (uni_stat.unicode_width > 10 && !(opt & OPT_POSIX)) 232 printf(" %s\n%31s", uni_type, ""); 233 else 234 printf(" %s%*s", uni_type, 10 - (int)uni_stat.unicode_width, ""); 235 free(uni_type); 236 } 221 237 } 222 238 #else 223 239 if (printf("\n%-20s" + 1, device) > 20 && !(opt & OPT_POSIX)) 224 240 printf("\n%-20s", ""); 241 if (opt & OPT_FSTYPE) { 242 if (printf(" %-10s", fs_type) > 11 && !(opt & OPT_POSIX)) 243 printf("\n%-30s", ""); 244 } 225 245 #endif 226 246
Note:
See TracChangeset
for help on using the changeset viewer.