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