#!/bin/sh
# This is `vwcurses.02' (part 2 of a multipart archive).
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
# File `vw_curses/curses/box.c' is being continued...
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  echo 'WARNING: not restoring timestamps.  Consider getting and'
  echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if test ! -r _sharseq.tmp; then
  echo 'Please unpack part 1 first!'
  exit 1
fi
shar_sequence=`cat _sharseq.tmp`
if test "$shar_sequence" != 2; then
  echo "Please unpack part $shar_sequence next!"
  exit 1
fi
if test ! -f _sharnew.tmp; then
  echo 'x - still skipping vw_curses/curses/box.c'
else
  echo 'x - continuing file vw_curses/curses/box.c'
  sed 's/^X//' << 'SHAR_EOF' >> 'vw_curses/curses/box.c' &&
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)box.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine draws a box around the given window with "vert"
X * as the vertical delimiting char, and "hor", as the horizontal one.
X *
X */
box(win, vert, hor)
reg WINDOW	*win;
char		vert, hor; {
X
X	reg int		i;
X	reg int		endy, endx;
X	reg char	*fp, *lp;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	endx = win->_maxx;
X	endy = win->_maxy - 1;
X	fp = win->_y[0];
X	lp = win->_y[endy];
X	for (i = 0; i < endx; i++)
X		fp[i] = lp[i] = hor;
X	endx--;
X	for (i = 0; i <= endy; i++)
X		win->_y[i][0] = (win->_y[i][endx] = vert);
X	if (!win->_scroll && (win->_flags&_SCROLLWIN))
X		fp[0] = fp[endx] = lp[0] = lp[endx] = ' ';
X	touchwin(win);
X
X	curses_V();
X        return OK;
}
SHAR_EOF
  echo 'File vw_curses/curses/box.c is complete' &&
  $shar_touch -am 0627091195 'vw_curses/curses/box.c' &&
  chmod 0644 'vw_curses/curses/box.c' ||
  echo 'restore of vw_curses/curses/box.c failed'
  shar_count="`wc -c < 'vw_curses/curses/box.c'`"
  test 1631 -eq "$shar_count" ||
    echo "vw_curses/curses/box.c: original size 1631, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/clrtobot.c ==============
if test -f 'vw_curses/curses/clrtobot.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/clrtobot.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/clrtobot.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/clrtobot.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)clrtobot.c	5.4 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine erases everything on the window.
X *
X */
wclrtobot(win)
reg WINDOW	*win; {
X
X	reg int		y;
X	reg char	*sp, *end, *maxx;
X	reg int		startx, minx;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	startx = win->_curx;
X	for (y = win->_cury; y < win->_maxy; y++) {
X		minx = _NOCHANGE;
X		end = &win->_y[y][win->_maxx];
X		for (sp = &win->_y[y][startx]; sp < end; sp++)
X			if (*sp != ' ') {
X				maxx = sp;
X				if (minx == _NOCHANGE)
X					minx = sp - win->_y[y];
X				*sp = ' ';
X			}
X		if (minx != _NOCHANGE)
X			touchline(win, y, minx, maxx - &win->_y[y][0]);
X		startx = 0;
X	}
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/clrtobot.c' &&
  chmod 0644 'vw_curses/curses/clrtobot.c' ||
  echo 'restore of vw_curses/curses/clrtobot.c failed'
  shar_count="`wc -c < 'vw_curses/curses/clrtobot.c'`"
  test 1580 -eq "$shar_count" ||
    echo "vw_curses/curses/clrtobot.c: original size 1580, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/clrtoeol.c ==============
if test -f 'vw_curses/curses/clrtoeol.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/clrtoeol.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/clrtoeol.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/clrtoeol.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)clrtoeol.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine clears up to the end of line
X *
X */
wclrtoeol(win)
reg WINDOW	*win; {
X
X	reg char	*sp, *end;
X	reg int		y, x;
X	reg char	*maxx;
X	reg int		minx;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	y = win->_cury;
X	x = win->_curx;
X	end = &win->_y[y][win->_maxx];
X	minx = _NOCHANGE;
X	maxx = &win->_y[y][x];
X	for (sp = maxx; sp < end; sp++) {
X		if (*sp != ' ') {
X			maxx = sp;
X			if (minx == _NOCHANGE)
X				minx = sp - win->_y[y];
X			*sp = ' ';
X		}
X	}
X	/*
X	 * update firstch and lastch for the line
X	 */
X	touchline(win, y, win->_curx, win->_maxx - 1);
# ifdef DEBUG
X	fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]);
# endif
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/clrtoeol.c' &&
  chmod 0644 'vw_curses/curses/clrtoeol.c' ||
  echo 'restore of vw_curses/curses/clrtoeol.c failed'
  shar_count="`wc -c < 'vw_curses/curses/clrtoeol.c'`"
  test 1721 -eq "$shar_count" ||
    echo "vw_curses/curses/clrtoeol.c: original size 1721, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/deleteln.c ==============
