lib_insch.c revision 76726
1250079Scarl/****************************************************************************
2250079Scarl * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
3250079Scarl *                                                                          *
4250079Scarl * Permission is hereby granted, free of charge, to any person obtaining a  *
5250079Scarl * copy of this software and associated documentation files (the            *
6250079Scarl * "Software"), to deal in the Software without restriction, including      *
7250079Scarl * without limitation the rights to use, copy, modify, merge, publish,      *
8250079Scarl * distribute, distribute with modifications, sublicense, and/or sell       *
9250079Scarl * copies of the Software, and to permit persons to whom the Software is    *
10250079Scarl * furnished to do so, subject to the following conditions:                 *
11250079Scarl *                                                                          *
12250079Scarl * The above copyright notice and this permission notice shall be included  *
13250079Scarl * in all copies or substantial portions of the Software.                   *
14250079Scarl *                                                                          *
15250079Scarl * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16250079Scarl * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17250079Scarl * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18250079Scarl * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19250079Scarl * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20250079Scarl * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21250079Scarl * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22250079Scarl *                                                                          *
23250079Scarl * Except as contained in this notice, the name(s) of the above copyright   *
24250079Scarl * holders shall not be used in advertising or otherwise to promote the     *
25250079Scarl * sale, use or other dealings in this Software without prior written       *
26250079Scarl * authorization.                                                           *
27250079Scarl ****************************************************************************/
28250079Scarl
29250079Scarl/****************************************************************************
30250079Scarl *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31250079Scarl *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32250079Scarl ****************************************************************************/
33250079Scarl
34250079Scarl/*
35250079Scarl**	lib_insch.c
36250079Scarl**
37250079Scarl**	The routine winsch().
38289207Scem**
39250079Scarl*/
40250079Scarl
41250079Scarl#include <curses.priv.h>
42250079Scarl
43250079ScarlMODULE_ID("$Id: lib_insch.c,v 1.12 2000/12/10 02:43:27 tom Exp $")
44250079Scarl
45250079ScarlNCURSES_EXPORT(int)
46250079Scarlwinsch(WINDOW *win, chtype c)
47250079Scarl{
48250079Scarl    int code = ERR;
49250079Scarl
50250079Scarl    T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));
51250079Scarl
52250079Scarl    if (win) {
53250079Scarl	struct ldat *line = &(win->_line[win->_cury]);
54250079Scarl	chtype *end = &(line->text[win->_curx]);
55250079Scarl	chtype *temp1 = &(line->text[win->_maxx]);
56250079Scarl	chtype *temp2 = temp1 - 1;
57250079Scarl
58250079Scarl	CHANGED_TO_EOL(line, win->_curx, win->_maxx);
59250079Scarl	while (temp1 > end)
60250079Scarl	    *temp1-- = *temp2--;
61250079Scarl
62250079Scarl	*temp1 = _nc_render(win, c);
63250079Scarl	code = OK;
64250079Scarl    }
65250079Scarl    returnCode(code);
66250079Scarl}
67250079Scarl