Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

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

    r2725 r3232  
    2222 * Implement -P and -B; better coreutils compat; cleanup
    2323 */
     24
     25//usage:#define df_trivial_usage
     26//usage:    "[-Pk"
     27//usage:    IF_FEATURE_HUMAN_READABLE("mh")
     28//usage:    IF_FEATURE_DF_FANCY("ai] [-B SIZE")
     29//usage:    "] [FILESYSTEM]..."
     30//usage:#define df_full_usage "\n\n"
     31//usage:       "Print filesystem usage statistics\n"
     32//usage:     "\n    -P  POSIX output format"
     33//usage:     "\n    -k  1024-byte blocks (default)"
     34//usage:    IF_FEATURE_HUMAN_READABLE(
     35//usage:     "\n    -m  1M-byte blocks"
     36//usage:     "\n    -h  Human readable (e.g. 1K 243M 2G)"
     37//usage:    )
     38//usage:    IF_FEATURE_DF_FANCY(
     39//usage:     "\n    -a  Show all filesystems"
     40//usage:     "\n    -i  Inodes"
     41//usage:     "\n    -B SIZE Blocksize"
     42//usage:    )
     43//usage:
     44//usage:#define df_example_usage
     45//usage:       "$ df\n"
     46//usage:       "Filesystem           1K-blocks      Used Available Use% Mounted on\n"
     47//usage:       "/dev/sda3              8690864   8553540    137324  98% /\n"
     48//usage:       "/dev/sda1                64216     36364     27852  57% /boot\n"
     49//usage:       "$ df /dev/sda3\n"
     50//usage:       "Filesystem           1K-blocks      Used Available Use% Mounted on\n"
     51//usage:       "/dev/sda3              8690864   8553540    137324  98% /\n"
     52//usage:       "$ POSIXLY_CORRECT=sure df /dev/sda3\n"
     53//usage:       "Filesystem         512B-blocks      Used Available Use% Mounted on\n"
     54//usage:       "/dev/sda3             17381728  17107080    274648  98% /\n"
     55//usage:       "$ POSIXLY_CORRECT=yep df -P /dev/sda3\n"
     56//usage:       "Filesystem          512-blocks      Used Available Capacity Mounted on\n"
     57//usage:       "/dev/sda3             17381728  17107080    274648      98% /\n"
    2458
    2559#include <mntent.h>
     
    77111
    78112    /* From the manpage of df from coreutils-6.10:
    79        Disk space is shown in 1K blocks by default, unless the environment
    80        variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
    81     */
     113     * Disk space is shown in 1K blocks by default, unless the environment
     114     * variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
     115     */
    82116    if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
    83117        df_disp_hr = 512;
     
    161195
    162196            /* GNU coreutils 6.10 skips certain mounts, try to be compatible.  */
    163             if (strcmp(device, "rootfs") == 0)
     197            if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0)
    164198                continue;
    165199
     
    179213                uni_stat_t uni_stat;
    180214                char *uni_dev = unicode_conv_to_printable(&uni_stat, device);
    181                 if (uni_stat.unicode_width > 20) {
     215                if (uni_stat.unicode_width > 20 && !(opt & OPT_POSIX)) {
    182216                    printf("%s\n%20s", uni_dev, "");
    183217                } else {
     
    187221            }
    188222#else
    189             if (printf("\n%-20s" + 1, device) > 20)
    190                     printf("\n%-20s", "");
     223            if (printf("\n%-20s" + 1, device) > 20 && !(opt & OPT_POSIX))
     224                printf("\n%-20s", "");
    191225#endif
    192226
Note: See TracChangeset for help on using the changeset viewer.