summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/lib_inchstr.c
blob: d0ad351360f4b5188c3665f37566ca8094352d4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
*  details. If they are missing then this copy is in violation of    *
*  the copyright conditions.                                        */

/*
**	lib_inchstr.c
**
**	The routine winchnstr().
**
*/

#include "curses.priv.h"

int  winchnstr(WINDOW *win, chtype *chstr, int i)
{
chtype	*point, *end;

	T(("winschnstr(%x,'%x',%d) called", win, chstr, i));

	point = &win->_line[win->_cury][win->_curx];
	end = &win->_line[win->_cury][win->_maxx];
	if (point + i - 1 < end)
		end = point + i - 1;

	chstr = (chtype *)malloc((end - point + 1)*sizeof(chtype));
	chstr[end - point] = '\0';
	return OK;
}
OpenPOWER on IntegriCloud