scr_reset.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Copyright (c) 1988 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * University Copyright- Copyright (c) 1982, 1986, 1988 2N/A * The Regents of the University of California 2N/A * All Rights Reserved 2N/A * University Acknowledgment- Portions of this document are derived from 2N/A * software developed by the University of California, Berkeley, and its 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Initialize the screen image to be the image contained 2N/A * in the given file. This is usually used in a child process 2N/A * to initialize its idea of the screen image to be that of its 2N/A * filep: pointer to the output stream 2N/A * type: 0: <curses> should assume that the physical screen is 2N/A * EXACTLY as stored in the file. Therefore, we take 2N/A * special care to make sure that /dev/tty and the terminal 2N/A * did not change in any way. This information can then 2N/A * be used in the update optimization of the new program 2N/A * so that the screen does not have to be cleared. Instead, 2N/A * curses, by knowing what's on the screen can optimally 2N/A * update it with the information of the new program. 2N/A * 1: Tell <curses> that the stored image should be 2N/A * the physical image. Sort of like a huge waddstr onto 2N/A * curscr. This can be used when a library wants to save 2N/A * a screen image and restore it at a later time. 2N/A * 2: Tell <curses> that the stored image is the physical 2N/A * image and also it is what the new program wants on the 2N/A * screen. This can be be thought of as a screen inheritance 2N/A /* check magic number */ 2N/A /* get modification time of image in file */ 2N/A /* if get here, everything is ok, read the curscr image */ 2N/A * if soft labels were dumped, we would like either read them 2N/A * or advance the file pointer pass them 2N/A * Why doesn't the following line and the two below 2N/A * that access those variables work ? 2N/A * char **labdis = SP->slk->_ldis, **labval = SP->slk->_lval; 2N/A * if ((fread(labdis[i], sizeof (char), lablen, 2N/A * filep) != lablen) || 2N/A * (fread(labval[i], sizeof (char), lablen, 2N/A sizeof (
char)),
1) != 0)
2N/A /* read the color information(if any) from the file */ 2N/A /* if the new terminal doesn't support colors, or it supports */ 2N/A /* less colors (or color_pairs) than the old terminal, or */ 2N/A /* start_color() has not been called, simply advance the file */ 2N/A /* pointer pass the color related info. */ 2N/A /* Note: must to read the first line of color info, even if the */ 2N/A /* new terminal doesn't support color, in order to know how to */ 2N/A /* deal with the rest of the file */ 2N/A /* if both old and new terminals could modify colors, read in */ 2N/A /* color table, and call init_color for each color */ 2N/A /* the old terminal could modify colors, by the new one */ 2N/A /* cannot skip over color_table info. */ 2N/A /* read color_pairs info. call init_pair for each pair */ 2N/A /* substitute read in window for the curscr */ 2N/A /* clear the hash table */ 2N/A /* LINTED */ /* Known fall-through on case statement. */ 2N/A /* clear the hash table */