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

    r3232 r3621  
    4545    STALLTIME = 5
    4646};
    47 
    48 static unsigned int get_tty2_width(void)
    49 {
    50     unsigned width;
    51     get_terminal_width_height(2, &width, NULL);
    52     return width;
    53 }
    5447
    5548void FAST_FUNC bb_progress_init(bb_progress_t *p, const char *curfile)
     
    8174    uoff_t beg_and_transferred;
    8275    unsigned since_last_update, elapsed;
    83     int barlength;
     76    int notty;
    8477    int kiloscale;
    8578
     
    138131    }
    139132
     133    notty = !isatty(STDERR_FILENO);
     134
    140135    if (ENABLE_UNICODE_SUPPORT)
    141         fprintf(stderr, "\r%s", p->curfile);
     136        fprintf(stderr, "\r%s" + notty, p->curfile);
    142137    else
    143         fprintf(stderr, "\r%-20.20s", p->curfile);
     138        fprintf(stderr, "\r%-20.20s" + notty, p->curfile);
    144139
    145140    beg_and_transferred = beg_size + transferred;
    146141
    147142    if (totalsize != 0) {
     143        int barlength;
    148144        unsigned ratio = 100 * beg_and_transferred / totalsize;
    149145        fprintf(stderr, "%4u%%", ratio);
    150146
    151         barlength = get_tty2_width() - 49;
     147        barlength = get_terminal_width(2) - 49;
    152148        if (barlength > 0) {
    153149            /* god bless gcc for variable arrays :) */
     
    205201        fprintf(stderr, "%3u:%02u:%02u ETA", hours, secs / 60, secs % 60);
    206202    }
     203    if (notty)
     204        fputc('\n', stderr);
    207205}
Note: See TracChangeset for help on using the changeset viewer.