1
0
Files
2022-09-29 17:59:04 +03:00

44 lines
1.2 KiB
C

/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)curses:screen/putwin.c 1.4"
#include "curses_inc.h"
/*
* Write a window to a file.
*
* win: the window to write out.
* filep: the file to write to.
*/
int
putwin(WINDOW *win, FILE *filep)
{
int maxx, nelt;
register chtype **wcp, **ecp;
/* write everything from _cury to _bkgd inclusive */
nelt = sizeof(WINDOW) - sizeof(win->_y) - sizeof(win->_parent) -
sizeof(win->_parx) - sizeof(win->_pary) -
sizeof(win->_ndescs) - sizeof(win->_delay);
if (fwrite((char *) &(win->_cury), 1, (size_t) nelt, filep) != (size_t) nelt)
goto err;
/* Write the character image */
maxx = win->_maxx;
ecp = (wcp = win->_y) + win->_maxy;
while (wcp < ecp)
if (fwrite((char *) *wcp++, sizeof(chtype), (size_t) maxx, filep) != (size_t) maxx)
err:
return (ERR);
return (OK);
}