]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/lib_insch.c
ncurses 4.1
[ncurses.git] / ncurses / lib_insch.c
1
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21
22
23
24 /*
25 **      lib_insch.c
26 **
27 **      The routine winsch().
28 **
29 */
30
31 #include <curses.priv.h>
32
33 MODULE_ID("$Id: lib_insch.c,v 1.7 1997/04/12 17:43:02 tom Exp $")
34
35 int  winsch(WINDOW *win, chtype c)
36 {
37 chtype  *temp1, *temp2;
38 chtype  *end;
39
40         T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));
41
42         end = &win->_line[win->_cury].text[win->_curx];
43         temp1 = &win->_line[win->_cury].text[win->_maxx];
44         temp2 = temp1 - 1;
45
46         while (temp1 > end)
47             *temp1-- = *temp2--;
48
49         *temp1 = _nc_render(win, c);
50
51         win->_line[win->_cury].lastchar = win->_maxx;
52         if (win->_line[win->_cury].firstchar == _NOCHANGE
53                                 ||  win->_line[win->_cury].firstchar > win->_curx)
54             win->_line[win->_cury].firstchar = win->_curx;
55         returnCode(OK);
56 }