summaryrefslogtreecommitdiffstats
path: root/term-utils/setterm.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: fix --hbcolor descriptionJakub Wilk2019-03-081-1/+1
| | | | | | | --hbcolor is for half-bright characters, which is sort of opposite of bold. Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* setterm: update comments about -ulcolor/-hbcolor syntaxJakub Wilk2019-03-071-2/+2
| | | | Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* setterm: fix bright colors for --ulcolor/--hbcolorJakub Wilk2019-03-071-0/+3
| | | | | | | The "bright" keyword was parsed, but it didn't actually affect the color that was set. Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* setterm: disallow "default" for --ulcolor/--hbcolorJakub Wilk2019-03-071-1/+1
| | | | | | | Passing "default" to --ulcolor or --hbcolor worked, but it set the color to bright red. This was not a documented syntax, so let's forbid it. Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* setterm: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-1/+1
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-271-2/+3
| | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-6/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: ncurses headers cleanupKarel Zak2017-05-311-4/+4
| | | | | | | | | * 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>
* text-utils: use proper paths to term.hKarel Zak2017-05-301-9/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: fix bitfield warning [smatch]Sami Kerola2017-02-281-1/+1
| | | | | | | term-utils/setterm.c:179:27: warning: dubious bitfield without explicit `signed' or `unsigned' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: add --resize optionSami Kerola2016-12-291-1/+111
| | | | | | | | | Reset terminal size by assessing maximum row and column. This is useful when actual geometry and kernel terminal driver are not in sync. Addresses: http://bugs.debian.org/835636 Based-on-work-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: spelling, always use "cannot" instead of "can not"Ruediger Meier2016-11-301-1/+1
| | | | | | Just to be consistent ... Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* setterm: fix declarations shadowing variables in the global scope [oclint]Sami Kerola2016-07-211-40/+40
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-5/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* 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>
* setterm: remove unnecessary translation stringSami Kerola2016-05-091-8/+8
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: de-duplicate color option string parsingKarel Zak2016-05-091-44/+36Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove dead code [coverity scan]Karel Zak2015-08-051-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: extend parse_switch() to accept more optionsKarel Zak2015-02-241-12/+24
| | | | | | | * allow to specify more 0|1 pairs * allow to specify error message Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: move parse_switch() from setterm(1) to librarySami Kerola2015-02-241-16/+0Star
| | | | | | | To allow sharing the code with other utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* setterm: fix dubious one-bit signed bitfield [smatch scan]Sami Kerola2014-10-201-3/+4
| | | | | | term-utils/setterm.c:165:24: error: dubious one-bit signed bitfield Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: remove unnecessary variableSami Kerola2014-07-131-2/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: improve formatting and wording of usage textBenno Schulenberg2014-06-301-17/+17
| | | | | | | | Mainly: showing that the word color is a placeholder by writing <color>, showing some numbers as optional, and message levels and colors as not optional. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* setterm: add usage() descriptionsSami Kerola2014-05-261-34/+35
| | | | | Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: fix 'bright' in usage, remove unnecessary error messageKarel Zak2014-05-201-5/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove ulcolor and hbcolor duplicatesSami Kerola2014-05-191-4/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: add set_blanking() actionSami Kerola2014-05-191-21/+36
| | | | | | This make over long perform_sequence() function a little bit shorter. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: mark some options to be exclusive with each otherSami Kerola2014-05-191-0/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: various visual terminal effects are not console specificSami Kerola2014-05-191-8/+8
| | | | | | | Setting colors, making line not to wrap, and so on can be attempted in other than consoles. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: improve error messagesSami Kerola2014-05-191-5/+5
| | | | | | Reuse messages to make translation work easier. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: tell user when options does not effectSami Kerola2014-05-191-38/+45
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: improve perform_sequence() coding styleSami Kerola2014-05-191-57/+35Star
| | | | | | Delete pointless braces, new lines, and add spacing between operators. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: correct usage() bright color argumentSami Kerola2014-05-191-14/+12Star
| | | | | | | This has been wrong since commit 2dc8716. The bright is a prefix attribute to other colors. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: make -msglevel 0 to work as is did earlierSami Kerola2014-05-191-5/+7
| | | | | | | | Commit 3393c136 caused regression. The klogctl() logging range is 1-8, but the value 0 is special according to setterm.1 manual page. It turns on loging, same way as '-msg on' option. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: remove devfs and /dev/vcsa0 supportSami Kerola2014-05-191-27/+10Star
| | | | | | | | | The devfs files /dev/vcc/a* does not need to be supported, and vcsa0 has not existed in years if ever. Reference: http://lwn.net/Articles/65197/ Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devices.txt?id=14186fea0cb06bc43181ce239efe0df6f1af260a#n260 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: clean up screendump()Sami Kerola2014-05-191-45/+47
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: add init_terminal() to make main() shorterSami Kerola2014-05-191-23/+25
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: add option control structureSami Kerola2014-05-191-199/+194Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: remove usage comment segmentSami Kerola2014-05-191-46/+0Star
| | | | | | | | It is enough trouble to keep usage output aligned with getopt() parsing, manual page, and bash-completion, so get rid of the unnecessary effort duplication. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: move show_tabs() and screendump() functionsSami Kerola2014-05-191-95/+92Star
| | | | | | | Earlier the function was in the middle of option parsing code segment, and screendump() required function prototype. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: use string utils to numeric parsingSami Kerola2014-05-191-36/+25Star
| | | | | | | Check the input numbers are numbers, which makes also the code shorter, and user experience better as half invalid imputs will error. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: recommend long options with double hyphenSami Kerola2014-05-191-37/+37
| | | | | | | | While the -version style options will work for next unknown number of years start moving towards user interface that has way of invoking long options as most of the other commands. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: use getopt_long_only() for option parsingSami Kerola2014-05-191-490/+426Star
| | | | | | | | | | | | | | The getopt_long_only() has advantage of allowing one and two hyphen versions of options, for example -help and --help. Secondly the getopt function family from libc can ensure some options requiring arguments, while other are optional, and some should not accept argument at all. That makes option parsing more robust. Unfortunately retiring the old option parsing makes this change greater than preferred. Assuming not mistakes happen the new code works functionally exactly as the old did. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: clean up includesSami Kerola2014-05-191-25/+15Star
| | | | | | | Use klogctl(2) from sys/klog.h just like dmesg(1). The rest is just reordering, and indenting. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: convert remaining magic values to symbolic referencesSami Kerola2014-05-121-20/+47
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>