Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/df.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/coreutils/df.c

    r3232 r3621  
    2626//usage:    "[-Pk"
    2727//usage:    IF_FEATURE_HUMAN_READABLE("mh")
     28//usage:    "T"
    2829//usage:    IF_FEATURE_DF_FANCY("ai] [-B SIZE")
    2930//usage:    "] [FILESYSTEM]..."
     
    3637//usage:     "\n    -h  Human readable (e.g. 1K 243M 2G)"
    3738//usage:    )
     39//usage:     "\n    -T  Print filesystem type"
    3840//usage:    IF_FEATURE_DF_FANCY(
    3941//usage:     "\n    -a  Show all filesystems"
     
    8486        OPT_KILO  = (1 << 0),
    8587        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,
    9194    };
    9295    const char *disp_units_hdr = NULL;
     
    100103    opt_complementary = "k-m:m-k";
    101104#endif
    102     opt = getopt32(argv, "kP"
     105    opt = getopt32(argv, "kPT"
    103106            IF_FEATURE_DF_FANCY("aiB:")
    104107            IF_FEATURE_HUMAN_READABLE("hm")
     
    135138#endif
    136139    }
    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%");
    139145
    140146    mount_table = NULL;
     
    149155        const char *device;
    150156        const char *mount_point;
     157        const char *fs_type;
    151158
    152159        if (mount_table) {
     
    171178        device = mount_entry->mnt_fsname;
    172179        mount_point = mount_entry->mnt_dir;
     180        fs_type = mount_entry->mnt_type;
    173181
    174182        if (statfs(mount_point, &s) != 0) {
     
    219227                }
    220228                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                }
    221237            }
    222238#else
    223239            if (printf("\n%-20s" + 1, device) > 20 && !(opt & OPT_POSIX))
    224240                printf("\n%-20s", "");
     241            if (opt & OPT_FSTYPE) {
     242                if (printf(" %-10s", fs_type) > 11 && !(opt & OPT_POSIX))
     243                    printf("\n%-30s", "");
     244            }
    225245#endif
    226246
Note: See TracChangeset for help on using the changeset viewer.