118334Speter/**************************************************************************** 272562Sobrien * Copyright (c) 2002 Free Software Foundation, Inc. * 3169689Skan * * 418334Speter * Permission is hereby granted, free of charge, to any person obtaining a * 590075Sobrien * copy of this software and associated documentation files (the * 618334Speter * "Software"), to deal in the Software without restriction, including * 790075Sobrien * without limitation the rights to use, copy, modify, merge, publish, * 890075Sobrien * distribute, distribute with modifications, sublicense, and/or sell * 990075Sobrien * copies of the Software, and to permit persons to whom the Software is * 1090075Sobrien * furnished to do so, subject to the following conditions: * 1118334Speter * * 1290075Sobrien * The above copyright notice and this permission notice shall be included * 1390075Sobrien * in all copies or substantial portions of the Software. * 1490075Sobrien * * 1590075Sobrien * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1618334Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1718334Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 1890075Sobrien * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19169689Skan * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20169689Skan * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2118334Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2218334Speter * * 2318334Speter * Except as contained in this notice, the name(s) of the above copyright * 2418334Speter * holders shall not be used in advertising or otherwise to promote the * 2518334Speter * sale, use or other dealings in this Software without prior written * 2618334Speter * authorization. * 2718334Speter ****************************************************************************/ 2818334Speter 2918334Speter/**************************************************************************** 3018334Speter * Author: Thomas Dickey 2002 * 3118334Speter ****************************************************************************/ 3218334Speter 3318334Speter/* 3418334Speter** lib_hline_set.c 3518334Speter** 3618334Speter** The routine whline_set(). 3718334Speter** 3818334Speter*/ 3918334Speter 4018334Speter#include <curses.priv.h> 4118334Speter 4218334SpeterMODULE_ID("$Id: lib_hline_set.c,v 1.2 2002/03/23 21:35:34 tom Exp $") 4318334Speter 4418334SpeterNCURSES_EXPORT(int) 4518334Speterwhline_set(WINDOW *win, const cchar_t * ch, int n) 4618334Speter{ 4718334Speter int code = ERR; 4818334Speter NCURSES_SIZE_T start; 4918334Speter NCURSES_SIZE_T end; 5018334Speter 5118334Speter T((T_CALLED("whline_set(%p,%s,%d)"), win, _tracecchar_t(ch), n)); 5218334Speter 5318334Speter if (win) { 5418334Speter struct ldat *line = &(win->_line[win->_cury]); 5518334Speter NCURSES_CH_T wch; 56169689Skan 57169689Skan start = win->_curx; 58169689Skan end = start + n - 1; 59169689Skan if (end > win->_maxx) 6018334Speter end = win->_maxx; 6190075Sobrien 6218334Speter CHANGED_RANGE(line, start, end); 6318334Speter 6418334Speter if (ch == 0) 6518334Speter wch = *WACS_HLINE; 6618334Speter else 6718334Speter wch = *ch; 6818334Speter wch = _nc_render(win, wch); 6918334Speter 7018334Speter while (end >= start) { 7118334Speter line->text[end] = wch; 7218334Speter end--; 7318334Speter } 7418334Speter 7518334Speter _nc_synchook(win); 7618334Speter code = OK; 7718334Speter } 7850397Sobrien returnCode(code); 79132718Skan} 80132718Skan