diff options
38 files changed, 275 insertions, 177 deletions
| diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c index 5ec3a06a47ba..6dd8bf959b57 100644 --- a/lib/libcurses/addbytes.c +++ b/lib/libcurses/addbytes.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1987, 1993 + * Copyright (c) 1987, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)addbytes.c	8.3 (Berkeley) 3/19/94"; +static char sccsid[] = "@(#)addbytes.c	8.4 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  #define	SYNCH_IN	{y = win->cury; x = win->curx;}  #define	SYNCH_OUT	{win->cury = y; win->curx = x;} diff --git a/lib/libcurses/addch.c b/lib/libcurses/addch.c index a045c879f1c2..d5f30014c02f 100644 --- a/lib/libcurses/addch.c +++ b/lib/libcurses/addch.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)addch.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)addch.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * waddch -- diff --git a/lib/libcurses/addnstr.c b/lib/libcurses/addnstr.c index bf607a07a1f0..92a6e681a54f 100644 --- a/lib/libcurses/addnstr.c +++ b/lib/libcurses/addnstr.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1993 + * Copyright (c) 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)addnstr.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)addnstr.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * waddnstr --   *	Add a string (at most n characters) to the given window diff --git a/lib/libcurses/box.c b/lib/libcurses/box.c index 4da23036c8af..191e37cfd82f 100644 --- a/lib/libcurses/box.c +++ b/lib/libcurses/box.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)box.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)box.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * box -- diff --git a/lib/libcurses/clear.c b/lib/libcurses/clear.c index 89891e234975..54c0b30d3cfc 100644 --- a/lib/libcurses/clear.c +++ b/lib/libcurses/clear.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)clear.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)clear.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wclear -- diff --git a/lib/libcurses/clrtobot.c b/lib/libcurses/clrtobot.c index 0e73ef88eb85..81ee6a4603ad 100644 --- a/lib/libcurses/clrtobot.c +++ b/lib/libcurses/clrtobot.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)clrtobot.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)clrtobot.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wclrtobot -- diff --git a/lib/libcurses/clrtoeol.c b/lib/libcurses/clrtoeol.c index 6fa63b420615..44fc190fee3d 100644 --- a/lib/libcurses/clrtoeol.c +++ b/lib/libcurses/clrtoeol.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)clrtoeol.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)clrtoeol.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wclrtoeol -- diff --git a/lib/libcurses/cr_put.c b/lib/libcurses/cr_put.c index 2f7a9e9d59ef..ada2df5ca1e5 100644 --- a/lib/libcurses/cr_put.c +++ b/lib/libcurses/cr_put.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)cr_put.c	8.2 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)cr_put.c	8.3 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  #define	HARDTABS	8  /* diff --git a/lib/libcurses/curses.c b/lib/libcurses/curses.c index 87ed83965641..07cbb5b4afd8 100644 --- a/lib/libcurses/curses.c +++ b/lib/libcurses/curses.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)curses.c	8.2 (Berkeley) 1/2/94"; +static char sccsid[] = "@(#)curses.c	8.3 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h> +#include "curses.h"  /* Private. */  int	__echoit = 1;			/* If stty indicates ECHO. */ diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 0eaef1e73a77..3c585e63ea7c 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -30,12 +30,15 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	@(#)curses.h	8.2 (Berkeley) 1/2/94 + *	@(#)curses.h	8.3 (Berkeley) 7/27/94   */  #ifndef _CURSES_H_  #define	_CURSES_H_ +#include <sys/types.h> +#include <sys/cdefs.h> +  #include <stdio.h>  /* @@ -137,14 +140,13 @@ typedef struct __window {		/* Window structure. */  #define	__ENDLINE	0x001		/* End of screen. */  #define	__FLUSH		0x002		/* Fflush(stdout) after refresh. */ -#define	__FULLLINE	0x004		/* Line width = terminal width. */ -#define	__FULLWIN	0x008		/* Window is a screen. */ -#define	__IDLINE	0x010		/* Insert/delete sequences. */ -#define	__SCROLLWIN	0x020		/* Last char will scroll window. */ -#define	__SCROLLOK	0x040		/* Scrolling ok. */ -#define	__CLEAROK	0x080		/* Clear on next refresh. */ -#define __WSTANDOUT	0x100		/* Standout window */ -#define __LEAVEOK	0x200		/* If curser left */	 +#define	__FULLWIN	0x004		/* Window is a screen. */ +#define	__IDLINE	0x008		/* Insert/delete sequences. */ +#define	__SCROLLWIN	0x010		/* Last char will scroll window. */ +#define	__SCROLLOK	0x020		/* Scrolling ok. */ +#define	__CLEAROK	0x040		/* Clear on next refresh. */ +#define __WSTANDOUT	0x080		/* Standout window */ +#define __LEAVEOK	0x100		/* If curser left */	  	u_int flags;  } WINDOW; @@ -309,7 +311,7 @@ void	 __stop_signal_handler __P((int));  void	 __swflags __P((WINDOW *));  int	 __touchline __P((WINDOW *, int, int, int, int));  int	 __touchwin __P((WINDOW *)); -char	*__tscroll __P((const char *, int)); +char	*__tscroll __P((const char *, int, int));  int	 __waddch __P((WINDOW *, __LDATA *));  /* Private #defines. */ diff --git a/lib/libcurses/delch.c b/lib/libcurses/delch.c index ad7d3526eeb1..b9cdc3140ed3 100644 --- a/lib/libcurses/delch.c +++ b/lib/libcurses/delch.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)delch.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)delch.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * wdelch --   *	Do an insert-char on the line, leaving (cury, curx) unchanged. diff --git a/lib/libcurses/deleteln.c b/lib/libcurses/deleteln.c index 6c4688acb5e7..4cb08ea37947 100644 --- a/lib/libcurses/deleteln.c +++ b/lib/libcurses/deleteln.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)deleteln.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)deleteln.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * wdeleteln --   *	Delete a line from the screen.  It leaves (cury, curx) unchanged. diff --git a/lib/libcurses/delwin.c b/lib/libcurses/delwin.c index 3f6848a56b62..7310db8588ca 100644 --- a/lib/libcurses/delwin.c +++ b/lib/libcurses/delwin.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)delwin.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)delwin.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <stdlib.h> +#include "curses.h" +  /*   * delwin --   *	Delete a window and release it back to the system. diff --git a/lib/libcurses/erase.c b/lib/libcurses/erase.c index b19e15b3fc42..42ca68a35a64 100644 --- a/lib/libcurses/erase.c +++ b/lib/libcurses/erase.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)erase.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)erase.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * werase -- diff --git a/lib/libcurses/getch.c b/lib/libcurses/getch.c index 77825bbbdae6..6108229708dd 100644 --- a/lib/libcurses/getch.c +++ b/lib/libcurses/getch.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)getch.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)getch.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wgetch -- diff --git a/lib/libcurses/getstr.c b/lib/libcurses/getstr.c index 6194f1f86689..daf8e61b7fd7 100644 --- a/lib/libcurses/getstr.c +++ b/lib/libcurses/getstr.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)getstr.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)getstr.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wgetstr -- diff --git a/lib/libcurses/id_subwins.c b/lib/libcurses/id_subwins.c index 6dc715c2572f..3528348ff467 100644 --- a/lib/libcurses/id_subwins.c +++ b/lib/libcurses/id_subwins.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)id_subwins.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)id_subwins.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * __id_subwins -- diff --git a/lib/libcurses/idlok.c b/lib/libcurses/idlok.c index ef0a1e20d8ba..4d3bb5926979 100644 --- a/lib/libcurses/idlok.c +++ b/lib/libcurses/idlok.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)idlok.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)idlok.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * idlok -- diff --git a/lib/libcurses/initscr.c b/lib/libcurses/initscr.c index 8ed0f9f769a1..1af8b6f34ea5 100644 --- a/lib/libcurses/initscr.c +++ b/lib/libcurses/initscr.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,13 +32,14 @@   */  #ifndef lint -static char sccsid[] = "@(#)initscr.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)initscr.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <signal.h>  #include <stdlib.h> +#include "curses.h" +  /*   * initscr --   *	Initialize the current and standard screen. diff --git a/lib/libcurses/insch.c b/lib/libcurses/insch.c index 41b7383e01ae..36cc0dee8940 100644 --- a/lib/libcurses/insch.c +++ b/lib/libcurses/insch.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)insch.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)insch.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * winsch --   *	Do an insert-char on the line, leaving (cury, curx) unchanged. diff --git a/lib/libcurses/insertln.c b/lib/libcurses/insertln.c index 87a61eeedbbb..c2179f0f187f 100644 --- a/lib/libcurses/insertln.c +++ b/lib/libcurses/insertln.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)insertln.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)insertln.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * winsertln --   *	Do an insert-line on the window, leaving (cury, curx) unchanged. diff --git a/lib/libcurses/move.c b/lib/libcurses/move.c index 60a377b273fa..1e22fb0648de 100644 --- a/lib/libcurses/move.c +++ b/lib/libcurses/move.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)move.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)move.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wmove -- diff --git a/lib/libcurses/mvwin.c b/lib/libcurses/mvwin.c index 5699295769c3..1471b27e1868 100644 --- a/lib/libcurses/mvwin.c +++ b/lib/libcurses/mvwin.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)mvwin.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)mvwin.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  /*   * mvwin -- diff --git a/lib/libcurses/newwin.c b/lib/libcurses/newwin.c index a2f577a6f98e..161b5d9fdc8a 100644 --- a/lib/libcurses/newwin.c +++ b/lib/libcurses/newwin.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)newwin.c	8.1 (Berkeley) 7/20/93"; +static char sccsid[] = "@(#)newwin.c	8.3 (Berkeley) 7/27/94";  #endif	/* not lint */ -#include <curses.h>  #include <stdlib.h> +#include "curses.h" +  #undef	nl		/* Don't need it here, and it interferes. */  static WINDOW 	*__makenew __P((int, int, int, int, int)); @@ -232,16 +233,11 @@ void  __swflags(win)  	register WINDOW *win;  { -	win->flags &=  -	    ~(__ENDLINE | __FULLLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK); +	win->flags &= ~(__ENDLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK);  	if (win->begx + win->maxx == COLS) {  		win->flags |= __ENDLINE; -		if (win->begx == 0) { -			if (AL && DL) -				win->flags |= __FULLLINE; -			if (win->maxy == LINES && win->begy == 0) +		if (win->begx == 0 && win->maxy == LINES && win->begy == 0)  				win->flags |= __FULLWIN; -		}  		if (win->begy + win->maxy == LINES)  			win->flags |= __SCROLLWIN;  	} diff --git a/lib/libcurses/overlay.c b/lib/libcurses/overlay.c index 77248dbbf758..9f35c79e3fb8 100644 --- a/lib/libcurses/overlay.c +++ b/lib/libcurses/overlay.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,11 +32,12 @@   */  #ifndef lint -static char sccsid[] = "@(#)overlay.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)overlay.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */  #include <ctype.h> -#include <curses.h> + +#include "curses.h"  /*   * overlay -- diff --git a/lib/libcurses/overwrite.c b/lib/libcurses/overwrite.c index 55c2b5e60d4b..e2d91bd0a8c5 100644 --- a/lib/libcurses/overwrite.c +++ b/lib/libcurses/overwrite.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,13 +32,14 @@   */  #ifndef lint -static char sccsid[] = "@(#)overwrite.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)overwrite.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */  #include <ctype.h> -#include <curses.h>  #include <string.h> +#include "curses.h" +  /*   * overwrite --   *	Writes win1 on win2 destructively. diff --git a/lib/libcurses/printw.c b/lib/libcurses/printw.c index bc34ce621b20..ae6ea49dabf2 100644 --- a/lib/libcurses/printw.c +++ b/lib/libcurses/printw.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,17 +32,17 @@   */  #ifndef lint -static char sccsid[] = "@(#)printw.c	8.2 (Berkeley) 10/5/93"; +static char sccsid[] = "@(#)printw.c	8.3 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> -  #ifdef __STDC__  #include <stdarg.h>  #else  #include <varargs.h>  #endif +#include "curses.h" +  /*   * printw and friends.   * diff --git a/lib/libcurses/putchar.c b/lib/libcurses/putchar.c index 7309bdee458f..2ed5bb4755cc 100644 --- a/lib/libcurses/putchar.c +++ b/lib/libcurses/putchar.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)putchar.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)putchar.c	8.2 (Berkeley) 5/4/94";  #endif	/* not lint */ -#include <curses.h> +#include "curses.h"  void  __cputchar(ch) diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index 1cd62f05300f..d2f5ca6f2c37 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,13 @@   */  #ifndef lint -static char sccsid[] = "@(#)refresh.c	8.1 (Berkeley) 7/20/93"; +static char sccsid[] = "@(#)refresh.c	8.4 (Berkeley) 8/4/94";  #endif /* not lint */ -#include <curses.h>  #include <string.h> +#include "curses.h" +  static int curwin;  static short ly, lx; @@ -652,8 +653,7 @@ quickch(win)  			__CTRACE("\n");  			__CTRACE("W: %d:", i);  			for (j = 0; j < win->maxx; j++)  -				__CTRACE("%c",  -			           win->lines[i]->line[j].ch); +				__CTRACE("%c", win->lines[i]->line[j].ch);  			__CTRACE("\n");  		}  #endif @@ -670,7 +670,8 @@ quickch(win)  }  /* - * Scrolln performs the scroll by n lines, where n is starts - startw. + * scrolln -- + *	Scroll n lines, where n is starts - startw.   */  static void  scrolln(win, starts, startw, curs, bot, top) @@ -683,41 +684,126 @@ scrolln(win, starts, startw, curs, bot, top)  	ox = curscr->curx;  	n = starts - startw; +	/* +	 * XXX +	 * The initial tests that set __noqch don't let us reach here unless +	 * we have either CS + HO + SF/sf/SR/sr, or AL + DL.  SF/sf and SR/sr +	 * scrolling can only shift the entire scrolling region, not just a +	 * part of it, which means that the quickch() routine is going to be +	 * sadly disappointed in us if we don't have CS as well. +	 * +	 * If CS, HO and SF/sf are set, can use the scrolling region.  Because +	 * the cursor position after CS is undefined, we need HO which gives us +	 * the ability to move to somewhere without knowledge of the current +	 * location of the cursor.  Still call __mvcur() anyway, to update its +	 * idea of where the cursor is. +	 * +	 * When the scrolling region has been set, the cursor has to be at the +	 * last line of the region to make the scroll happen. +	 * +	 * Doing SF/SR or AL/DL appears faster on the screen than either sf/sr +	 * or al/dl, and, some terminals have AL/DL, sf/sr, and CS, but not +	 * SF/SR.  So, if we're scrolling almost all of the screen, try and use +	 * AL/DL, otherwise use the scrolling region.  The "almost all" is a +	 * shameless hack for vi. +	 */  	if (n > 0) { -		__mvcur(oy, ox, top, 0, 1); -		/* Scroll up the block */ -		if (DL) -			tputs(__tscroll(DL, n), 0, __cputchar); +		if (CS != NULL && HO != NULL && (SF != NULL || +		    (AL == NULL || DL == NULL || +		    top > 3 || bot + 3 < win->maxy) && sf != NULL)) { +			tputs(__tscroll(CS, top, bot + 1), 0, __cputchar); +			__mvcur(oy, ox, 0, 0, 1); +			tputs(HO, 0, __cputchar); +			__mvcur(0, 0, bot, 0, 1); +			if (SF != NULL) +				tputs(__tscroll(SF, n, 0), 0, __cputchar);  		else -			for(i = 0; i < n; i++) +				for (i = 0; i < n; i++) +					tputs(sf, 0, __cputchar); +			tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar); +			__mvcur(bot, 0, 0, 0, 1); +			tputs(HO, 0, __cputchar); +			__mvcur(0, 0, oy, ox, 1); +			return; +		} + +		/* Scroll up the block. */ +		__mvcur(oy, ox, top, 0, 1); +		if (SF != NULL && top == 0) +			tputs(__tscroll(SF, n, 0), 0, __cputchar); +		else if (DL != NULL) +			tputs(__tscroll(DL, n, 0), 0, __cputchar); +		else if (dl != NULL) +			for (i = 0; i < n; i++)  				tputs(dl, 0, __cputchar); +		else if (sf != NULL && top == 0) +			for (i = 0; i < n; i++) +				tputs(sf, 0, __cputchar); +		else +			abort(); -		/*  -		 * Push down the bottom region. -		 */ +		/* Push down the bottom region. */  		__mvcur(top, 0, bot - n + 1, 0, 1); -		if (AL)  -			tputs(__tscroll(AL, n), 0, __cputchar); -		else -			for(i = 0; i < n; i++) +		if (AL != NULL) +			tputs(__tscroll(AL, n, 0), 0, __cputchar); +		else if (al != NULL) +			for (i = 0; i < n; i++)  				tputs(al, 0, __cputchar); +		else +			abort();  		__mvcur(bot - n + 1, 0, oy, ox, 1);  	} else { -		/* Preserve the bottom lines */ -		__mvcur(oy, ox, bot + n + 1, 0, 1);	/* n < 0 */ -		if (DL) -			tputs(__tscroll(DL, -n), 0, __cputchar); +		/* +		 * !!! +		 * n < 0 +		 * +		 * If CS, HO and SR/sr are set, can use the scrolling region. +		 * See the above comments for details. +		 */ +		if (CS != NULL && HO != NULL && (SR != NULL || +		    (AL == NULL || DL == NULL || +		    top > 3 || bot + 3 < win->maxy) && sr != NULL)) { +			tputs(__tscroll(CS, top, bot + 1), 0, __cputchar); +			__mvcur(oy, ox, 0, 0, 1); +			tputs(HO, 0, __cputchar); +			__mvcur(0, 0, top, 0, 1); + +			if (SR != NULL) +				tputs(__tscroll(SR, -n, 0), 0, __cputchar);  		else -		       	for(i = n; i < 0; i++) -				tputs(dl, 0, __cputchar); -		__mvcur(bot + n + 1, 0, top, 0, 1); +				for (i = n; i < 0; i++) +					tputs(sr, 0, __cputchar); +			tputs(__tscroll(CS, 0, win->maxy), 0, __cputchar); +			__mvcur(top, 0, 0, 0, 1); +			tputs(HO, 0, __cputchar); +			__mvcur(0, 0, oy, ox, 1); +			return; +		} -		/* Scroll the block down */ -		if (AL)  -			tputs(__tscroll(AL, -n), 0, __cputchar); +		/* Preserve the bottom lines. */ +		__mvcur(oy, ox, bot + n + 1, 0, 1); +		if (SR != NULL && bot == win->maxy) +			tputs(__tscroll(SR, -n, 0), 0, __cputchar); +		else if (DL != NULL) +			tputs(__tscroll(DL, -n, 0), 0, __cputchar); +		else if (dl != NULL) +		       	for (i = n; i < 0; i++) +				tputs(dl, 0, __cputchar); +		else if (sr != NULL && bot == win->maxy) +		       	for (i = n; i < 0; i++) +				tputs(sr, 0, __cputchar);  		else -			for(i = n; i < 0; i++) +			abort(); + +		/* Scroll the block down. */ +		__mvcur(bot + n + 1, 0, top, 0, 1); +		if (AL != NULL) +			tputs(__tscroll(AL, -n, 0), 0, __cputchar); +		else if (al != NULL) +			for (i = n; i < 0; i++)  				tputs(al, 0, __cputchar); +		else +			abort();  		__mvcur(top, 0, oy, ox, 1);  	}		  } diff --git a/lib/libcurses/scanw.c b/lib/libcurses/scanw.c index ddd1ba9278d5..d8d79fd23551 100644 --- a/lib/libcurses/scanw.c +++ b/lib/libcurses/scanw.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,21 +32,21 @@   */  #ifndef lint -static char sccsid[] = "@(#)scanw.c	8.2 (Berkeley) 10/5/93"; +static char sccsid[] = "@(#)scanw.c	8.3 (Berkeley) 5/4/94";  #endif	/* not lint */  /*   * scanw and friends.   */ -#include <curses.h> -  #ifdef __STDC__  #include <stdarg.h>  #else  #include <varargs.h>  #endif +#include "curses.h" +  /*   * scanw --   *	Implement a scanf on the standard screen. diff --git a/lib/libcurses/scroll.c b/lib/libcurses/scroll.c index 1b03eccab9d1..8aad91c02854 100644 --- a/lib/libcurses/scroll.c +++ b/lib/libcurses/scroll.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)scroll.c	8.2 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)scroll.c	8.3 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h> +#include "curses.h"  /*   * scroll -- diff --git a/lib/libcurses/setterm.c b/lib/libcurses/setterm.c index f611ac726658..1d134903c112 100644 --- a/lib/libcurses/setterm.c +++ b/lib/libcurses/setterm.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,16 +32,18 @@   */  #ifndef lint -static char sccsid[] = "@(#)setterm.c	8.3 (Berkeley) 1/2/94"; +static char sccsid[] = "@(#)setterm.c	8.7 (Berkeley) 7/27/94";  #endif /* not lint */ -#include <sys/ioctl.h> +#include <sys/ioctl.h>		/* TIOCGWINSZ on old systems. */ -#include <curses.h>  #include <stdlib.h>  #include <string.h> +#include <termios.h>  #include <unistd.h> +#include "curses.h" +  static void zap __P((void));  static char	*sflags[] = { @@ -152,8 +154,11 @@ setterm(type)  	aoftspace = tspace;  	ttytype = longname(genbuf, __ttytype); -	if ((!AL && !al) || (!DL && !dl)) -		__noqch = 1; +	/* If no scrolling commands, no quick change. */ +	__noqch = +	    (CS == NULL || HO == NULL || +	    SF == NULL && sf == NULL || SR == NULL && sr == NULL) && +	    (AL == NULL && al == NULL || DL == NULL && dl == NULL);  	return (unknown ? ERR : OK);  } diff --git a/lib/libcurses/standout.c b/lib/libcurses/standout.c index 907184b82fee..754b423d52be 100644 --- a/lib/libcurses/standout.c +++ b/lib/libcurses/standout.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)standout.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)standout.c	8.2 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h> +#include "curses.h"  /*   * wstandout diff --git a/lib/libcurses/toucholap.c b/lib/libcurses/toucholap.c index 8924ebe24798..955c204147f9 100644 --- a/lib/libcurses/toucholap.c +++ b/lib/libcurses/toucholap.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)toucholap.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)toucholap.c	8.2 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h> +#include "curses.h"  /*   * touchoverlap -- diff --git a/lib/libcurses/touchwin.c b/lib/libcurses/touchwin.c index 68fa78588922..36f487e5b8f6 100644 --- a/lib/libcurses/touchwin.c +++ b/lib/libcurses/touchwin.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,11 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)touchwin.c	8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)touchwin.c	8.2 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h> - +#include "curses.h"  /*   * touchline -- diff --git a/lib/libcurses/tscroll.c b/lib/libcurses/tscroll.c index db7eda957569..359b3969c631 100644 --- a/lib/libcurses/tscroll.c +++ b/lib/libcurses/tscroll.c @@ -32,10 +32,10 @@   */  #ifndef lint -static char sccsid[] = "@(#)tscroll.c	8.2 (Berkeley) 4/15/94"; +static char sccsid[] = "@(#)tscroll.c	8.4 (Berkeley) 7/27/94";  #endif /* not lint */ -#include <curses.h> +#include "curses.h"  #define	MAXRETURNSIZE	64 @@ -61,17 +61,17 @@ static char sccsid[] = "@(#)tscroll.c	8.2 (Berkeley) 4/15/94";   * all other characters are ``self-inserting''.   */  char * -__tscroll(cap, n) +__tscroll(cap, n1, n2)  	const char *cap; -	int n; +	int n1, n2;  {  	static char result[MAXRETURNSIZE]; -	int c; +	int c, n;  	char *dp;  	if (cap == NULL)  		goto err; -	for (dp = result; (c = *cap++) != '\0';) { +	for (n = n1, dp = result; (c = *cap++) != '\0';) {  		if (c != '%') {  			*dp++ = c;  			continue; @@ -93,6 +93,7 @@ __tscroll(cap, n)  		case '2':  two:			*dp++ = n / 10 | '0';  one:			*dp++ = n % 10 | '0'; +			n = n2;  			continue;  		case '>':  			if (n > *cap++) diff --git a/lib/libcurses/tstp.c b/lib/libcurses/tstp.c index 3a817514e8e0..07debf42fe10 100644 --- a/lib/libcurses/tstp.c +++ b/lib/libcurses/tstp.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 1981, 1993 + * Copyright (c) 1981, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,15 +32,15 @@   */  #ifndef lint -static char sccsid[] = "@(#)tstp.c	8.2 (Berkeley) 1/2/94"; +static char sccsid[] = "@(#)tstp.c	8.3 (Berkeley) 5/4/94";  #endif /* not lint */ -#include <curses.h>  #include <errno.h>  #include <signal.h>  #include <termios.h>  #include <unistd.h> +#include "curses.h"  /*   * stop_signal_handler -- diff --git a/lib/libcurses/tty.c b/lib/libcurses/tty.c index e2693fb3090f..346b8502eca7 100644 --- a/lib/libcurses/tty.c +++ b/lib/libcurses/tty.c @@ -1,5 +1,5 @@  /*- - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 1993, 1994   *	The Regents of the University of California.  All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -32,15 +32,14 @@   */  #ifndef lint -static char sccsid[] = "@(#)tty.c	8.2 (Berkeley) 1/2/94"; +static char sccsid[] = "@(#)tty.c	8.4 (Berkeley) 5/18/94";  #endif /* not lint */ -#include <sys/ioctl.h> - -#include <curses.h>  #include <termios.h>  #include <unistd.h> +#include "curses.h" +  /*   * In general, curses should leave tty hardware settings alone (speed, parity,   * word size).  This is most easily done in BSD by using TCSASOFT on all @@ -126,7 +125,7 @@ raw()  	useraw = __pfast = __rawmode = 1;  	curt = &rawt;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -135,7 +134,7 @@ noraw()  	useraw = __pfast = __rawmode = 0;  	curt = &__baset;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -145,7 +144,7 @@ cbreak()  	__rawmode = 1;  	curt = useraw ? &rawt : &cbreakt;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -155,7 +154,7 @@ nocbreak()  	__rawmode = 0;  	curt = useraw ? &rawt : &__baset;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -167,7 +166,7 @@ echo()  	__echoit = 1;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -179,7 +178,7 @@ noecho()  	__echoit = 0;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -194,7 +193,7 @@ nl()  	__pfast = __rawmode;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  int @@ -209,7 +208,7 @@ nonl()  	__pfast = 1;  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK);  }  void @@ -241,7 +240,7 @@ endwin()  	(void)setvbuf(stdout, NULL, _IOLBF, 0);  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, &__orig_termios)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, &__orig_termios) ? ERR : OK);  }  /* @@ -253,12 +252,12 @@ static struct termios savedtty;  int  savetty()  { -	return (tcgetattr(STDIN_FILENO, &savedtty)); +	return (tcgetattr(STDIN_FILENO, &savedtty) ? ERR : OK);  }  int  resetty()  {  	return (tcsetattr(STDIN_FILENO, __tcaction ? -	    TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty)); +	    TCSASOFT | TCSADRAIN : TCSADRAIN, &savedtty) ? ERR : OK);  } | 
