setterm: clean up includes

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: use getopt_long_only() for option parsing

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: recommend long options with double hyphen

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 string utils to numeric parsing

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: move show_tabs() and screendump() functions

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: remove usage comment segment

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: add option control structure

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: add init_terminal() to make main() shorter

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: clean up screendump()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: remove devfs and /dev/vcsa0 support

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: make -msglevel 0 to work as is did earlier

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: correct usage() bright color argument

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: improve perform_sequence() coding style

Delete pointless braces, new lines, and add spacing between operators.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: tell user when options does not effect

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: improve error messages

Reuse messages to make translation work easier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: various visual terminal effects are not console specific

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: mark some options to be exclusive with each other

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: add set_blanking() action

This make over long perform_sequence() function a little bit shorter.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setterm: remove ulcolor and hbcolor duplicates

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Merge branch '2014wk19' of git://github.com/kerolasa/lelux-utiliteetit

* '2014wk19' of git://github.com/kerolasa/lelux-utiliteetit:
  setterm: remove ulcolor and hbcolor duplicates
  setterm: add set_blanking() action
  setterm: mark some options to be exclusive with each other
  setterm: various visual terminal effects are not console specific
  setterm: improve error messages
  setterm: tell user when options does not effect
  setterm: improve perform_sequence() coding style
  setterm: correct usage() bright color argument
  setterm: make -msglevel 0 to work as is did earlier
  setterm: remove devfs and /dev/vcsa0 support
  setterm: clean up screendump()
  setterm: add init_terminal() to make main() shorter
  setterm: add option control structure
  setterm: remove usage comment segment
  setterm: move show_tabs() and screendump() functions
  setterm: use string utils to numeric parsing
  setterm: recommend long options with double hyphen
  setterm: use getopt_long_only() for option parsing
  setterm: clean up includes