xref: /illumos-gate/usr/src/ucblib/libcurses/deleteln.c (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved.  The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 /*LINTLIBRARY*/
16 
17 #ifndef lint
18 static char
19 sccsid[] = "@(#)deleteln.c 1.8 89/08/24 SMI"; /* from UCB 5.1 85/06/07 */
20 #endif /* not lint */
21 
22 #include	"curses.ext"
23 #include	<string.h>
24 
25 /*
26  *	This routine deletes a line from the screen.  It leaves
27  * (_cury,_curx) unchanged.
28  */
29 
30 int
31 wdeleteln(WINDOW *win)
32 {
33 	char	*temp;
34 	int	y;
35 	char	*end;
36 
37 #ifdef DEBUG
38 	fprintf(outf, "DELETELN(%0.2o)\n", win);
39 #endif
40 	temp = win->_y[win->_cury];
41 	for (y = win->_cury; y < win->_maxy - 1; y++) {
42 		if (win->_orig == NULL)
43 			win->_y[y] = win->_y[y + 1];
44 		else
45 			(void) memmove(win->_y[y], win->_y[y+1], win->_maxx);
46 		(void) touchline(win, y, 0, win->_maxx - 1);
47 	}
48 	if (win->_orig == NULL)
49 		win->_y[y] = temp;
50 	else
51 		temp = win->_y[y];
52 	for (end = &temp[win->_maxx]; temp < end; )
53 		*temp++ = ' ';
54 	(void) touchline(win, y, 0, win->_maxx - 1);
55 	if (win->_orig == NULL)
56 		_id_subwins(win);
57 	return (OK);
58 }
59