Fix setting of the border color. Teken doesn't support syscons' escape
sequence "ESC [ %d A" for this although that was used here. I will fix teken later, but use the more portable ioctl KDSBORDER here. The ioctl is also much easier to use if you check that it works. For -b, check it and complain and exit if it failed, so that it is more obvious that that vt doesn't support border colors. Don't check it when restoring the border color in revert(), since revert() is used on vt for handling other errors. Fix nearby error handling and style. For the error of an invalid color, revert() and print a specific error message using err() instead of not revert()ing and printing spam using usage().
This commit is contained in:
parent
4b4a278df8
commit
754d087373
@ -154,7 +154,7 @@ revert(void)
|
||||
|
||||
ioctl(0, VT_ACTIVATE, cur_info.active_vty);
|
||||
|
||||
fprintf(stderr, "\033[=%dA", cur_info.console_info.mv_ovscan);
|
||||
ioctl(0, KDSBORDER, cur_info.console_info.mv_ovscan);
|
||||
fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore);
|
||||
fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back);
|
||||
|
||||
@ -910,11 +910,15 @@ set_border_color(char *arg)
|
||||
{
|
||||
int color;
|
||||
|
||||
if ((color = get_color_number(arg)) != -1) {
|
||||
fprintf(stderr, "\033[=%dA", color);
|
||||
color = get_color_number(arg);
|
||||
if (color == -1) {
|
||||
revert();
|
||||
errx(1, "invalid color '%s'", arg);
|
||||
}
|
||||
if (ioctl(0, KDSBORDER, color) != 0) {
|
||||
revert();
|
||||
err(1, "ioctl(KD_SBORDER)");
|
||||
}
|
||||
else
|
||||
usage();
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user