Subject: Corrected patch to cygwin.dll + ncurses for termcaps
From: [email-masked] ("Mikey")

5 Mar 1997 03:49:09 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_NextPart_000_01BC2905.78E6D3E0"
Content-Transfer-Encoding: 7bit
Original-To: "Sheik" <[email-masked]>
Original-Cc: "cygnus" <[email-masked]>
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: [email-masked]

This is a multi-part message in MIME format.

------=_NextPart_000_01BC2905.78E6D3E0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Sorry, :^(.  I was playing around trying to get rcs to work, and I guess I
left the changes at the begining of the files in when I made the diffs. You
can either just delete the *.rej files, or I have included the corrected
diffs here.

----------
> From: Sheik <[email-masked]>
> To: Mikey <[email-masked]>
> Cc: cygnus <[email-masked]>
> Subject: Re: patch to cygwin.dll + ncurses for termcaps
> Date: Tuesday, March 04, 1997 9:47 PM
> 
> 
> 
> On Tue, 4 Mar 1997, Mikey wrote:
> 
> > Scott
> > 	I don't recall if I put it in my orig post or not, but all of my
> > filesystems are mounted -b, so the patches are LF only. When you use
> > patch.exe the filesystem, file, and patch-file should all be in sync,
(the
> > file, and patch-file must be).
> > 
>    ug, I don't want to sound dense, but I don't think the patch itself is

> right, at least to the current source... for instance in your patch 
> called termcaps.dif, here is the cut of the first few lines....
> 
> diff -urbBN ../winsup.orig/Makefile.in ./Makefile.in
> --- ../winsup.orig/Makefile.in  Tue Feb 25 13:02:27 1997
> +++ ./Makefile.in       Sat Feb 01 18:14:57 1997
> @@ -1,4 +1,4 @@
> -# Makefile.in for the winsup directory. #
> +# Makefile.in for the winsup directory.
>  # Copyright (c) 1995, 1996 Cygnus Solutions
> 
> so I look at the current Makefile.in in the newest source, and here is 
> the first few lines.....
> 
> # Makefile.in for the winsup directory.
> # Copyright (c) 1995, 1996 Cygnus Solutions
> 
> 
> Notice, the first line DOESN'T have the "#" char at the end of the line.,

> but your patch expects it to be there. The entire patch file you sent 
> have these probs, so I thought maybe you based the patches on an older 
> source tarball...
> 
> Thanks again,
> Scott Kilau
------=_NextPart_000_01BC2905.78E6D3E0
Content-Type: application/octet-stream; name="termcaps.dif"
Content-Transfer-Encoding: quoted-printable
Content-Description: termcaps.dif (DIF File)
Content-Disposition: attachment; filename="termcaps.dif"

diff -urbBN ../winsup.orig/Makefile.in ./Makefile.in=0A=
--- ../winsup.orig/Makefile.in	Tue Feb 25 13:02:27 1997=0A=
+++ ./Makefile.in	Sat Feb 01 18:14:57 1997=0A=
@@ -152,10 +152,12 @@=0A=
 readme.info:$(srcdir)/doc/readme.texinfo=0A=
 	$(MAKEINFO) -I$(srcdir)/doc  $<=0A=
 =0A=
-install: $(THEIRLIBS) $(LIBNAME) new-$(DLLNAME) real-headers=0A=
+install-theirlibs: $(THEIRLIBS) $(LIBNAME)=0A=
 	for i in $(THEIRLIBS) $(LIBNAME); do \=0A=
 		$(INSTALL_DATA) $$i $(tooldir)/lib/$$i ; \=0A=
 	done=0A=
+=0A=
+install-dll: new-$(DLLNAME)=0A=
 	for i in $(DLLNAME); do \=0A=
 	  $(INSTALL_DATA) new-$$i $(tooldir)/lib/$$i ; \=0A=
 	  binname=3D`t=3D'$(program_transform_name)'; echo "$$i" | sed -e $$t` =
; \=0A=
@@ -163,16 +165,21 @@=0A=
 	  rm -f $(bindir)/$$binname ; \=0A=
 	  ln $(tooldir)/lib/$$i $(bindir)/$$binname >/dev/null 2>&1 || =
$(INSTALL_DATA) new-$$i $(bindir)/$$binname ; \=0A=
 	done=0A=
+=0A=
+install-real-headers: real-headers=0A=
 	for sub in include include/arpa include/asm include/Windows32 \=0A=
 	   include/cygwin32 include/net include/netinet include/sys ; do \=0A=
 		for i in $(srcdir)/$$sub/*.h ; do \=0A=
 		  $(INSTALL_DATA) $$i $(tooldir)/$$sub/`basename $$i` ; \=0A=
 		done ; \=0A=
 	done=0A=
+=0A=
+install-utils:=0A=
 	rootme=3D`pwd` ; export rootme ; \=0A=
 	rootsrc=3D`(cd $(srcdir) ; pwd)` ; export rootsrc ; \=0A=
 	cd utils; $(MAKE) install $(FLAGS_TO_PASS)=0A=
 =0A=
+install: install-theirlibs install-dll install-real-headers =
install-utils=0A=
 	# this will only work if you've maked stmp_ms_include below.=0A=
 	#	if [ -e ms_include/windows.h ] ; then  \=0A=
 	#		for i in ms_include/*.h ; do \=0A=
diff -urbBN ../winsup.orig/fhandler.cc ./fhandler.cc=0A=
--- ../winsup.orig/fhandler.cc	Tue Feb 25 13:49:49 1997=0A=
+++ ./fhandler.cc	Fri Feb 28 11:20:19 1997=0A=
@@ -1832,6 +1832,47 @@=0A=
 }=0A=
 =0A=
 void=0A=
+fhandler_console::clear_to_bol ()=0A=
+{=0A=
+  CONSOLE_SCREEN_BUFFER_INFO info;=0A=
+  DWORD done;=0A=
+  GetConsoleScreenBufferInfo (get_output_handle (), &info);=0A=
+  COORD tlc =3D {0,info.dwCursorPosition.Y};=0A=
+  FillConsoleOutputCharacterA (get_output_handle (), ' ',=0A=
+			       info.dwCursorPosition.X,=0A=
+			       tlc,=0A=
+			       &done);=0A=
+  FillConsoleOutputAttribute (get_output_handle (), =0A=
+                               =
FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED,=0A=
+			       info.dwCursorPosition.X,=0A=
+			       tlc,=0A=
+                               &done);=0A=
+}=0A=
+=0A=
+void=0A=
+fhandler_console::output_chars (int x, int y, int num_chars, unsigned =
char fill_char)=0A=
+{=0A=
+  CONSOLE_SCREEN_BUFFER_INFO info;=0A=
+  COORD tlc =3D {x,y};=0A=
+  DWORD done;=0A=
+  GetConsoleScreenBufferInfo (get_output_handle (), &info);=0A=
+  FillConsoleOutputCharacterA (get_output_handle (), fill_char,=0A=
+			       num_chars, tlc, &done);=0A=
+  FillConsoleOutputAttribute (get_output_handle(), =0A=
+                               =
FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED,=0A=
+                               num_chars, tlc, &done);=0A=
+  x +=3D num_chars;=0A=
+fix_x:=0A=
+  if (x > info.dwSize.X)=0A=
+     {=0A=
+       x -=3D info.dwSize.X;=0A=
+       y +=3D 1;=0A=
+       goto fix_x;=0A=
+     }=0A=
+  cursor_set(x,y);=0A=
+}=0A=
+=0A=
+void=0A=
 fhandler_console::cursor_set (int x, int y)=0A=
 {=0A=
   CONSOLE_SCREEN_BUFFER_INFO info;=0A=
@@ -1875,9 +1916,91 @@=0A=
   *x =3D info.dwCursorPosition.X;=0A=
 }=0A=
 =0A=
+void=0A=
+fhandler_console::screen_size_get (int *x, int *y)=0A=
+{=0A=
+  CONSOLE_SCREEN_BUFFER_INFO info;=0A=
+  GetConsoleScreenBufferInfo (get_output_handle (), &info);=0A=
+	*y =3D 1 + info.srWindow.Bottom - info.srWindow.Top;=0A=
+	*x =3D 1 + info.srWindow.Right - info.srWindow.Left;=0A=
+}=0A=
+=0A=
+=0A=
+void=0A=
+fhandler_console::scroll_scr_buf (int x, int y, int Up_Dn)=0A=
+{=0A=
+CONSOLE_SCREEN_BUFFER_INFO info;=0A=
+SMALL_RECT Sr, Cr; CHAR_INFO Fill; COORD Dest;=0A=
+GetConsoleScreenBufferInfo(get_output_handle (), &info); /* Get the =
screen buffer info. */ =0A=
+Sr.Top =3D y;=0A=
+Sr.Bottom =3D info.dwSize.Y - 1; =0A=
+Sr.Left =3D 0; =0A=
+Sr.Right =3D info.dwSize.X - 1; =0A=
+Dest.X =3D 0; Dest.Y =3D y + Up_Dn; /* The destination for the scroll =
rectangle */ =0A=
+Cr =3D Sr; /* Clip the origion */=0A=
+Fill.Attributes =3D 7; /* Fill any empty rows with normal blanks. */ =
=0A=
+Fill.Char.AsciiChar =3D ' '; =0A=
+ScrollConsoleScreenBuffer(get_output_handle (), &Sr, &Cr, Dest, =
&Fill);=0A=
+cursor_set(x, y);=0A=
+}=0A=
+=0A=
+void=0A=
+fhandler_console::dch1 (int x, int y)=0A=
+{=0A=
+    SMALL_RECT Rr, Wr; =0A=
+    int sizeX, sizeY; screen_size_get (&sizeX, &sizeY);=0A=
+    CHAR_INFO Buf[sizeX];COORD BufSize, BufCoord; DWORD done;=0A=
+    Rr.Top =3D y;    /* Set the source rectangle. */ =0A=
+    Rr.Left =3D x + 1; /* from x+1 */ =0A=
+    Rr.Bottom =3D y; /* only one line */=0A=
+    Rr.Right =3D (sizeX - 1) ;=0A=
+    BufSize.Y =3D 1; BufSize.X =3D sizeX ; /* The temp buf size is 1 =
row x columns. */=0A=
+    BufCoord.X =3D 0; BufCoord.Y =3D 0; /* destination 0, 0 */=0A=
+    ReadConsoleOutput(get_output_handle (), Buf, BufSize, BufCoord, =
&Rr); =0A=
+    Wr.Top =3D y; // Set the destination rectangle. same row=0A=
+    Wr.Left =3D x; // overwrite char to be deleted=0A=
+    Wr.Bottom =3D y; =0A=
+    Wr.Right =3D (sizeX - 1) ; //clip the extra space=0A=
+    WriteConsoleOutput(get_output_handle (), Buf, BufSize, BufCoord, =
&Wr);=0A=
+    BufCoord.X =3D sizeX - 1; BufCoord.Y =3D y;=0A=
+    FillConsoleOutputCharacterA (get_output_handle (), ' ', 1, =
BufCoord, &done);=0A=
+    FillConsoleOutputAttribute (get_output_handle (), =
FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED,=0A=
+			       1, BufCoord, &done);=0A=
+}=0A=
+=0A=
+void=0A=
+fhandler_console::scroll_line_buf (int x, int y)=0A=
+{=0A=
+    SMALL_RECT Rr, Wr; =0A=
+    int sizeX, sizeY; screen_size_get (&sizeX, &sizeY);=0A=
+    CHAR_INFO Buf[sizeX];COORD BufSize, BufCoord; DWORD done;=0A=
+    Rr.Top =3D y;    /* Set the source rectangle. */ =0A=
+    Rr.Left =3D x; /* from x */ =0A=
+    Rr.Bottom =3D y; /* only one line */=0A=
+    Rr.Right =3D (sizeX - 2) ;=0A=
+    BufSize.Y =3D 1; BufSize.X =3D sizeX ; /* The temp buf size is 1 =
row x columns. */=0A=
+    BufCoord.X =3D 0; BufCoord.Y =3D 0; /* destination 0, 0 */=0A=
+    ReadConsoleOutput(get_output_handle (), Buf, BufSize, BufCoord, =
&Rr); =0A=
+    Wr.Top =3D y; // Set the destination rectangle. same row=0A=
+    Wr.Left =3D x + 1; // scroll Right=0A=
+    Wr.Bottom =3D y; =0A=
+    Wr.Right =3D (sizeX - 1) ; //clip the extra space=0A=
+    WriteConsoleOutput(get_output_handle (), Buf, BufSize, BufCoord, =
&Wr);=0A=
+    BufCoord.X =3D x; BufCoord.Y =3D y;=0A=
+    FillConsoleOutputCharacterA (get_output_handle (), ' ', 1, =
BufCoord, &done);=0A=
+    FillConsoleOutputAttribute (get_output_handle (), =
FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED,=0A=
+			       1, BufCoord, &done);=0A=
+}=0A=
+=0A=
+void=0A=
+fhandler_console::switchCP(int CP)=0A=
+{ /* FIXMEJD code to actually switch goes here */=0A=
+}=0A=
+=0A=
 #define BAK 1=0A=
 #define ESC 2=0A=
 #define NOR 0=0A=
