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
int scols_table_print_range(struct libscols_table* tb,
                            struct libscols_line* start,
                            struct libscols_line* end)
{
    struct libscols_buffer* buf = NULL;
    struct libscols_iter itr;
    int rc;

    if (scols_table_is_tree(tb))
        return -EINVAL;

    DBG(TAB, ul_debugobj(tb, "printing range from API"));

    rc = initialize_printing(tb, &buf);
    if (rc)
        return rc;

    if (start)
    {
        itr.direction = SCOLS_ITER_FORWARD;
        itr.head = &tb->tb_lines;
        itr.p = &start->ln_lines;
    }
    else
        scols_reset_iter(&itr, SCOLS_ITER_FORWARD);

    if (!start || itr.p == tb->tb_lines.next)
    {
        rc = print_header(tb, buf);
        if (rc)
            goto done;
    }

    rc = print_range(tb, buf, &itr, end);
done:
    cleanup_printing(tb, buf);
    return rc;
}
/**
 * scola_table_print_range:
 * @tb: table
 * @start: first printed line or NULL to print from the begin of the table
 * @end: last printed line or NULL to print all from start.
 *
 * If the start is the first line in the table than prints table header too.
 * The header is printed only once. This does not work for trees.
 *
 * Returns: 0, a negative value in case of an error.
 */
@tb: table
@start: first printed line or NULL to print from the begin of the table
@end: last printed line or NULL to print all from start.

If the start is the first line in the table than prints table header too.
The header is printed only once. This does not work for trees.

0, a negative value in case of an error.
@tb : table @start : first printed line or NULL to print from the begin of the table @end : last printed line or NULL to print all from start . If the start is the first line in the table than prints table header too . The header is printed only once . This does not work for trees . 0 a negative value in case of an error .
int scols_table_print_range(struct libscols_table* tb,
                            struct libscols_line* start,
                            struct libscols_line* end)
{
    struct libscols_buffer* buf = NULL;
    struct libscols_iter itr;
    int rc;
    if (scols_table_is_tree(tb))
        return -EINVAL;
    DBG(TAB, ul_debugobj(tb, "printing range from API"));
    rc = initialize_printing(tb, &buf);
    if (rc)
        return rc;
    if (start)
    {
        itr.direction = SCOLS_ITER_FORWARD;
        itr.head = &tb->tb_lines;
        itr.p = &start->ln_lines;
    }
    else
        scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
    if (!start || itr.p == tb->tb_lines.next)
    {
        rc = print_header(tb, buf);
        if (rc)
            goto done;
    }
    rc = print_range(tb, buf, &itr, end);
done:
    cleanup_printing(tb, buf);
    return rc;
}
int scols_table_print_range ( struct libscols_table * tb , struct libscols_line * start , struct libscols_line * end ) { struct libscols_buffer * buf = NULL ; struct libscols_iter itr ; int rc ; if ( scols_table_is_tree ( tb ) ) return - EINVAL ; DBG ( TAB , ul_debugobj ( tb , " " ) ) ; rc = initialize_printing ( tb , & buf ) ; if ( rc ) return rc ; if ( start ) { itr . direction = SCOLS_ITER_FORWARD ; itr . head = & tb -> tb_lines ; itr . p = & start -> ln_lines ; } else scols_reset_iter ( & itr , SCOLS_ITER_FORWARD ) ; if ( ! start || itr . p == tb -> tb_lines . next ) { rc = print_header ( tb , buf ) ; if ( rc ) goto done ; } rc = print_range ( tb , buf , & itr , end ) ; done : cleanup_printing ( tb , buf ) ; return rc ; }
scola_table_print_range:
 @tb: table
 @start: first printed line or NULL to print from the begin of the table
 @end: last printed line or NULL to print all from start.
scola_table_print_range : @tb : table @start : first printed line or NULL to print from the begin of the table @end : last printed line or NULL to print all from start .