summaryrefslogtreecommitdiffstats
path: root/term-utils/setterm.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* setterm: convert various constant number definitions to enumsSami Kerola2014-05-121-20/+26
| | | | | | The enum strings are visible when using debugger. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: cleanup printf() usageKarel Zak2014-05-121-58/+24Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove unused codeSami Kerola2014-05-121-68/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: Fix check for __GNU_LIBRARY__Michael Forney2013-10-041-1/+1
| | | | | | | If we are not on glibc, __GNU_LIBRARY__ will not exist causing the check to always fail and try to use syscalls directly. Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: fix term.h/ncurses.h include orderingMike Frysinger2013-09-301-2/+3
| | | | | | | | | | | | | | | | | | | The ncurses term.h header has logic in it to detect if nucrses.h has already been included and void defining things when it has. But since setterm includes term.h and the ncurses.h, it doesn't work and we can get fun build-time warnings like: CC term-utils/setterm-setterm.o In file included from term-utils/setterm.c:109:0: /usr/include/ncursesw/ncurses.h:827:12: warning: redundant redeclaration of 'tigetflag' [-Wredundant-decls] extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ ^ In file included from term-utils/setterm.c:106:0: /usr/include/ncursesw/term.h:775:12: note: previous declaration of 'tigetflag' was here extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); ^ Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* setterm: fix various color option argument listsSami Kerola2013-04-051-37/+37
| | | | | | | | The lists did not have correct colors in usage(). Because the usage() had to be fixed, it is best to make the output easy for translators to work with. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: fix memory leak [coverity scan]Karel Zak2013-03-271-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* setterm: fix compiler warningKarel Zak2012-12-201-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: make error message more informativePetr Uzel2012-09-211-3/+7
| | | | | | | | | | | | | | | | | | | | | If `setterm -dump` fails because of lack of permission to read /dev/vcsa, it should not report that it couldn't read /dev/vcsa0. This could be misleading if there is only /dev/vcsa, but not /dev/vcsa0. Before: $ ./setterm -dump setterm: Couldn't read /dev/vcsa0 After: $ ./setterm -dump setterm: Couldn't read neither /dev/vcsa0 nor /dev/vcsa (Note: /dev/vcsa0 does not exist and the user does not have read permission on /dev/vcsa in this case). Addresses: https://bugzilla.novell.com/show_bug.cgi?id=780615 Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* setterm: fix shadow declarationSami Kerola2012-07-261-3/+3
| | | | | | | | term-utils/setterm.c:221:55: warning: declaration of 'opt_term' shadows a global declaration [-Wshadow] term-utils/setterm.c:181:5: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos in comments and wall's man pageBernhard Voelker2012-06-051-1/+1
| | | | | | | | | | | Culprits identified again by (newer) misspellings: $ git ls-files | misspellings -f - | grep -v '^po/' * wall: Fix typo in man page. * Fix typos in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* term-utils: verify writing to streams was successfulSami Kerola2012-04-041-1/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: correct manual page referenceSami Kerola2012-03-301-1/+1
| | | | | | An error from commit faa0548de47df5691cf56dd49daaba8dbc89d34a Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: cleanup usage()Karel Zak2011-08-161-43/+42Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: use xmalloc()Karel Zak2011-04-061-6/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: fix variable types, and unused argument warningsSami Kerola2011-04-061-3/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: function screendump coding style fixedSami Kerola2011-04-061-60/+61
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>