+#define EOT 3=0A=
 #define IGN 4=0A=
 #define ERR 5=0A=
 #define DWN 6=0A=
@@ -1888,7 +2011,7 @@=0A=
 =0A=
 static const char base_chars[256] =3D=0A=
 {=0A=
-/*00 01 02 03 04 05 06 07 */ IGN, ERR, ERR, ERR, ERR, ERR, ERR, BEL, =
=0A=
+/*00 01 02 03 04 05 06 07 */ IGN, ERR, ERR, ERR, EOT, ERR, ERR, BEL, =
=0A=
 /*08 09 0A 0B 0C 0D 0E 0F */ BAK, TAB, DWN, ERR, ERR, CR,  ERR, IGN,=0A=
 /*10 11 12 13 14 15 16 17 */ ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, =
=0A=
 /*18 19 1A 1B 1C 1D 1E 1F */ ERR, ERR, ERR, ESC, ERR, ERR, ERR, ERR, =
=0A=
@@ -1927,14 +2050,13 @@=0A=
 fhandler_console::char_command (char c)=0A=
 {=0A=
   static int fg=3D7,bg=3D0,bold=3D0;=0A=
-  int x, y;=0A=
   static int savex, savey; /* for CSI s, CSI u */=0A=
-=0A=
+  int i, x, y;=0A=
+  DWORD done;=0A=
+  cursor_get(&x, &y);=0A=
   switch (c)=0A=
     {=0A=
     case 'm':   /* Set Graphics Rendition */=0A=
-       int i;=0A=
-=0A=
        for(i =3D 0; i <=3D nargs_; i++)=0A=
          switch(args_[i])=0A=
            {=0A=
@@ -1948,12 +2070,12 @@=0A=
                bg=3D0;=0A=
                bold=3DFOREGROUND_INTENSITY;=0A=
                break;=0A=
-             case 4:    /* underline - simulate with magenta */=0A=
+             case 4:    /* underline - simulate with magenta mono =
only*/=0A=
                fg=3DFOREGROUND_BLUE | FOREGROUND_RED;=0A=
-               bold=3DFOREGROUND_INTENSITY;=0A=
                bg=3D0;=0A=
+               bold=3DFOREGROUND_INTENSITY;=0A=
                break;=0A=
-             case 5:=0A=
+             case 5:	/* blink */=0A=
                fg=3DFOREGROUND_BLUE | FOREGROUND_GREEN | =
FOREGROUND_RED;=0A=
                bg=3D0;=0A=
                bold=3DFOREGROUND_INTENSITY | BACKGROUND_INTENSITY;=0A=
@@ -1963,6 +2085,16 @@=0A=
                bg=3DBACKGROUND_BLUE | BACKGROUND_GREEN | =
BACKGROUND_RED;=0A=
                bold=3D0;=0A=
                break;=0A=
+	     case 8:=0A=
+		fg=3D0;=0A=
+		if (bg & BACKGROUND_BLUE)=0A=
+			fg |=3D FOREGROUND_BLUE;=0A=
+		if (bg & BACKGROUND_GREEN)=0A=
+			fg |=3D FOREGROUND_GREEN;=0A=
+		if (bg & BACKGROUND_RED)=0A=
+			fg |=3D FOREGROUND_RED;=0A=
+		bold=3D0;=0A=
+		break;  /* FIXME */=0A=
              case 30:        /* BLACK foreground */=0A=
                fg =3D 0;=0A=
                break;=0A=
@@ -2025,8 +2157,24 @@=0A=
     case 'J':=0A=
       switch (args_[0])=0A=
 	{=0A=
-	case 2:=0A=
-	default:=0A=
+	case 0:	/* erase from cursor to end of display */=0A=
+      	      cursor_get(&savex, &savey);=0A=
+	      clear_to_eol ();=0A=
+	      screen_size_get(&x, &y);=0A=
+	      for (i=3Dsavey + 1;i < y;i++){=0A=
+		cursor_set(0, i);=0A=
+		clear_to_eol (); }=0A=
+      	      cursor_set(savex, savey);=0A=
+	      break;=0A=
+	case 1:/* erase from start to cursor */=0A=
+      	      cursor_get(&savex, &savey);=0A=
+	      clear_to_bol ();=0A=
+	      for (y =3D 0;y < savey;y++) {=0A=
+		cursor_set(0, y);=0A=
+		clear_to_eol (); }=0A=
+      	      cursor_set(savex, savey);=0A=
+	      break;=0A=
+	case 2: /* erase whole display */=0A=
 	  clear_screen ();=0A=
 	  cursor_set (0,0);=0A=
 	  break;=0A=
@@ -2045,26 +2193,132 @@=0A=
     case 'D':=0A=
       cursor_rel (-(args_[0] ? args_[0]:1),0);=0A=
       break;=0A=
+    case 'I':=0A=
+      cursor_get(&x, &y);=0A=
+      cursor_set(8*(x/8+1), y);=0A=
+      break;=0A=
     case 'K':=0A=
+      switch (args_[0])=0A=
+	{=0A=
+	case 2: /* erase whole line */=0A=
+	      clear_to_bol (); /* el1 */=0A=
+	case 0:	/* erase from cursor to end of line */=0A=
       clear_to_eol ();=0A=
       break;=0A=
+	case 1: /* erase from start of line to cursor */=0A=
+	      clear_to_bol ();=0A=
+	      break;=0A=
+	}=0A=
+      break;=0A=
+    case 'L': /* il1=3D insert line(s) in screen buffer */=0A=
+      for (i=3D0;i<(args_[0]? args_[0]: 1);i++)=0A=
+	{=0A=
+      	  cursor_get(&x, &y);=0A=
+          scroll_scr_buf (x, y, 1);=0A=
+	}=0A=
+      break;=0A=
+    case 'M': /* dl1=3D delete line(s) from screen buffer */=0A=
+      for (i=3D0;i<(args_[0]? args_[0]: 1);i++)=0A=
+	{=0A=
+          cursor_get(&x, &y);=0A=
+          scroll_scr_buf (x, y, -1);=0A=
+	}=0A=
+      break;	=0A=
     case 'H':=0A=
     case 'f':=0A=
       cursor_set((args_[1] ? args_[1]:1) -1, (args_[0] ? args_[0]:1) =
-1);=0A=
       break;=0A=
     case 'G':   /* hpa - position cursor at column n-1 */=0A=
       cursor_get(&x, &y);=0A=
-      cursor_set(x, (args_[0] ? args_[0]-1:0));=0A=
+      cursor_set((args_[0] ? args_[0]-1:0), y);=0A=
+      break;=0A=
+    case 'P':	/* delete char */=0A=
+      cursor_get(&x, &y);=0A=
+      for (i=3D0;i<(args_[0] ? args_[0] : 1);i++)=0A=
+	{=0A=
+      		dch1 (x, y);=0A=
+	}=0A=
+      cursor_set(x, y);=0A=
+      break;=0A=
+    case '@':	/* insert char */=0A=
+      cursor_get(&x, &y);=0A=
+      for (i=3D0;i<(args_[0] ? args_[0] : 1);i++)=0A=
+	{=0A=
+      		scroll_line_buf (x, y);=0A=
+	}=0A=
+      cursor_set(x, y);=0A=
+      break;=0A=
+    case 'S': /* ind/indn scroll forward #1 line(s) from ll */=0A=
+      for (i=3D0;i<(args_[0]? args_[0]: 1);i++)=0A=
+	{=0A=
+	    WriteFile (get_output_handle (), "\n", 1, &done, 0);=0A=
+	}=0A=
+	break;=0A=
+    case 'T': /* ri/rin scroll backward (#1) line(s) from ul */=0A=
+      for (i=3D0;i<(args_[0]? args_[0]: 1);i++)=0A=
+	{=0A=
+      	  cursor_get(&x, &y);=0A=
+          scroll_scr_buf (x, y, 1);=0A=
+	}=0A=
+      break;=0A=
+    case 'X': /* erase (blank out) #1 chars w/out moving cursor */=0A=
+      cursor_get(&x, &y);=0A=
+      output_chars(x, y, (args_[0] ? args_[0] : 1), ' ');=0A=
+      cursor_set (x,y); =0A=
+      break;=0A=
+    case 'Z':	/* back tab */=0A=
+      cursor_get(&x, &y);=0A=
+      cursor_set(((8*(x/8+1))-8), y);=0A=
+      break;=0A=
+    case 'b': /* rep output char #1 #2 times */=0A=
+      cursor_get(&x, &y);=0A=
+      output_chars(x, y, args_[1], args_[0]);=0A=
+      break;=0A=
+    case 'c': /* u9 terminal enquire string */=0A=
+      char term_rpt[5];=0A=
+      unsigned int ne1;=0A=
+      INPUT_RECORD input_rec1;=0A=
+      sprintf(term_rpt, "ansi"); /* return u8 terminal name */=0A=
+      input_rec1.EventType =3D KEY_EVENT;=0A=
+      i =3D 0;=0A=
+      while (term_rpt[i] !=3D 0)=0A=
+        {=0A=
+          input_rec1.Event.KeyEvent.AsciiChar =3D term_rpt[i];=0A=
+          WriteConsoleInput (get_input_handle (), &input_rec1, 1, =
&ne1);=0A=
+	  i++;=0A=
+        }=0A=
       break;=0A=
     case 'd':   /* vpa - position cursor at line n */=0A=
       cursor_get(&x, &y);=0A=
-      cursor_set((args_[0]? args_[0]: 1) - 1, y);=0A=
+      cursor_set(x, (args_[0] ? args_[0]-1:0));=0A=
+      break;=0A=
+    case 'g':   /* eat tab set/clear for regular ansi */=0A=
+      break;=0A=
+    case 'n': /* u7 cursor position request */=0A=
+      if (args_[0] !=3D 6){=0A=
+      small_printf("Bad position request %d, %d %d (%c)\n", args_[0], =
args_[1], c,c);=0A=
+      sleep (1);=0A=
+      break;}=0A=
+      cursor_get(&x, &y);=0A=
+      char pos_rpt[12];=0A=
+      unsigned int ne2;=0A=
+      INPUT_RECORD input_rec;=0A=
+      sprintf(pos_rpt, "\033[%d;%dR", y, x); /* return u6 cursor =
position report */=0A=
+      input_rec.EventType =3D KEY_EVENT;=0A=
+      i =3D 0;=0A=
+      while (pos_rpt[i] !=3D 0)=0A=
+        {=0A=
+          input_rec.Event.KeyEvent.AsciiChar =3D pos_rpt[i];=0A=
+          WriteConsoleInput (get_input_handle (), &input_rec, 1, =
&ne2);=0A=
+	  i++;=0A=
+        }=0A=
       break;=0A=
     case 's':   /* Save cursor position */=0A=
       cursor_get(&savex, &savey);=0A=
       break;=0A=
     case 'u':   /* Restore cursor position */=0A=
       cursor_set(savex, savey);=0A=
+      break;=0A=
     default:=0A=
       small_printf("Bad escape %d, %d %d (%c)\n", args_[0], args_[1], =
c,c);=0A=
       sleep (1);=0A=
@@ -2078,6 +2332,7 @@=0A=
 {=0A=
   /* Scan forward to see what a char which needs special treatment =
*/=0A=
   DWORD done;=0A=
+  int x, y;=0A=
   const unsigned char *found =3D src;=0A=
   while (found < end)=0A=
     {=0A=
@@ -2104,6 +2359,7 @@=0A=
 	  break;=0A=
 	case ESC:=0A=
 	  state_ =3D gotesc;=0A=
+	  /* debug_printf("\nESCAPE is %s\n", src); */=0A=
 	  break;=0A=
 	case DWN:=0A=
 	  if (get_w_binary ())=0A=
@@ -2111,6 +2367,11 @@=0A=
 	  else=0A=
 	    WriteFile (get_output_handle (), "\r\n", 2, &done, 0);=0A=
 	  break;=0A=
+	case EOT:=0A=
+	  cursor_get(&x, &y);=0A=
+          dch1 (x, y);=0A=
+          cursor_set(x, y);=0A=
+	  break;=0A=
 	case BAK:=0A=
 	  cursor_rel (-1, 0);=0A=
 	  break;=0A=
@@ -2126,7 +2387,9 @@=0A=
           cursor_set(8*(x/8+1), y);=0A=
           break;=0A=
 	case ERR:=0A=
-	  small_printf ("Got %d\n", *src);=0A=
+	  if (!is_tty())=0A=
+	    WriteFile (get_output_handle (), src, 1, &done, 0);=0A=
+/*	  small_printf ("Got %d\n", *src); */=0A=
 	  break;=0A=
 	}=0A=
       src ++;=0A=
@@ -2164,6 +2427,21 @@=0A=
 	  else=0A=
 	    {=0A=
 	      state_ =3D normal;=0A=
+	      int CP =3D 4;=0A=
+	      switch (*src)=0A=
+		{=0A=
+	          case '(': CP =3D 0; /* ASCII */=0A=
+			    break;=0A=
+		  case ')': CP =3D 1;=0A=
+			    break;=0A=
+		  case '*': CP =3D 2;=0A=
+			    break;=0A=
+		  case '+': CP =3D 3;=0A=
+			    break;=0A=
+		  default:=0A=
+			    break;=0A=
+		}=0A=
+	      if (CP !=3D 4) { src++; if (*src !=3D 'B') { src--; } else { =
switchCP(CP); } }=0A=
 	    }=0A=
 	  src++;=0A=
 	  break;=0A=
@@ -2194,6 +2472,43 @@=0A=
 	  state_ =3D normal;=0A=
 	  break;=0A=
 	case gotsquare:=0A=
+	      args_[0] =3D *src; /* first check for 'b' */=0A=
+	      nargs_++;=0A=
+	      *src++;=0A=
+	      if (*src !=3D ';')=0A=
+		{=0A=
+		  *src--;=0A=
+		  nargs_--;=0A=
+		  args_[0] =3D 0;=0A=
+		}=0A=
+	      else=0A=
+		{=0A=
+		  *src++;=0A=
+		  int i=3D0;=0A=
+	          while (isdigit(*src))=0A=
+	            {=0A=
+		      args_[1] =3D args_[1] * 10 + *src - '0';=0A=
+		      *src++;=0A=
+	              i++;=0A=
+		    }=0A=
+	          if (*src !=3D 'b')=0A=
+		    {=0A=
+		      nargs_--;=0A=
+	              args_[0] =3D 0;=0A=
+		      args_[1] =3D 0;=0A=
+		      while (i > 0)=0A=
+		        {=0A=
+			  i--;=0A=
+			  *src--;=0A=
+		        }=0A=
+		      *src--;=0A=
+		      *src--;=0A=
+		    }=0A=
+		  else=0A=
+		    {=0A=
+		      nargs_++;=0A=
+		    }=0A=
+		}=0A=
 	  if (*src =3D=3D ';') =0A=
 	    {=0A=
               state_ =3D gotarg1;=0A=
@@ -2247,12 +2562,15 @@=0A=
   debug_printf("FakeReadFile, res =3D %d, flags =3D %x\n", res, =
flags);=0A=
 =0A=
   /* if things are special, just do what we used to */=0A=
-  if ((!res) =0A=
-      || (flags & ENABLE_LINE_INPUT) =0A=
-      || (ov !=3D 0))=0A=
+   if ((!res) || (ov !=3D0))=0A=
         {=0A=
           return ReadFile (hndl, pv, lenin, done, ov);=0A=
         }=0A=
+   if (flags & ENABLE_LINE_INPUT) =0A=
+        { =0A=
+	   FlushConsoleInputBuffer(hndl);=0A=
+           return ReadFile (hndl, pv, lenin, done, ov); =0A=
+        }=0A=
 =0A=
   /* otherwise, do something that works */=0A=
   unsigned int num_events =3D 0, ne2, st;=0A=
@@ -2287,6 +2605,7 @@=0A=
           return 0;		/* seems to be failure */=0A=
         }=0A=
       /* doc says it will return at least one event... */=0A=
+      if (num_events)=0A=
       num_events--;=0A=
       /* check if we're just disposing of this one */=0A=
 =0A=
diff -urbBN ../winsup.orig/fhandler.h ./fhandler.h=0A=
--- ../winsup.orig/fhandler.h	Thu Feb 27 02:34:43 1997=0A=
+++ ./fhandler.h	Fri Feb 28 11:20:41 1997=0A=
@@ -235,8 +235,15 @@=0A=
   void clear_screen ();=0A=
   void cursor_set (int x, int y);=0A=
   void cursor_get (int *x, int *y);=0A=
-  void clear_to_eol ();=0A=
   void cursor_rel (int x, int y);=0A=
+  void clear_to_eol ();=0A=
+  void clear_to_bol ();=0A=
+  void output_chars (int x, int y, int num_chars, unsigned char =
fill_char);=0A=
+  void screen_size_get (int *x, int *y);=0A=
+  void dch1 (int x, int y);=0A=
+  void scroll_line_buf (int x, int y);=0A=
+  void scroll_scr_buf (int x, int y, int Up_Dn);=0A=
+  void switchCP (int CP);=0A=
   void get_info ();=0A=
   const unsigned char * write_normal (unsigned const char*, unsigned =
const char *);=0A=
   void char_command (char);=0A=
diff -urbBN ../winsup.orig/utils/termcap ./utils/termcap=0A=
--- ../winsup.orig/utils/termcap	Tue Feb 25 13:27:01 1997=0A=
+++ ./utils/termcap	Fri Feb 28 11:55:31 1997=0A=
@@ -1,4 +1,128 @@=0A=
-ansi:all we know about:\=0A=
-	:co#80:li#24:cl=3D50\E[;H\E[2J:bs:am:cm=3D\E[%i%d;%dH:\=0A=
-	:nd=3D\E[C:up=3D\E[A:ce=3D\E[K:ho=3D\E[H:pt:=0A=
+#ansi:all we know about:\=0A=
+#	:co#80:li#24:cl=3D50\E[;H\E[2J:bs:am:cm=3D\E[%i%d;%dH:\=0A=
+#	:nd=3D\E[C:up=3D\E[A:ce=3D\E[K:ho=3D\E[H:pt:=0A=
+#### Specials=0A=
+#=0A=
+# Special "terminals".  These are used to label tty lines when you =
don't=0A=
+# know what kind of terminal is on it.  The characteristics of an =
unknown=0A=
+# terminal are the lowest common denominator - they look about like a =
ti 700.=0A=
+# The last one, "other", is like unknown but it allows an escape from =
software=0A=
+# that insists that a "real" unknown terminal is merely so far =
unspecified.=0A=
+#=0A=
+=0A=
+dumb:\=0A=
+	:am:\=0A=
+	:co#80:\=0A=
+	:bl=3D^G:cr=3D^M:do=3D^J:sf=3D^J:=0A=
+unknown:\=0A=
+	:gn:\=0A=
+	:tc=3Ddumb:=0A=
+other|none of the above, but not exactly unknown:\=0A=
+	:am:gn:\=0A=
+	:co#80:\=0A=
+	:cl=3D^M^J:do=3D^J:ho=3D^M:=0A=
+=0A=
+arpanet|bussiplexer|dialup|ethernet|network|net|patch|plugboard|switch|n=
etwork switch or dialup:\=0A=
+	:tc=3Dunknown:=0A=
+lpr|printer|print|printing|line printer:\=0A=
+	:hc:os:\=0A=
+	:co#132:li#66:\=0A=
+	:bl=3D^G:cr=3D^M:do=3D^J:ff=3D^L:le=3D^H:sf=3D^J:=0A=
+=0A=
+#### ANSI terminals and terminal emulators=0A=
+#=0A=
+# See near the end of this file for details on ANSI conformance.=0A=
+# Don't mess with these entries!  Lots of other entries depend on =
them!=0A=
+#=0A=
+# This section lists entries in a least-capable to most-capable =
order.=0A=
+# if you're in doubt about what `ANSI' matches yours, try them in =
that=0A=
+# order and back off from the first that breaks.=0A=
+=0A=
+# (ansi: changed ":pt:" to ":it#8:" -- esr)=0A=
+ansi-mini|any ansi terminal with pessimistic assumptions:\=0A=
+	:am:bs:\=0A=
+	:co#80:it#8:li#24:\=0A=
+	:ce=3D\E[K:cl=3D\E[;H\E[2J:cm=3D\E[%i%d;%dH:do=3D\E[B:\=0A=
+	:ho=3D\E[H:le=3D\E[D:nd=3D\E[C:up=3D\E[A:=0A=
+=0A=
+# Color controls corresponding to the ANSI.SYS de-facto standard=0A=
+# (This is not a standalone entry)=0A=
+ansi-pc-color:\=0A=
+	:Co#8:NC#3:pa#64:\=0A=
+	:AB=3D\E[4%p1%dm:AF=3D\E[3%p1%dm:\=0A=
+	=
:..Sb=3D\E[4%?%p1%{1}%=3D%t4%e%p1%{3}%=3D%t6%e%p1%{4}%=3D%t1%e%p1%{6}%=3D=
%t3%e%p1%d%;m:\=0A=
+	=
:..Sf=3D\E[3%?%p1%{1}%=3D%t4%e%p1%{3}%=3D%t6%e%p1%{4}%=3D%t1%e%p1%{6}%=3D=
%t3%e%p1%d%;m:\=0A=
+	:op=3D\E[37;40m:=0A=
+=0A=
+# Procomm and some other ANSI emulations don't recognize all of the =
ANSI-=0A=
+# standard capabilities.  This entry deletes cuu, cuf, cud, cub, and =
vpa/hpa=0A=
+# capabilities, forcing curses to use repetitions of cuu1, cuf1, cud1 =
and cub1.=0A=
+# Also deleted ich and ich1, as QModem up to 5.03 doesn't recognize =
these.=0A=
+# Finally, we delete rep and ri, which seem to confuse many =
emulators.=0A=
+# On the other hand, we can count on these programs doing =
rmacs/smacs/sgr.=0A=
+# From: Eric S. Raymond <[email-masked]> July 25 1995=0A=
+pcansi-mono|ibm-pc terminal programs claiming to be ansi (mono =
mode):\=0A=
+	:am:bs:mi:ms:pt:\=0A=
+	:co#80:it#8:li#24:\=0A=
+	:ae=3D\E[10m:al=3D\E[L:as=3D\E[12m:bl=3D^G:bt=3D\E[Z:cd=3D\E[J:\=0A=
+	:ce=3D\E[K:cl=3D\E[H\E[J:cm=3D\E[%i%d;%dH:cr=3D^M:ct=3D\E[2g:\=0A=
+	:dc=3D\E[P:dl=3D\E[M:do=3D\E[B:ho=3D\E[H:kb=3D^H:kd=3D\E[B:\=0A=
+	:kh=3D\E[H:kl=3D\E[D:kr=3D\E[C:ku=3D\E[A:le=3D\E[D:mb=3D\E[5m:\=0A=
+	:md=3D\E[1m:me=3D\E[0m:mk=3D\E[9m:mr=3D\E[7m:nd=3D\E[C:\=0A=
+	=
:..sa=3D\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%=
p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m:\=0A=
+	=
:se=3D\E[m:sf=3D^J:so=3D\E[7m:st=3D\EH:ta=3D^I:ue=3D\E[m:up=3D\E[A:\=0A=
+	:us=3D\E[4m:=0A=
+pcansi-mono25|ansi25|ibm-pc terminal programs with 25 lines (mono =
mode):\=0A=
+	:li#25:\=0A=
+	:tc=3Dpcansi-mono:=0A=
+pcansi-mono33|ansi33|ibm-pc terminal programs with 33 lines (mono =
mode):\=0A=
+	:li#33:\=0A=
+	:tc=3Dpcansi-mono:=0A=
+pcansi-mono43|ansi43|ibm-pc terminal programs with 43 lines (mono =
mode):\=0A=
+	:li#43:\=0A=
+	:tc=3Dpcansi-mono:=0A=
+# The color versions.  All PC emulators do color...=0A=
+pcansi|ibm-pc terminal programs claiming to be ansi:\=0A=
+	:tc=3Dansi-pc-color:tc=3Dpcansi-mono:=0A=
+pcansi-25|ansi25|ibm-pc terminal programs with 25 lines:\=0A=
+	:li#25:\=0A=
+	:tc=3Dpcansi:=0A=
+pcansi-33|ansi33|ibm-pc terminal programs with 33 lines:\=0A=
+	:li#33:\=0A=
+	:tc=3Dpcansi:=0A=
+pcansi-43|ansi43|ibm-pc terminal programs with 43 lines:\=0A=
+	:li#43:\=0A=
+	:tc=3Dpcansi:=0A=
+=0A=
+# From: Eric S. Raymond <[email-masked]> Feb 3 1995=0A=
+# ansi-mono -- full X.364 with ANSI.SYS-compatible attributes, no =
color.=0A=
+# Function-key mappings aren't in X3.64 but these are pretty =
standard.=0A=
+# If you want pound signs rather than dollars, replace `B' with `A'=0A=
+# in the s?ds capabilities.=0A=
+ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible =
attributes:\=0A=
+	:5i:\=0A=
+	:AL=3D\E[%dL:DC=3D\E[%dP:DL=3D\E[%dM:DO=3D\E[%dB:F1=3D\E[W:\=0A=
+	:F2=3D\E[X:IC=3D\E[%d@:LE=3D\E[%dD:RI=3D\E[%dC:SF=3D\E[%dS:\=0A=
+	:SR=3D\E[%dT:UP=3D\E[%dA:cb=3D\E[1K:ch=3D\E[%dG:ct=3D\E[2g:\=0A=
+	=
:cv=3D\E[%dd:ec=3D\E[%dX:ei=3D:im=3D:k1=3D\E[M:k2=3D\E[N:k3=3D\E[O:\=0A=
+	:k4=3D\E[P:k5=3D\E[Q:k6=3D\E[R:k7=3D\E[S:k8=3D\E[T:k9=3D\E[U:\=0A=
+	:k;=3D\E[V:kB=3D\E[Z:kI=3D\E[L:kb=3D^H:kd=3D\E[B:kl=3D\E[D:\=0A=
+	:kr=3D\E[C:ku=3D\E[A:me=3D\E[0;10m:nw=3D\r\E[S:pf=3D\E[4i:\=0A=
+	:po=3D\E[5i:..rp=3D%p1%c\E[%p2%{1}%-%db:s0=3D\E(B:s1=3D\E)B:\=0A=
+	:s2=3D\E*B:s3=3D\E+B:\=0A=
+	=
:..sa=3D\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%=
p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m:\=0A=
+	:ta=3D\E[I:tc=3Dpcansi:=0A=
+=0A=
+# ansi -- this terminfo expresses the largest subset of X3.64 that will =
fit in=0A=
+# standard terminfo.  Assumes ANSI.SYS-compatible attributes and =
color=0A=
+# From: Eric S. Raymond <[email-masked]> Feb 12 1995=0A=
+ansi|ansi/pc-term compatible with color:\=0A=
+	:u6=3D\E[%d;%dR:u7=3D\E[6n:..u8=3D\E[?%[;0123456789]c:\=0A=
+	:u9=3D\E[c:tc=3Dansi-pc-color:tc=3Dansi-mono:=0A=
+=0A=
+w32ansi|ansi console window w/function keys under cygwin32:\=0A=
+	:li=3D#50:k1=3D\E1:k2=3D\E2:k3=3D\E3:k4=3D\E4:\=0A=
+	:k5=3D\E5:k6=3D\E6:k7=3D\E7:k8=3D\E8:k9=3D\E9:k;=3D\E0:kI=3D\E[2~:\=0A=
+	:kh=3D\E[1~:kD=3D\E[3~:@7=3D\E[4~:kP=3D\E[5~:kN=3D\E[6~:\=0A=
+	:K1=3D\E[1~:K3=3D\E[5~:K4=3D\E[4~:K5=3D\E[6~:st@:ct@:tc=3Dansi:=0A=
+=0A=

------=_NextPart_000_01BC2905.78E6D3E0
Content-Type: application/octet-stream; name="terminfo.dif"
Content-Transfer-Encoding: 7bit
Content-Description: terminfo.dif (DIF File)
Content-Disposition: attachment; filename="terminfo.dif"

--- terminfo.src	1997/01/31 18:03:24	1.1
+++ terminfo.src	1997/02/25 15:47:25
@@ -396,7 +395,12 @@
 ansi|ansi/pc-term compatible with color, 
 	u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, 
 	u9=\E[c, use=klone+color,use=klone+acs,use=klone+sgr,use=ansi-m,
-
+w32ansi|ansi console window using ncurses under cygwin32, 
+	lines#50, kf1=\E1, kf2=\E2, kf3=\E3, 
+	kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, kf10=\E0,
+	khome=\E[1~, kich1=\E[2~, kdch1=\E[3~, kend=\E[4~, kpp=\E[5~, 
+	knp=\E[6~, ka1=\E[1~, ka3=\E[5~, kc1=\E[4~, kc3=\E[6~, 
+	hts@, tbc@, use=ansi,
 #
 # ANSI.SYS entries
 #

------=_NextPart_000_01BC2905.78E6D3E0
Content-Type: application/octet-stream; name="bash_less.dif"
Content-Transfer-Encoding: quoted-printable
Content-Description: bash_less.dif (DIF File)
Content-Disposition: attachment; filename="bash_less.dif"

diff -urBb userorig/less/output.c user/less/output.c=0A=
--- userorig/less/output.c	Sat Jan 11 10:33:03 1997=0A=
+++ user/less/output.c	Tue Jan 07 23:26:51 1997=0A=
@@ -249,7 +249,7 @@=0A=
  * using a more portable argument list mechanism than printf's.=0A=
  */=0A=
 	static int=0A=
-iprintf(fmt, parg)=0A=
+myprintf(fmt, parg)=0A=
 	register char *fmt;=0A=
 	PARG *parg;=0A=
 {=0A=
@@ -329,7 +329,7 @@=0A=
 		col +=3D so_s_width;=0A=
 	}=0A=
 =0A=
-	col +=3D iprintf(fmt, parg);=0A=
+        col +=3D myprintf(fmt, parg);=0A=
 =0A=
 	if (!any_display)=0A=
 	{=0A=
@@ -370,7 +370,7 @@=0A=
 {=0A=
 	clear_bot();=0A=
 	so_enter();=0A=
-	(void) iprintf(fmt, parg);=0A=
+        (void) myprintf(fmt, parg);=0A=
 	putstr(intr_to_abort);=0A=
 	so_exit();=0A=
 	flush();=0A=
@@ -392,7 +392,7 @@=0A=
 	if (any_display)=0A=
 		clear_bot();=0A=
 =0A=
-	(void) iprintf(fmt, parg);=0A=
+        (void) myprintf(fmt, parg);=0A=
 	c =3D getchr();=0A=
 =0A=
 	if (!any_display)=0A=
diff -urbB user/bash.orig/cpp-Makefile user/bash/cpp-Makefile=0A=
--- user/bash.orig/cpp-Makefile	Tue Feb 25 18:52:47 1997=0A=
+++ user/bash/cpp-Makefile	Tue Feb 25 21:41:05 1997=0A=
@@ -300,7 +300,7 @@=0A=
 /**/# The GNU coding standards don't recognize the possibility that=0A=
 /**/# other information besides optimization and debugging might be=0A=
 /**/# passed to cc.  A different name should have been used.=0A=
-CFLAGS =3D -O -g=0A=
+CFLAGS =3D -include/usr/include/curses.h -include/usr/include/termcap.h =
-O=0A=
 =0A=
 SYSTEM_FLAGS =3D $(LINEBUF) $(VPRINTF) $(UNISTD) $(STDLIB) $(LIMITSH) =
\=0A=
        $(GROUPS) $(RESOURCE) $(PARAM) $(SIGHANDLER) $(SYSDEP) $(WAITH) =
\=0A=
@@ -549,7 +549,7 @@=0A=
 #  if defined (USE_TERMCAP_EMULATION)=0A=
 TERMCAP_LIBRARY =3D -lcurses=0A=
 #  else /* !USE_TERMCAP_EMULATION */=0A=
-TERMCAP_LIBRARY =3D -ltermcap=0A=
+TERMCAP_LIBRARY =3D -lncurses =0A=
 #  endif /* !USE_TERMCAP_EMULATION */=0A=
 #endif /* !USE_GNU_TERMCAP */=0A=
 =0A=
@@ -659,7 +659,7 @@=0A=
 #  if defined (USE_TERMCAP_EMULATION)=0A=
 TERMCAP_LIB =3D -lcurses=0A=
 #  else  /* !USE_TERMCAP_EMULATION */=0A=
-TERMCAP_LIB =3D -ltermcap=0A=
+TERMCAP_LIB =3D -lncurses =0A=
 #  endif /* !USE_TERMCAP_EMULATION */=0A=
 =0A=
 /**/# Directory list for -L so that the link editor (ld) can find =
-lreadline.=0A=

------=_NextPart_000_01BC2905.78E6D3E0--

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".