openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libsmartcols/src/table_print.c
static int print_pending_data(struct libscols_table* tb,
                              struct libscols_column* cl,
                              struct libscols_line* ln, /* optional */
                              struct libscols_cell* ce)
{
    const char* color = get_cell_color(tb, cl, ln, ce);
    size_t width = cl->width, bytes;
    size_t len = width, i;
    char* data;
    char* nextchunk = NULL;

    if (!cl->pending_data)
        return 0;
    if (!width)
        return -EINVAL;

    DBG(COL, ul_debugobj(cl, "printing pending data"));

    data = strdup(cl->pending_data);
    if (!data)
        goto err;

    if (scols_column_is_customwrap(cl) &&
        (nextchunk = cl->wrap_nextchunk(cl, data, cl->wrapfunc_data)))
    {
        bytes = nextchunk - data;

        len = mbs_safe_nwidth(data, bytes, NULL);
    }
    else
        bytes = mbs_truncate(data, &len);

    if (bytes == (size_t)-1)
        goto err;

    if (bytes)
        step_pending_data(cl, bytes);

    if (color)
        fputs(color, tb->out);
    fputs(data, tb->out);
    if (color)
        fputs(UL_COLOR_RESET, tb->out);
    free(data);

    if (is_last_column(cl))
        return 0;

    for (i = len; i < width; i++)
        fputs(cellpadding_symbol(tb), tb->out); /* padding */

    fputs(colsep(tb), tb->out); /* columns separator */
    return 0;
err:
    free(data);
    return -errno;
}
/* print next pending data for the column @cl */
print next pending data for the column @cl
print next pending data for the column @cl
static int print_pending_data(struct libscols_table* tb,
                              struct libscols_column* cl,
                              struct libscols_line* ln, 
                              struct libscols_cell* ce)
{
    const char* color = get_cell_color(tb, cl, ln, ce);
    size_t width = cl->width, bytes;
    size_t len = width, i;
    char* data;
    char* nextchunk = NULL;
    if (!cl->pending_data)
        return 0;
    if (!width)
        return -EINVAL;
    DBG(COL, ul_debugobj(cl, "printing pending data"));
    data = strdup(cl->pending_data);
    if (!data)
        goto err;
    if (scols_column_is_customwrap(cl) &&
        (nextchunk = cl->wrap_nextchunk(cl, data, cl->wrapfunc_data)))
    {
        bytes = nextchunk - data;
        len = mbs_safe_nwidth(data, bytes, NULL);
    }
    else
        bytes = mbs_truncate(data, &len);
    if (bytes == (size_t)-1)
        goto err;
    if (bytes)
        step_pending_data(cl, bytes);
    if (color)
        fputs(color, tb->out);
    fputs(data, tb->out);
    if (color)
        fputs(UL_COLOR_RESET, tb->out);
    free(data);
    if (is_last_column(cl))
        return 0;
    for (i = len; i < width; i++)
        fputs(cellpadding_symbol(tb), tb->out); 
    fputs(colsep(tb), tb->out); 
    return 0;
err:
    free(data);
    return -errno;
}
static int print_pending_data ( struct libscols_table * tb , struct libscols_column * cl , struct libscols_line * ln , struct libscols_cell * ce ) { const char * color = get_cell_color ( tb , cl , ln , ce ) ; size_t width = cl -> width , bytes ; size_t len = width , i ; char * data ; char * nextchunk = NULL ; if ( ! cl -> pending_data ) return 0 ; if ( ! width ) return - EINVAL ; DBG ( COL , ul_debugobj ( cl , " " ) ) ; data = strdup ( cl -> pending_data ) ; if ( ! data ) goto err ; if ( scols_column_is_customwrap ( cl ) && ( nextchunk = cl -> wrap_nextchunk ( cl , data , cl -> wrapfunc_data ) ) ) { bytes = nextchunk - data ; len = mbs_safe_nwidth ( data , bytes , NULL ) ; } else bytes = mbs_truncate ( data , & len ) ; if ( bytes == ( size_t ) -1 ) goto err ; if ( bytes ) step_pending_data ( cl , bytes ) ; if ( color ) fputs ( color , tb -> out ) ; fputs ( data , tb -> out ) ; if ( color ) fputs ( UL_COLOR_RESET , tb -> out ) ; free ( data ) ; if ( is_last_column ( cl ) ) return 0 ; for ( i = len ; i < width ; i ++ ) fputs ( cellpadding_symbol ( tb ) , tb -> out ) ; fputs ( colsep ( tb ) , tb -> out ) ; return 0 ; err : free ( data ) ; return - errno ; }
print next pending data for the column @cl
print next pending data for the column @cl
/* optional */ /* padding */ /* columns separator */