summaryrefslogtreecommitdiffstats
path: root/lib/colors.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/colors: remove unnecessary gotoKarel Zak2019-05-201-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: remove redundant if statementSami Kerola2019-05-181-3/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: fix "maybe be" duplicationAustin English2019-05-151-1/+1
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* lib/colors: keep static analyzer happy [coverity scan]Karel Zak2019-05-141-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: force to "never" mode on non-terminal outputKarel Zak2019-02-041-5/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors:: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-171-1/+1
| | | | | | | Let's make it possible to use debug.h without environment variables. Suggested-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: ncurses headers cleanupKarel Zak2017-05-311-4/+11
| | | | | | | | | * assume ncursesw headers in ncursesw/ directory only * prefer long paths, <term.h> and <ncurses.h> should be last possibility * fix typos Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: ncurses cleanupKarel Zak2017-05-301-7/+15
| | | | | | | | | * use proper paths to term.h * keep ncurses support optional * link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses) * don't include unnecessary ncurses.h (term.h is enough) Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-03-171-5/+5
| | | | | | Likewise commit 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: assert rathen than overflow [-Wnull-dereference]Karel Zak2017-03-131-1/+4
| | | | | | | | lib/colors.c: In function 'colors_read_schemes': lib/colors.c:412:7: warning: potential null pointer dereference [-Wnull-dereference] Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: use unique ifdefs for testsKarel Zak2017-01-041-2/+2
| | | | | | | Let's use unique TEST_PROGRAM_<NAME> ifdefs to make build system more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-2/+2
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libsmartcols: don't link with tinfoKarel Zak2015-07-241-35/+0Star
| | | | | | | Let's move color names to sequence translation to separate file to make it usable without all the stuff in lib/colors.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: use libtinfo to check terminal capabilityKarel Zak2015-02-271-3/+32
| | | | | | | | | | | | | | | The current implementation assumes that all terminals supports colors and users are forcet to use terminal-colors.d/ to disable colors for some terminals. This patch checks for maximal supported colors for the current terminal and colors are automatically disabled for terminals like vt100. The patch moves lib/colors.c from libcommon.la to libtcolors.la to avoid collisions with another utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add --disable-colors-defaultKarel Zak2015-02-251-2/+11
| | | | | | | | The current util-linux is to have enabled colorized outputs by default, this default behavior is possible to change by new configure option --disable-colors-default. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: use static buffers when parse schemeKarel Zak2014-11-211-19/+29
| | | | | | | * use static buffers when parse scheme colors * cleanup deallocation on error in sequence parser Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: fix double free on error pathAndreas Henriksson2014-11-191-3/+5
| | | | | | | | | | | | The error path was a bit unclear on the semantics. The seq argument would get freed but not the name argument. Then the caller frees them both when the function returns an error. This fixes the problem my making the function not touch the arguments unless we're going to return success. Also improve the description for this function to make it more obvious what the callers should expect. Addresses: CID#77487 (on scan.coverity.com for JIghtuse/util-linux) Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* terminal-colors.d: add debug stuffKarel Zak2014-10-221-12/+60
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* terminal-colors.d: fix filter by nameKarel Zak2014-10-221-3/+2Star
| | | | | Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766077 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add function to return color from schemeKarel Zak2014-08-131-7/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: remove memory leakSami Kerola2014-07-171-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: support schemes customizationKarel Zak2014-05-131-83/+419
| | | | | | | | | | | | | | | | * parse terminal-colors.d/*.scheme files, expected format is <name> <color-sequence> * supported color sequences: - color name (e.g. "red") - dir_colors compatible xx;yy (e.g. 01;31) where the sequence may contains control chars like \e \a ..etc. * scheme is parsed on demand Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: allow to temporary disable colorsKarel Zak2014-05-131-30/+75
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add support for @term and /home/kzakKarel Zak2014-05-131-31/+268
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: change an include to a local oneBenno Schulenberg2014-05-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* lib/colors: care about colors only on tty()Karel Zak2014-03-121-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: fix colors testKarel Zak2014-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: support <name>.enable tooKarel Zak2014-03-111-12/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: check for /etc/terminal-colors.d/[util].disableOndrej Oprala2014-03-111-4/+25
| | | | | | | | [kzak@redhat.com: - move paths to pathnames.h, - use static path buffer] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/color: add colorscheme parserKarel Zak2014-02-101-2/+47
|
* fdisk: add -L to colorize outputKarel Zak2013-09-161-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add colormode_or_err()Karel Zak2013-05-071-9/+15
| | | | | | ... to make the code easy to use in utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add support for auto, always and never modesKarel Zak2013-05-061-2/+72
| | | | | | ... to implement --color[=<when>] Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: more colors, more funKarel Zak2013-03-181-1/+1
| | | | | | | | * colorize subsystem prefix * colorize time * colorize by keywords (now "segfault" only) Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/color: add module for work with terminal colorsOndrej Oprala2012-10-161-0/+28
[kzak@redhat.com: - split from dmesg patch - add more colors] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>