Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/ls.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/ls.c

    r3232 r3621  
    9494
    9595#include "libbb.h"
     96#include "common_bufsiz.h"
    9697#include "unicode.h"
    9798
     
    366367#endif
    367368} FIX_ALIASING;
    368 #define G (*(struct globals*)&bb_common_bufsiz1)
     369#define G (*(struct globals*)bb_common_bufsiz1)
    369370#define INIT_G() do { \
     371    setup_common_bufsiz(); \
    370372    /* we have to zero it out because of NOEXEC */ \
    371373    memset(&G, 0, sizeof(G)); \
     
    567569    if (G.all_fmt & (LIST_FULLTIME|LIST_DATE_TIME)) {
    568570        char *filetime;
    569         time_t ttime = dn->dn_mtime;
     571        const time_t *ttime = &dn->dn_mtime;
    570572        if (G.all_fmt & TIME_ACCESS)
    571             ttime = dn->dn_atime;
     573            ttime = &dn->dn_atime;
    572574        if (G.all_fmt & TIME_CHANGE)
    573             ttime = dn->dn_ctime;
    574         filetime = ctime(&ttime);
     575            ttime = &dn->dn_ctime;
     576        filetime = ctime(ttime);
    575577        /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */
    576578        if (G.all_fmt & LIST_FULLTIME) { /* -e */
     
    581583        } else { /* LIST_DATE_TIME */
    582584            /* G.current_time_t ~== time(NULL) */
    583             time_t age = G.current_time_t - ttime;
    584             printf("%.6s ", filetime + 4); /* "Jun 30" */
     585            time_t age = G.current_time_t - *ttime;
    585586            if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
    586                 /* hh:mm if less than 6 months old */
    587                 printf("%.5s ", filetime + 11);
    588             } else { /* year. buggy if year > 9999 ;) */
    589                 printf(" %.4s ", filetime + 20);
     587                /* less than 6 months old */
     588                /* "mmm dd hh:mm " */
     589                printf("%.12s ", filetime + 4);
     590            } else {
     591                /* "mmm dd  yyyy " */
     592                /* "mmm dd yyyyy " after year 9999 :) */
     593                strchr(filetime + 20, '\n')[0] = ' ';
     594                printf("%.7s%6s", filetime + 4, filetime + 20);
    590595            }
    591596            column += 13;
     
    666671                column_width = len;
    667672        }
    668         column_width += 1 +
     673        column_width += 2 +
    669674            IF_SELINUX( ((G.all_fmt & LIST_CONTEXT) ? 33 : 0) + )
    670675                ((G.all_fmt & LIST_INO) ? 8 : 0) +
     
    694699                if (column > 0) {
    695700                    nexttab -= column;
    696                     printf("%*s ", nexttab, "");
    697                     column += nexttab + 1;
     701                    printf("%*s", nexttab, "");
     702                    column += nexttab;
    698703                }
    699704                nexttab = column + column_width;
     
    10331038        subdnp = scan_one_dir((*dn)->fullname, &nfiles);
    10341039#if ENABLE_DESKTOP
    1035         if ((G.all_fmt & STYLE_MASK) == STYLE_LONG)
     1040        if ((G.all_fmt & STYLE_MASK) == STYLE_LONG || (G.all_fmt & LIST_BLOCKS))
    10361041            printf("total %"OFF_FMT"u\n", calculate_blocks(subdnp));
    10371042#endif
     
    11031108#if ENABLE_FEATURE_AUTOWIDTH
    11041109    /* obtain the terminal width */
    1105     get_terminal_width_height(STDIN_FILENO, &G_terminal_width, NULL);
     1110    G_terminal_width = get_terminal_width(STDIN_FILENO);
    11061111    /* go one less... */
    11071112    G_terminal_width--;
Note: See TracChangeset for help on using the changeset viewer.