FreeBSD/usr.sbin/vidcontrol/vidcontrol.c
/*
 * If something goes wrong along the way we call revert() to go back to the
 * console state we came from (which is assumed to be working).
 *
 * NOTE: please also read the comments of init().
 */
If something goes wrong along the way we call revert() to go back to the
console state we came from (which is assumed to be working).

please also read the comments of init().
If something goes wrong along the way we call revert () to go back to the console state we came from ( which is assumed to be working ) . please also read the comments of init () .
static void
revert(void)
{
	int size[3];
	ioctl(0, VT_ACTIVATE, cur_info.active_vty);
	fprintf(stderr, "\033[=%dA", cur_info.console_info.mv_ovscan);
	fprintf(stderr, "\033[=%dF", cur_info.console_info.mv_norm.fore);
	fprintf(stderr, "\033[=%dG", cur_info.console_info.mv_norm.back);
	fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore);
	fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back);
	if (vt4_mode == 0)
		ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
	if (cur_info.video_mode_number >= M_VESA_BASE)
		ioctl(0, _IO('V', cur_info.video_mode_number - M_VESA_BASE),
		      NULL);
	else
		ioctl(0, _IO('S', cur_info.video_mode_number), NULL);
	if (cur_info.video_mode_info.vi_flags & V_INFO_GRAPHICS) {
		size[0] = cur_info.video_mode_info.vi_width / 8;
		size[1] = cur_info.video_mode_info.vi_height /
			  cur_info.console_info.font_size;
		size[2] = cur_info.console_info.font_size;
		ioctl(0, KDRASTER, size);
	}
}
static void revert ( void ) { int size [ 3 ] ; ioctl ( 0 , VT_ACTIVATE , cur_info . active_vty ) ; fprintf ( stderr , " \033 " , cur_info . console_info . mv_ovscan ) ; fprintf ( stderr , " \033 " , cur_info . console_info . mv_norm . fore ) ; fprintf ( stderr , " \033 " , cur_info . console_info . mv_norm . back ) ; fprintf ( stderr , " \033 " , cur_info . console_info . mv_rev . fore ) ; fprintf ( stderr , " \033 " , cur_info . console_info . mv_rev . back ) ; if ( vt4_mode == 0 ) ioctl ( 0 , PIO_SCRNMAP , & cur_info . screen_map ) ; if ( cur_info . video_mode_number >= M_VESA_BASE ) ioctl ( 0 , _IO ( ' ' , cur_info . video_mode_number - M_VESA_BASE ) , NULL ) ; else ioctl ( 0 , _IO ( ' ' , cur_info . video_mode_number ) , NULL ) ; if ( cur_info . video_mode_info . vi_flags & V_INFO_GRAPHICS ) { size [ 0 ] = cur_info . video_mode_info . vi_width / 8 ; size [ 1 ] = cur_info . video_mode_info . vi_height / cur_info . console_info . font_size ; size [ 2 ] = cur_info . console_info . font_size ; ioctl ( 0 , KDRASTER , size ) ; } }
If something goes wrong along the way we call revert() to go back to the
 console state we came from (which is assumed to be working).
If something goes wrong along the way we call revert () to go back to the console state we came from ( which is assumed to be working ) .