ncurses 4.1
[ncurses.git] / ncurses / lib_delch.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 **      lib_delch.c
24 **
25 **      The routine wdelch().
26 **
27 */
28
29 #include <curses.priv.h>
30
31 MODULE_ID("$Id: lib_delch.c,v 1.5 1997/02/01 23:18:18 tom Exp $")
32
33 int wdelch(WINDOW *win)
34 {
35 chtype  *temp1, *temp2;
36 chtype  *end;
37 chtype  blank = _nc_background(win);
38
39         T((T_CALLED("wdelch(%p)"), win));
40
41         end = &win->_line[win->_cury].text[win->_maxx];
42         temp2 = &win->_line[win->_cury].text[win->_curx + 1];
43         temp1 = temp2 - 1;
44
45         while (temp1 < end)
46             *temp1++ = *temp2++;
47
48         *temp1 = blank;
49
50         win->_line[win->_cury].lastchar = win->_maxx;
51
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
56         _nc_synchook(win);
57         returnCode(OK);
58 }