if test -f 'vw_curses/curses/deleteln.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/deleteln.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/deleteln.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/deleteln.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)deleteln.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine deletes a line from the screen.  It leaves
X * (_cury,_curx) unchanged.
X *
X */
wdeleteln(win)
reg WINDOW	*win;
{
X	reg char	*temp;
X	reg int		y;
X	reg char	*end;
X	reg int		x;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
# ifdef DEBUG
X	fprintf(outf, "DELETELN(%0.2o)\n", win);
# endif
X	temp = win->_y[win->_cury];
X	for (y = win->_cury; y < win->_maxy - 1; y++) {
X		if (win->_orig == NULL)
X			win->_y[y] = win->_y[y + 1];
X		else
X			bcopy(win->_y[y + 1], win->_y[y], win->_maxx);
X		touchline(win, y, 0, win->_maxx - 1);
X	}
X	if (win->_orig == NULL)
X		win->_y[y] = temp;
X	else
X		temp = win->_y[y];
X	for (end = &temp[win->_maxx]; temp < end; )
X		*temp++ = ' ';
/*	touchline(win, win->_cury, 0, win->_maxx - 1);    *** bug !  */
X	touchline(win, y, 0, win->_maxx - 1);
X	if (win->_orig == NULL)
X		_id_subwins(win);
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/deleteln.c' &&
  chmod 0644 'vw_curses/curses/deleteln.c' ||
  echo 'restore of vw_curses/curses/deleteln.c failed'
  shar_count="`wc -c < 'vw_curses/curses/deleteln.c'`"
  test 1823 -eq "$shar_count" ||
    echo "vw_curses/curses/deleteln.c: original size 1823, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/erase.c ==============
if test -f 'vw_curses/curses/erase.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/erase.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/erase.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/erase.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)erase.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine erases everything on the window.
X *
X */
werase(win)
reg WINDOW	*win; {
X
X	reg int		y;
X	reg char	*sp, *end, *start, *maxx;
X	reg int		minx;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
# ifdef DEBUG
X	fprintf(outf, "WERASE(%0.2o)\n", win);
# endif
X	for (y = 0; y < win->_maxy; y++) {
X		minx = _NOCHANGE;
X		start = win->_y[y];
X		end = &start[win->_maxx];
X		for (sp = start; sp < end; sp++)
X			if (*sp != ' ') {
X				maxx = sp;
X				if (minx == _NOCHANGE)
X					minx = sp - start;
X				*sp = ' ';
X			}
X		if (minx != _NOCHANGE)
X			touchline(win, y, minx, maxx - win->_y[y]);
X	}
X	win->_curx = win->_cury = 0;
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/erase.c' &&
  chmod 0644 'vw_curses/curses/erase.c' ||
  echo 'restore of vw_curses/curses/erase.c failed'
  shar_count="`wc -c < 'vw_curses/curses/erase.c'`"
  test 1615 -eq "$shar_count" ||
    echo "vw_curses/curses/erase.c: original size 1615, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/getch.c ==============
if test -f 'vw_curses/curses/getch.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/getch.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/getch.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/getch.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)getch.c	5.5 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine reads in a character from the window.
X *	Note: Callers must not obtain semaphore, or must release it, before
X *            calling due to possibility of blocking I/O in this routine.
X */
wgetch(win)
reg WINDOW	*win; {
X
X	reg bool	weset = FALSE;
X	reg char	inp;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	if (!win->_scroll && (win->_flags&_FULLWIN)
X	    && win->_curx == win->_maxx - 1 && win->_cury == win->_maxy - 1) {
X		curses_V();
X		return ERR;
X        }
# ifdef DEBUG
X	fprintf(outf, "WGETCH: _echoit = %c, _rawmode = %c\n", _echoit ? 'T' : 'F', _rawmode ? 'T' : 'F');
# endif
X	if (_echoit && !_rawmode) {
X		cbreak();
X		weset++;
X	}
X	curses_V();
X	inp = getchar();
X	curses_P();
# ifdef DEBUG
X	fprintf(outf,"WGETCH got '%s'\n",unctrl(inp));
# endif
X	if (_echoit) {
X		mvwaddch(curscr, win->_cury + win->_begy,
X			win->_curx + win->_begx, inp);
X		waddch(win, inp);
X	}
X	if (weset)
X		nocbreak();
X
X	curses_V();
X	return inp;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/getch.c' &&
  chmod 0644 'vw_curses/curses/getch.c' ||
  echo 'restore of vw_curses/curses/getch.c failed'
  shar_count="`wc -c < 'vw_curses/curses/getch.c'`"
  test 1912 -eq "$shar_count" ||
    echo "vw_curses/curses/getch.c: original size 1912, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/insch.c ==============
if test -f 'vw_curses/curses/insch.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/insch.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/insch.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/insch.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)insch.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine performs an insert-char on the line, leaving
X * (_cury,_curx) unchanged.
X *
X */
winsch(win, c)
reg WINDOW	*win;
char		c; {
X
X	reg char	*temp1, *temp2;
X	reg char	*end;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	end = &win->_y[win->_cury][win->_curx];
X	temp1 = &win->_y[win->_cury][win->_maxx - 1];
X	temp2 = temp1 - 1;
X	while (temp1 > end)
X		*temp1-- = *temp2--;
X	*temp1 = c;
X	touchline(win, win->_cury, win->_curx, win->_maxx - 1);
X	if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
X		if (win->_scroll) {
X			wrefresh(win);
X			scroll(win);
X			win->_cury--;
X		}
X		else {
X			curses_V();
X			return ERR;
X		}
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/insch.c' &&
  chmod 0644 'vw_curses/curses/insch.c' ||
  echo 'restore of vw_curses/curses/insch.c failed'
  shar_count="`wc -c < 'vw_curses/curses/insch.c'`"
  test 1636 -eq "$shar_count" ||
    echo "vw_curses/curses/insch.c: original size 1636, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/insertln.c ==============
if test -f 'vw_curses/curses/insertln.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/insertln.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/insertln.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/insertln.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)insertln.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine performs an insert-line on the window, leaving
X * (_cury,_curx) unchanged.
X *
X */
winsertln(win)
reg WINDOW	*win; {
X
X	reg char	*temp;
X	reg int		y;
X	reg char	*end;
X	reg int		x;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
#ifdef	DEBUG
X	fprintf(outf, "INSERTLN(%0.2o)\n", win);
#endif
X	if (win->_orig == NULL)
X		temp = win->_y[win->_maxy - 1];
X	for (y = win->_maxy - 1; y > win->_cury; --y) {
X		if (win->_orig == NULL)
X			win->_y[y] = win->_y[y - 1];
X		else
X			bcopy(win->_y[y - 1], win->_y[y], win->_maxx);
X		touchline(win, y, 0, win->_maxx - 1);
X	}
X	if (win->_orig == NULL)
X		win->_y[y] = temp;
X	else
X		temp = win->_y[y];
X	for (end = &temp[win->_maxx]; temp < end; )
X		*temp++ = ' ';
X	touchline(win, y, 0, win->_maxx - 1);
X	if (win->_orig == NULL)
X		_id_subwins(win);
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/insertln.c' &&
  chmod 0644 'vw_curses/curses/insertln.c' ||
  echo 'restore of vw_curses/curses/insertln.c failed'
  shar_count="`wc -c < 'vw_curses/curses/insertln.c'`"
  test 1789 -eq "$shar_count" ||
    echo "vw_curses/curses/insertln.c: original size 1789, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/mvprintw.c ==============
if test -f 'vw_curses/curses/mvprintw.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/mvprintw.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/mvprintw.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/mvprintw.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)mvprintw.c	5.4 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X * implement the mvprintw commands.  Due to the variable number of
X * arguments, they cannot be macros.  Sigh....
X *
X */
X
mvprintw(y, x, fmt, args)
reg int		y, x;
char		*fmt;
int		args; {
X
X	int	retval;
X	char	buf[512];
X
X	curses_P();
X	if (move(y, x) != OK) {
X		curses_V();
X		return ERR;
X        }
X	(void) vsprintf(buf, fmt, &args);
X	retval= waddstr(stdscr, buf);
X	curses_V();
X	return retval;
}
X
mvwprintw(win, y, x, fmt, args)
reg WINDOW	*win;
reg int		y, x;
char		*fmt;
int		args; {
X
X	int	retval;
X	char	buf[512];
X
X	curses_P();
X	if (wmove(win, y, x) != OK) {
X		curses_V();
X		return ERR;
X	}
X	(void) vsprintf(buf, fmt, &args);
X	retval= waddstr(win, buf);
X	curses_V();
X	return retval;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/mvprintw.c' &&
  chmod 0644 'vw_curses/curses/mvprintw.c' ||
  echo 'restore of vw_curses/curses/mvprintw.c failed'
  shar_count="`wc -c < 'vw_curses/curses/mvprintw.c'`"
  test 1631 -eq "$shar_count" ||
    echo "vw_curses/curses/mvprintw.c: original size 1631, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/mvscanw.c ==============
if test -f 'vw_curses/curses/mvscanw.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/mvscanw.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/mvscanw.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/mvscanw.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)mvscanw.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X * implement the mvscanw commands.  Due to the variable number of
X * arguments, they cannot be macros.  Another sigh....
X *
X */
X
mvscanw(y, x, fmt, args)
reg int		y, x;
char		*fmt;
int		args; {
X
X	int retval;
X
X	curses_P();
X	if (move(y, x) != OK) {
X		curses_V();
X		return ERR;
X        }
X	retval= _sscans(stdscr, fmt, &args);
X	curses_V();
X	return retval;
}
X
mvwscanw(win, y, x, fmt, args)
reg WINDOW	*win;
reg int		y, x;
char		*fmt;
int		args; {
X
X	int retval;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	if (wmove(win, y, x) != OK) {
X		curses_V();
X		return ERR;
X        }
X	retval= _sscans(win, fmt, &args);
X
X	curses_V();
X	return retval;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/mvscanw.c' &&
  chmod 0644 'vw_curses/curses/mvscanw.c' ||
  echo 'restore of vw_curses/curses/mvscanw.c failed'
  shar_count="`wc -c < 'vw_curses/curses/mvscanw.c'`"
  test 1614 -eq "$shar_count" ||
    echo "vw_curses/curses/mvscanw.c: original size 1614, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/mvwin.c ==============
if test -f 'vw_curses/curses/mvwin.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/mvwin.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/mvwin.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/mvwin.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)mvwin.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X * relocate the starting position of a window
X *
X */
X
mvwin(win, by, bx)
reg WINDOW	*win;
reg int		by, bx; {
X
X	register WINDOW	*orig;
X	register int	dy, dx;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	if (by + win->_maxy > LINES || bx + win->_maxx > COLS) {
X		curses_V();
X		return ERR;
X        }
X	dy = by - win->_begy;
X	dx = bx - win->_begx;
X	orig = win->_orig;
X	if (orig == NULL) {
X		orig = win;
X		do {
X			win->_begy += dy;
X			win->_begx += dx;
X			_swflags_(win);
X			win = win->_nextp;
X		} while (win != orig);
X	}
X	else {
X		if (by < orig->_begy || win->_maxy + dy > orig->_maxy) {
X			curses_V();
X			return ERR;
X        	}
X		if (bx < orig->_begx || win->_maxx + dx > orig->_maxx) {
X			curses_V();
X			return ERR;
X        	}
X		win->_begy = by;
X		win->_begx = bx;
X		_swflags_(win);
X		_set_subwin_(orig, win);
X	}
X	touchwin(win);
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/mvwin.c' &&
  chmod 0644 'vw_curses/curses/mvwin.c' ||
  echo 'restore of vw_curses/curses/mvwin.c failed'
  shar_count="`wc -c < 'vw_curses/curses/mvwin.c'`"
  test 1828 -eq "$shar_count" ||
    echo "vw_curses/curses/mvwin.c: original size 1828, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/overlay.c ==============
if test -f 'vw_curses/curses/overlay.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/overlay.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/overlay.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/overlay.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)overlay.c	5.5 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
# include	<ctype.h>
X
#ifndef min
# define	min(a,b)	((a) < (b) ? (a) : (b))
# define	max(a,b)	((a) > (b) ? (a) : (b))
#endif
X
/*
X *	This routine writes win1 on win2 non-destructively.
X *
X */
overlay(win1, win2)
reg WINDOW	*win1, *win2; {
X
X	reg char	*sp, *end;
X	reg int		x, y, endy, endx, starty, startx;
X	reg int 	y1,y2;
X
X	curses_P();
X
X	if (win1 == NULL || win2 == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
# ifdef DEBUG
X	fprintf(outf, "OVERLAY(%0.2o, %0.2o);\n", win1, win2);
# endif
X	starty = max(win1->_begy, win2->_begy);
X	startx = max(win1->_begx, win2->_begx);
X	endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy);
X	endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx);
# ifdef DEBUG
X	fprintf(outf, "OVERLAY:from (%d,%d) to (%d,%d)\n", starty, startx, endy, endx);
# endif
X	if (starty >= endy || startx >= endx) {
X		curses_V();
X		return;
X        }
X	y1 = starty - win1->_begy;
X	y2 = starty - win2->_begy;
X	for (y = starty; y < endy; y++, y1++, y2++) {
X		end = &win1->_y[y1][endx - win1->_begx];
X		x = startx - win2->_begx;
X		for (sp = &win1->_y[y1][startx - win1->_begx]; sp < end; sp++) {
X			if (!isspace(*sp))
X				mvwaddch(win2, y2, x, *sp);
X			x++;
X		}
X	}
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/overlay.c' &&
  chmod 0644 'vw_curses/curses/overlay.c' ||
  echo 'restore of vw_curses/curses/overlay.c failed'
  shar_count="`wc -c < 'vw_curses/curses/overlay.c'`"
  test 2164 -eq "$shar_count" ||
    echo "vw_curses/curses/overlay.c: original size 2164, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/touchwin.c ==============
if test -f 'vw_curses/curses/touchwin.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/touchwin.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/touchwin.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/touchwin.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)touchwin.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X * make it look like the whole window has been changed.
X *
X */
touchwin(win)
register WINDOW	*win;
{
X	register int	y, maxy;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
# ifdef	DEBUG
X	fprintf(outf, "TOUCHWIN(%0.2o)\n", win);
# endif
X	maxy = win->_maxy;
X	for (y = 0; y < maxy; y++)
X		touchline(win, y, 0, win->_maxx - 1);
X
X	curses_V();
X	return OK;
}
X
/*
X * touch a given line
X */
touchline(win, y, sx, ex)
register WINDOW	*win;
register int	y, sx, ex;
{
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
# ifdef DEBUG
X	fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex);
X	fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
# endif
X	sx += win->_ch_off;
X	ex += win->_ch_off;
X	if (win->_firstch[y] == _NOCHANGE) {
X		win->_firstch[y] = sx;
X		win->_lastch[y] = ex;
X	}
X	else {
X		if (win->_firstch[y] > sx)
X			win->_firstch[y] = sx;
X		if (win->_lastch[y] < ex)
X			win->_lastch[y] = ex;
X	}
# ifdef	DEBUG
X	fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
# endif
X
X	curses_V();
X	return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/touchwin.c' &&
  chmod 0644 'vw_curses/curses/touchwin.c' ||
  echo 'restore of vw_curses/curses/touchwin.c failed'
  shar_count="`wc -c < 'vw_curses/curses/touchwin.c'`"
  test 2067 -eq "$shar_count" ||
    echo "vw_curses/curses/touchwin.c: original size 2067, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/tstp.c ==============
if test -f 'vw_curses/curses/tstp.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/tstp.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/tstp.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/tstp.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)tstp.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
#ifndef VxWorks
# include	<signal.h>
#endif
X
# include	"curses.ext"
X
/*
X * handle stop and start signals
X *
X * @(#)tstp.c	5.3 (Berkeley) 6/30/88
X */
tstp() {
X
# ifdef SIGTSTP
X
X	SGTTY	tty;
X	int	omask;
# ifdef DEBUG
X	if (outf)
X		fflush(outf);
# endif
X	tty = _tty;
X	mvcur(0, COLS - 1, LINES - 1, 0);
X	endwin();
X	fflush(stdout);
X	/* reset signal handler so kill below stops us */
X	signal(SIGTSTP, SIG_DFL);
#define	mask(s)	(1 << ((s)-1))
X	omask = sigsetmask(sigblock(0) &~ mask(SIGTSTP));
X	kill(0, SIGTSTP);
X	sigblock(mask(SIGTSTP));
X	signal(SIGTSTP, tstp);
X	_tty = tty;
X	stty(_tty_ch, &_tty);
X	wrefresh(curscr);
# endif	SIGTSTP
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/tstp.c' &&
  chmod 0644 'vw_curses/curses/tstp.c' ||
  echo 'restore of vw_curses/curses/tstp.c failed'
  shar_count="`wc -c < 'vw_curses/curses/tstp.c'`"
  test 1545 -eq "$shar_count" ||
    echo "vw_curses/curses/tstp.c: original size 1545, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/unctrl.c ==============
if test -f 'vw_curses/curses/unctrl.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/unctrl.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/unctrl.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/unctrl.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)unctrl.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
/*
X * define unctrl codes for each character
X *
X */
X
/* LINTLIBRARY */
char	*_unctrl[]	= {	/* unctrl codes for ttys		*/
X	"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
X	"^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
X	"^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
X	" ", "!", "\"", "#", "$",  "%", "&", "'", "(", ")", "*", "+", ",", "-",
X	".", "/", "0",  "1", "2",  "3", "4", "5", "6", "7", "8", "9", ":", ";",
X	"<", "=", ">",  "?", "@",  "A", "B", "C", "D", "E", "F", "G", "H", "I",
X	"J", "K", "L",  "M", "N",  "O", "P", "Q", "R", "S", "T", "U", "V", "W",
X	"X", "Y", "Z",  "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
X	"f", "g", "h",  "i", "j",  "k", "l", "m", "n", "o", "p", "q", "r", "s",
X	"t", "u", "v",  "w", "x",  "y", "z", "{", "|", "}", "~", "^?"
};
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/unctrl.c' &&
  chmod 0644 'vw_curses/curses/unctrl.c' ||
  echo 'restore of vw_curses/curses/unctrl.c failed'
  shar_count="`wc -c < 'vw_curses/curses/unctrl.c'`"
  test 1740 -eq "$shar_count" ||
    echo "vw_curses/curses/unctrl.c: original size 1740, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/addbytes.c ==============
if test -f 'vw_curses/curses/addbytes.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/addbytes.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/addbytes.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/addbytes.c' &&
/*
X * Copyright (c) 1987 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)addbytes.c	5.3 (Berkeley) 6/30/88";
#endif /* not lint */
X
# include	"curses.ext"
X
/*
X *	This routine adds the character to the current position
X *
X */
waddbytes(win, bytes, count)
reg WINDOW	*win;
reg char	*bytes;
reg int		count;
{
#define	SYNCH_OUT()	{win->_cury = y; win->_curx = x;}
#define	SYNCH_IN()	{y = win->_cury; x = win->_curx;}
X	reg int		x, y;
X	reg int		newx;
X
X	curses_P();
X
X	if (win == NULL) {
X	    curses_V();
X	    return ERR;
X	}
X
X	SYNCH_IN();
# ifdef FULLDEBUG
X	fprintf(outf, "ADDBYTES('%c') at (%d, %d)\n", c, y, x);
# endif
X	while (count--) {
X	    register int c;
X	    static char blanks[] = "        ";
X
X	    c = *bytes++;
X	    switch (c) {
X	      case '\t':
X		    SYNCH_IN();
X		    if (waddbytes(win, blanks, 8-(x%8)) == ERR) {
X			curses_V();
X			return ERR;
X		    }
X		    SYNCH_OUT();
X		    break;
X
X	      default:
# ifdef FULLDEBUG
X		    fprintf(outf, "ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, win->_firstch[y], win->_lastch[y]);
# endif
X		    if (win->_flags & _STANDOUT)
X			    c |= _STANDOUT;
X		    {
# ifdef	FULLDEBUG
X			    fprintf(outf, "ADDBYTES(%0.2o, %d, %d)\n", win, y, x);
# endif
X			    if (win->_y[y][x] != c) {
X				    newx = x + win->_ch_off;
X				    if (win->_firstch[y] == _NOCHANGE) {
X					    win->_firstch[y] =
X							    win->_lastch[y] = newx;
X				    } else if (newx < win->_firstch[y])
X					    win->_firstch[y] = newx;
X				    else if (newx > win->_lastch[y])
X					    win->_lastch[y] = newx;
# ifdef FULLDEBUG
X				    fprintf(outf, "ADDBYTES: change gives f/l: %d/%d [%d/%d]\n",
X					    win->_firstch[y], win->_lastch[y],
X					    win->_firstch[y] - win->_ch_off,
X					    win->_lastch[y] - win->_ch_off);
# endif
X			    }
X		    }
X		    win->_y[y][x++] = c;
X		    if (x >= win->_maxx) {
X			    x = 0;
X    newline:
X			    if (++y >= win->_maxy)  {
X				    --y;
X				    if (win->_scroll) {
X					    SYNCH_OUT();
X					    scroll(win);
X				  	    SYNCH_IN();
X				    }
X				    else {
X					    /* leave cursor at end */
X					    x=win->_maxx-1;
X    					    SYNCH_OUT();
X					    curses_V();
X					    return ERR;
X				    }
X                            }
X		    }
# ifdef FULLDEBUG
X		    fprintf(outf, "ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, win->_firstch[y], win->_lastch[y]);
# endif
X		    break;
X	      case '\n':
X		    SYNCH_OUT();
X		    wclrtoeol(win);
X		    SYNCH_IN();
X		    if (!NONL)
X			    x = 0;
X		    goto newline;
X	      case '\r':
X		    x = 0;
X		    break;
X	      case '\b':
X		    if (--x < 0)
X			    x = 0;
X		    break;
X	    }
X    }
X    SYNCH_OUT();
X    curses_V();
X    return OK;
}
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/addbytes.c' &&
  chmod 0644 'vw_curses/curses/addbytes.c' ||
  echo 'restore of vw_curses/curses/addbytes.c failed'
  shar_count="`wc -c < 'vw_curses/curses/addbytes.c'`"
  test 3450 -eq "$shar_count" ||
    echo "vw_curses/curses/addbytes.c: original size 3450, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/curses.c ==============
if test -f 'vw_curses/curses/curses.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/curses.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/curses.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/curses.c' &&
/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
#ifndef lint
static char sccsid[] = "@(#)curses.c	5.5 (Berkeley) 6/30/88";
#endif /* not lint */
X
/*
X * Define global variables
X *
X */
# include	"curses.h"
X
bool	_echoit		= TRUE,	/* set if stty indicates ECHO		*/
X	_rawmode	= FALSE,/* set if stty indicates RAW mode	*/
X	My_term		= FALSE,/* set if user specifies terminal type	*/
X	_endwin		= FALSE;/* set if endwin has been called	*/
X
char	ttytype[80],		/* long name of tty			*/
X	_termunknown[80] = "unknown",
X	*Def_term    	= _termunknown;	/* default terminal type	*/
X
int	_tty_ch		= 1,	/* file channel which is a tty		*/
X	LINES,			/* number of lines allowed on screen	*/
X	COLS,			/* number of columns allowed on screen	*/
X	_res_flg;		/* sgtty flags for reseting later	*/
X
WINDOW	*stdscr		= NULL,
X	*curscr		= NULL;
X
# ifdef DEBUG
FILE	*outf;			/* debug output file			*/
# endif
X
#ifndef VxWorks
SGTTY	_tty;			/* tty modes				*/
#endif
X
bool	AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL, XB, XN,
X	XT, XS, XX;
char	*AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM,
X	*DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, *K7, *K8,
X	*K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU,
X	*LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, *SO, *SR, *TA, *TE,
X	*TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *AL_PARM, *DL_PARM,
X	*UP_PARM, *DOWN_PARM, *LEFT_PARM, *RIGHT_PARM;
char	PC;
X
/*
X * From the tty modes...
X */
X
bool	GT, NONL, UPPERCASE, normtty, _pfast;
SHAR_EOF
  $shar_touch -am 0627091195 'vw_curses/curses/curses.c' &&
  chmod 0644 'vw_curses/curses/curses.c' ||
  echo 'restore of vw_curses/curses/curses.c failed'
  shar_count="`wc -c < 'vw_curses/curses/curses.c'`"
  test 2236 -eq "$shar_count" ||
    echo "vw_curses/curses/curses.c: original size 2236, current size $shar_count"
  rm -f _sharnew.tmp
fi
# ============= vw_curses/curses/delwin.c ==============
if test -f 'vw_curses/curses/delwin.c' && test X"$1" != X"-c"; then
  echo 'x - skipping vw_curses/curses/delwin.c (file already exists)'
  rm -f _sharnew.tmp
else
  > _sharnew.tmp
  echo 'x - extracting vw_curses/curses/delwin.c (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'vw_curses/curses/delwin.c' &&
/*
SHAR_EOF
  : || echo 'restore of vw_curses/curses/delwin.c failed'
fi
echo 'End of archive part 2'
echo 'File vw_curses/curses/delwin.c is continued in part 3'
echo 3 > _sharseq.tmp
exit 0
