subwin.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 53 行

C
53
字号
#ifdef lintstatic char *sccsid = "@(#)subwin.c	4.1	(ULTRIX)	7/2/90";#endif lint# include	"curses.ext"# include	<signal.h>char	*calloc();char	*malloc();extern	char	*getenv();extern	WINDOW	*makenew();WINDOW *subwin(orig, num_lines, num_cols, begy, begx)register WINDOW	*orig;int	num_lines, num_cols, begy, begx;{	register int i;	register WINDOW	*win;	register int by, bx, nlines, ncols;	register int j, k;	by = begy;	bx = begx;	nlines = num_lines;	ncols = num_cols;	/*	 * make sure window fits inside the original one	 */# ifdef	DEBUG	if(outf) fprintf(outf, "SUBWIN(%0.2o, %d, %d, %d, %d)\n", orig, nlines, ncols, by, bx);# endif	if (by < orig->_begy || bx < orig->_begx	    || by + nlines > orig->_begy + orig->_maxy	    || bx + ncols  > orig->_begx + orig->_maxx)		return NULL;	if (nlines == 0)		nlines = orig->_maxy - orig->_begy - by;	if (ncols == 0)		ncols = orig->_maxx - orig->_begx - bx;	if ((win = makenew(nlines, ncols, by, bx)) == NULL)		return NULL;	j = by - orig->_begy;	k = bx - orig->_begx;	for (i = 0; i < nlines; i++)		win->_y[i] = &orig->_y[j++][k];	win->_flags = _SUBWIN;	return win;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?