X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Flib_delch.c;h=6dc6fef4ac39235f6bf367f9dfd5dee7d6672d6e;hb=refs%2Ftags%2Fv4.2;hp=16d89430b9d17fa35cad57fe405a0f743684204a;hpb=3a9b6a3bf0269231bef7de74757a910dedd04e0c;p=ncurses.git diff --git a/ncurses/lib_delch.c b/ncurses/lib_delch.c index 16d89430..6dc6fef4 100644 --- a/ncurses/lib_delch.c +++ b/ncurses/lib_delch.c @@ -1,23 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_delch.c @@ -28,31 +40,35 @@ #include -MODULE_ID("$Id: lib_delch.c,v 1.5 1997/02/01 23:18:18 tom Exp $") +MODULE_ID("$Id: lib_delch.c,v 1.7 1998/02/11 12:13:53 tom Exp $") int wdelch(WINDOW *win) { +int code = ERR; chtype *temp1, *temp2; chtype *end; chtype blank = _nc_background(win); T((T_CALLED("wdelch(%p)"), win)); - end = &win->_line[win->_cury].text[win->_maxx]; - temp2 = &win->_line[win->_cury].text[win->_curx + 1]; - temp1 = temp2 - 1; - - while (temp1 < end) + if (win) { + end = &win->_line[win->_cury].text[win->_maxx]; + temp2 = &win->_line[win->_cury].text[win->_curx + 1]; + temp1 = temp2 - 1; + + while (temp1 < end) *temp1++ = *temp2++; - - *temp1 = blank; - - win->_line[win->_cury].lastchar = win->_maxx; - - if (win->_line[win->_cury].firstchar == _NOCHANGE - || win->_line[win->_cury].firstchar > win->_curx) + + *temp1 = blank; + + win->_line[win->_cury].lastchar = win->_maxx; + + if (win->_line[win->_cury].firstchar == _NOCHANGE + || win->_line[win->_cury].firstchar > win->_curx) win->_line[win->_cury].firstchar = win->_curx; - - _nc_synchook(win); - returnCode(OK); + + _nc_synchook(win); + code = OK; + } + returnCode(code); }