File: wrap-repeat.c

package info (click to toggle)
util-linux 2.41.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 92,844 kB
  • sloc: ansic: 179,146; sh: 22,716; yacc: 1,284; makefile: 525; xml: 422; python: 316; lex: 89; ruby: 75; csh: 37; exp: 19; sed: 16; perl: 15; sql: 9
file content (37 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>

#include "libsmartcols.h"

int main(void)
{
	struct libscols_table *tb;
	struct libscols_line *ln;
	struct libscols_column *cl;

	scols_init_debug(0);

	tb = scols_new_table();
	scols_table_enable_maxout(tb, 1);

	cl = scols_table_new_column(tb, "AAA", 0, 0);
	cl = scols_table_new_column(tb, "BBB", 0, 0);
	cl = scols_table_new_column(tb, "CCC", 0, 0);
	cl = scols_table_new_column(tb, "XXX", 0, 0);
	scols_column_set_flags(cl, SCOLS_FL_WRAP);

	ln = scols_table_new_line(tb, NULL);
	scols_line_set_data(ln, 0, "aaa");
	scols_line_set_data(ln, 1, "4");
	scols_line_set_data(ln, 2, "Foo bar foo.");
	scols_line_set_data(ln, 3, "Adcvfr tgbnhy ujmkifas rqweerq adfs eqeqw kjkliobb u8888 kjhjkh.");

	/* repeat 2x */
	scols_table_print_range(tb, ln, ln);
	printf("\n");
	scols_table_print_range(tb, ln, ln);
	printf("\n");

	scols_unref_table(tb);
	return EXIT_SUCCESS;
}