178189Sbrian/****************************************************************************
278189Sbrian * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc.              *
378189Sbrian *                                                                          *
478189Sbrian * Permission is hereby granted, free of charge, to any person obtaining a  *
578189Sbrian * copy of this software and associated documentation files (the            *
66059Samurai * "Software"), to deal in the Software without restriction, including      *
778189Sbrian * without limitation the rights to use, copy, modify, merge, publish,      *
878189Sbrian * distribute, distribute with modifications, sublicense, and/or sell       *
978189Sbrian * copies of the Software, and to permit persons to whom the Software is    *
1078189Sbrian * furnished to do so, subject to the following conditions:                 *
1178189Sbrian *                                                                          *
1278189Sbrian * The above copyright notice and this permission notice shall be included  *
1378189Sbrian * in all copies or substantial portions of the Software.                   *
1478189Sbrian *                                                                          *
156059Samurai * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1678189Sbrian * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1778189Sbrian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1878189Sbrian * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
1978189Sbrian * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2078189Sbrian * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2178189Sbrian * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2278189Sbrian *                                                                          *
2378189Sbrian * Except as contained in this notice, the name(s) of the above copyright   *
2478189Sbrian * holders shall not be used in advertising or otherwise to promote the     *
2578189Sbrian * sale, use or other dealings in this Software without prior written       *
2678189Sbrian * authorization.                                                           *
276059Samurai ****************************************************************************/
2850479Speter
296059Samurai/****************************************************************************
3030715Sbrian *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
3143313Sbrian *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
326059Samurai ****************************************************************************/
3331176Sbrian
3430715Sbrian/*
3530715Sbrian**	lib_delch.c
3630715Sbrian**
3730715Sbrian**	The routine wdelch().
3831176Sbrian**
3936285Sbrian*/
4036285Sbrian
4136285Sbrian#include <curses.priv.h>
4220287Swollman
4320287SwollmanMODULE_ID("$Id: lib_delch.c,v 1.12 2001/12/19 01:06:09 tom Exp $")
44102500Sbrian
4530715SbrianNCURSES_EXPORT(int)
466059Samuraiwdelch(WINDOW *win)
476059Samurai{
4830715Sbrian    int code = ERR;
4936285Sbrian
5075212Sbrian    T((T_CALLED("wdelch(%p)"), win));
5120287Swollman
5246686Sbrian    if (win) {
5337009Sbrian	NCURSES_CH_T blank = win->_nc_bkgd;
5431343Sbrian	struct ldat *line = &(win->_line[win->_cury]);
5530715Sbrian	NCURSES_CH_T *end = &(line->text[win->_maxx]);
569439Samurai	NCURSES_CH_T *temp2 = &(line->text[win->_curx + 1]);
5736285Sbrian	NCURSES_CH_T *temp1 = temp2 - 1;
5836285Sbrian
5936285Sbrian	CHANGED_TO_EOL(line, win->_curx, win->_maxx);
6036285Sbrian	while (temp1 < end)
6136285Sbrian	    *temp1++ = *temp2++;
6236285Sbrian
6336285Sbrian	*temp1 = blank;
6436285Sbrian
6536285Sbrian	_nc_synchook(win);
6636285Sbrian	code = OK;
6781634Sbrian    }
6831690Sbrian    returnCode(code);
6936285Sbrian}
7036285Sbrian