bin/83553: [ PATCH ] vidcontrol can't switch mode and color during one

Dan Lukes dan at obluda.cz
Sat Jul 16 10:00:32 GMT 2005


>Number:         83553
>Category:       bin
>Synopsis:       [ PATCH ] vidcontrol can't switch mode and color during one
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 16 10:00:31 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 6.0-BETA1 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 6.0-BETA1 #0: Sat Jul 16 00:42:20 CEST 2005 i386

>Description:
	vidcontrol didn't change colors when video mode change requested

	It's because get_{normal|reverse}_color()/set_colors() logic is
broken

	Original get_*_color() functions set color immediatelly, doesn't
store color codes into {normal|reverse}_{fore|back}_color variables nor
raising value of colors_changed

	Unfortunatelly, on the end of program run, when mode changed, the
set_color() has been called. It set colors to {normal|reverse}_{fore|back}_color 
as obtained during initialization (e.g. it set's back original colors)

	Note, the colors_changed variable isn't changed within code anywhere.
It's clear sign the thinks are broken somewhat.

>How-To-Repeat:
	run 'vidcontrol <a mode> <a color>'
	mode changes, color remain unchanged
>Fix:

	get_{normal|reverse}_color() store obtained colors into 
{normal|reverse}_{fore|back}_color variables and sets 
colors_changed to 1

	On end of run the set_color() process changes as requested.

	Please note the get_{normal|reverse}_color() still apply changes
immediatelly also. It's for backward compatibility. Original code allow the
vidcontrol call with '<color> <mode>' (althought the manual page mention the reverse
order only). The order is important during background color changes.

--- patch begins here ---
--- usr.sbin/vidcontrol/vidcontrol.c.ORIG	Fri Jul 15 17:03:40 2005
+++ usr.sbin/vidcontrol/vidcontrol.c	Sat Jul 16 10:47:44 2005
@@ -715,11 +715,14 @@
 	if (*_index < argc && (color = get_color_number(argv[*_index])) != -1) {
 		(*_index)++;
 		fprintf(stderr, "\033[=%dF", color);
+		normal_fore_color=color;
+		colors_changed = 1;
 		if (*_index < argc
 		    && (color = get_color_number(argv[*_index])) != -1
 		    && color < 8) {
 			(*_index)++;
 			fprintf(stderr, "\033[=%dG", color);
+			normal_back_color=color;
 		}
 	}
 }
@@ -736,11 +739,14 @@
 
 	if ((color = get_color_number(argv[*(_index)-1])) != -1) {
 		fprintf(stderr, "\033[=%dH", color);
+		revers_fore_color=color;
+		colors_changed = 1;
 		if (*_index < argc
 		    && (color = get_color_number(argv[*_index])) != -1
 		    && color < 8) {
 			(*_index)++;
 			fprintf(stderr, "\033[=%dI", color);
+			revers_back_color=color;
 		}
 	}
 }
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
 run


More information about the freebsd-bugs mailing list