summaryrefslogtreecommitdiff
path: root/lib/tt.c
AgeCommit message (Collapse)AuthorFilesLines
2013-02-19lib/tty: don't truncate output on non-terminalsKarel Zak1-2/+8
for example: $ findmnt | cat $ lslocks > foo the output should not be truncated. Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-18include/list: add list_last_entry()Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23lib/tt: don't ignore "extreme" columns if an free space is availableKarel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-13lib/tt: always escape '\' to simplify parsing in scriptsKarel Zak1-14/+3
The commands echo(1) and printf(1) are usable for escape sequences decoding, for example for x in $(findmnt --noheading --raw --output TARGET); do printf "%b" $x done but it's necessary to escape all '\' chars, otherwise for example \b in foo\bar will be interpreted as backspace. It means that for example findmnt(8) has to use \x5c for the backslash. # findmnt --noheading --raw --output TARGET /dev/sda1 /mnt/ugly/foo\x5cbar Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-08lib/tt: fix \x%02x usageKarel Zak1-4/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-07include/tt: improve work with non-utf8 charsKarel Zak1-9/+23
Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-06lib/tt: count read cells, improve \x?? hex encodingKarel Zak1-14/+161
* use wcwidth() to count real number of columns required for multibyte strings * encode control characters with \x?? in raw and export (NAME=data) outputs * use \x?? for controls and non-printable characters in the default outputs * use \x?? to encode already existing hex sequences, for example /mnt/ugly\x20space ---> /mnt/ugly\x5cx20space this is not used in the default output, but in raw/export outputs only (which is designed for scripts). Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-22lib/tt: export tt_fputs_{quoted,nonblank} functionKarel Zak1-4/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15include: move get_terminal_width() to ttyutils.hPetr Uzel1-27/+1
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-03include/tt: remove obsolete stuffKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-26lib/tt: check for non-printable chars for raw/export formatKarel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-26lib/tt: encode data for RAW and EXPORT formatKarel Zak1-2/+30
* all tt based utils will properly encode blank chars for raw output format and quotes for export output format Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20lib/tt: work more sensitive with large columnsKarel Zak1-1/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22lib,tt: don't trim last line charKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-14lib,tt: fix compiler warning [-Wreturn-type]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-10lib,tt: add TT_FL_NOEXTREMESKarel Zak1-41/+124
If you mark a column with TT_FL_NOEXTREMES flag then extremely large fields will no have effect to column width. Foe example: without the TT_FL_NOEXTREMES flag for the 'AAA' column: AAA BBB CCC DDD aa bbb ccc ddd aaaaaaaaaaa bb ccc ddd aa bb ccc ddd aa bb ccc ddd with the flags: AAA BBB CCC DDD aa bbb ccc dddddddddd aaaaaaaaaaa bb ccc dddddddd aa bb ccc dddddd aa bb ccc ddddddddd Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01lib: [tt.c] clean up used typesKarel Zak1-16/+20
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27include: [strutils.c] add list parsersKarel Zak1-41/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27include; [tt.c] check for array size in columns parserKarel Zak1-7/+11
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-15include: [tt.c] always truncate if TT_FL_TRUNCKarel Zak1-2/+10
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-14lib: [tt.c] Fix mbs_width macro for systems without WIDECHARJosiah Worcester1-1/+1
Signed-off-by: Josiah Worcester <josiahw@gmail.com>
2011-05-10lib: [tt.c] support key="value" output formatKarel Zak1-3/+16
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-27lib: [tt.c] support fixed width and multiple tt_print_table() callsKarel Zak1-5/+37
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11lib: [tt.c] use mbs_truncate() from mbsalign.cKarel Zak1-64/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11lib: [tt.c] dereferencing data before a null check [coverity scan]Karel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-14build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen1-1/+0
Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-25include: [tt] enlarge output bufferKarel Zak1-4/+21
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04findmnt: add --submounts optionKarel Zak1-0/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-16lib: [tt] fix alignment of the last tree childKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24lib: [tt] add TT_FL_RIGHT, add columns list parserKarel Zak1-9/+59
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15findmnt: follow HAVE_LANGINFOKarel Zak1-4/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15lib/tt: fix langinfo build breakDavidlohr Bueso1-1/+1
When HAVE_LANGINFO_H is not defined we break the compilation in tt.c: CC tt.o tt.c: In function ‘tt_new_table’: tt.c:142: warning: implicit declaration of function ‘nl_langinfo’ tt.c:142: error: ‘CODESET’ undeclared (first use in this function) tt.c:142: error: (Each undeclared identifier is reported only once tt.c:142: error: for each function it appears in.) make: *** [tt.o] Error 1 Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-06-03lib: remove unwanted debug messagesKarel Zak1-8/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: tt.c - fix minimal width of columnKarel Zak1-6/+15
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: tt.c: don't print header for empty tableKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: add tt.c (Tree and Table output)Karel Zak1-0/+722
Signed-off-by: Karel Zak <kzak@redhat.com>