Subject: Many bugs fixed in b18 cdk
From: [email-masked] (Michael Van Biesbrouck)

6 Sep 1997 11:31:05 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
X-Mailer: ELM [version 2.4 PL25]
Original-Sender: [email-masked]

I am not on the mailing list and after this afternoon will not have
access to an NT (or Win95) machine.  However, I recently fixed some bugs
in the b18 distributions.

Here is an omnibus patch containing many fixes that I made while trying to
build a properly working gdb and kermit.  I was particularly disappointed
to find that the cdk that was released couldn't be compiled and installed
on NT without modifications.  The following patches will allow you to
build a cdk that does not work with b18 but is internally consistent.
(The only real problem is that cygwin.dll is different in the two
versions.)  After applying the patches you should be able to install a
copy by running

  INSTALL='/curpath/install-sh' ./configure --prefix=/whatever
  make
  make install

The file /tmp/todo will tell you to copy new-cygwin.dll somewhere when
you are done.

Bugs fixed include:

* gcc's Makefile believes that tar has failed
* install-sh doesn't copy cygwin.dll into a directory that we will later
  cd into
* Makefile.in contained `exec_prefix = @exec_prefix@ '
* DLLTOOL not defined for a couple packages
* TOP_DIR and SRC_DIR swapped in one Makefile
* Screen* functions didn't check their fd argument ... big problem since
  some versions of readline don't call it with any argument
* cygwin.dll would have fits when I tried
    shell->non-cygwin emacs->gdb->program
  because the pid-checking code dereferenced a NULL
* rearranged _raise code to check sig before using it as an index
* made _read call select so that signals could be sent to programs
  waiting for console input ... this is a suboptimal fix (same for
  _write)

I'm sure that these fixes could have been better.  However, they fix
problems that were real show-stoppers for me.  Also, someone should
check the re-entrancy of signals ... I had to put a special cygwin case
into kermit when a signal handler never returned (no new signals of that
type could be received).

diff -r -u -N cdk/gcc/Makefile.in old/cdk/gcc/Makefile.in
--- cdk/gcc/Makefile.in	Fri Aug 29 07:29:31 1997
+++ old/cdk/gcc/Makefile.in	Wed May  7 07:10:29 1997
@@ -2573,12 +2573,10 @@
 # Install the include directory using tar.
 install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
 	(cd include; \
-	 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) -; \
-	 exit 0 )
+	 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
 # /bin/sh on some systems returns the status of the first tar,
 # and that can lose with GNU tar which always writes a full block.
 # So use `exit 0' to ignore its exit status.
-# cywin32 screws up the other one....
 
 # Install the include directory using cpio.
 install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
diff -r -u -N cdk/gdb/config/i386/cygwin32.mh old/cdk/gdb/config/i386/cygwin32.mh
--- cdk/gdb/config/i386/cygwin32.mh	Wed Aug 27 23:55:03 1997
+++ old/cdk/gdb/config/i386/cygwin32.mh	Tue Apr 15 04:25:36 1997
@@ -6,6 +6,3 @@
 NAT_FILE=../nm-empty.h
 XM_CLIBS=
 MMALLOC_CFLAGS = -I$(MMALLOC_SRC) -DMMCHECK_FORCE=1
-
-X11_CFLAGS += -I/usr/X11R6.3/include
-X11_LDFLAGS += -L/usr/X11R6.3/lib
diff -r -u -N cdk/install-sh old/cdk/install-sh
--- cdk/install-sh	Wed Aug 27 20:00:56 1997
+++ old/cdk/install-sh	Fri Apr 25 20:16:11 1997
@@ -136,12 +136,6 @@
 		src="$src".exe
 	fi
 
-if echo "x$src" | grep cygwin.dll > /dev/null
-then
-	echo "Asked to copy $src to $dst" >> /tmp/todo
-	exit 0
-fi
-
 # end CYGNUS LOCAL noer
 
 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
diff -r -u -N cdk/libgloss/sparc/crt0.S old/cdk/libgloss/sparc/crt0.S
--- cdk/libgloss/sparc/crt0.S	Tue Apr 15 04:46:43 1997
+++ old/cdk/libgloss/sparc/crt0.S	Tue Apr 15 04:46:43 1997
@@ -1,47 +1,76 @@
-! Copyright (c) 1995 Cygnus Support
-!
-! The authors hereby grant permission to use, copy, modify, distribute,
-! and license this software and its documentation for any purpose, provided
-! that existing copyright notices are retained in all copies and that this
-! notice is included verbatim in any distributions. No written agreement,
-! license, or royalty fee is required for any of the authorized uses.
-! Modifications to this software may be copyrighted by their authors
-! and need not follow the licensing terms described here, provided that
-! the new terms are clearly indicated on the first page of each file where
-! they apply.
-!
-! C startup code for the Fujitsu SPARClite demo board
+/*
+ * C startup code for the Fujitsu SPARClite demo board
+ *
+ * Copyright (c) 1995, 1996 Cygnus Support
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+#include "asm.h"
+	
+.data
+        .align  8
+SYM(environ):			! this is the first address in the data section
+        .long   0
 
 	.text
 	.align 8
 
-win_ovf_trap:
+SYM(win_ovf_trap):
 	sethi %hi(win_ovf), %l3
 	jmpl %lo(win_ovf)+%l3, %g0
 	mov %wim, %l0
 	nop
 
-win_unf_trap:
+SYM(win_unf_trap):
 	sethi %hi(win_unf), %l3
 	jmpl %lo(win_unf)+%l3, %g0
 	mov %wim, %l0
 	nop
-
-no_fpu_trap:		! Come here when no fpu exists.  This just skips the
-	jmpl %l2, %g0	! offending instruction.
-	rett %l2+4
-
-	.globl start
-	.globl _start
-
-start:
-_start:
-
-! First, copy prom & trap vectors to sram
-
+	
+SYM(no_fpu_trap):			! Come here when no fpu exists.
+	jmpl %l2, %g0			! This just skips the
+        rett %l2+4			! offending instruction.
+
+	.globl SYM(start)
+SYM(start):
+	/* see if the stack is already setup. if not, then default
+         *  to using the value of %sp as set by the ROM monitor
+         */
+	sethi	%hi(__stack), %g1
+        or      %g1,%lo(__stack),%g1
+        cmp     %g0,%g1
+        be      1f
+	mov	%g1, %sp				! set the stack pointer
+        mov     %sp, %fp
+1:	
+
+	/* zero the bss section */
+        sethi %hi(__bss_start),%g2
+        or    %g2,%lo(__bss_start),%g2		! start of bss
+        sethi %hi(_end),%g3
+        or    %g3,%lo(_end),%g3			! end of bss
+        mov   %g0,%g1				! so std has two zeros
+zerobss:
+        std    %g0,[%g2]
+        add    %g2,8,%g2
+        cmp    %g2,%g3
+        bleu,a zerobss
+        nop
+	
+/*
+ * copy prom & trap vectors to sram.
+ */
 	set 0x30000000, %l0
 	set 0xfff8, %l1
-	tst %l1				! Set condition codes
+	tst %l1					! Set condition codes
 
 copyloop:
 	ldd [%l1], %l2
@@ -49,26 +78,28 @@
 	bg copyloop
 	deccc 8, %l1
 
-	set 0x30000000, %l0		! Base of new trap vector
-	mov %l0, %tbr			! Install the new tbr
+	set 0x30000000, %l0			! Base of new trap vector
+	mov %l0, %tbr				! Install the new tbr
 
-	set win_ovf_trap, %l1		! Setup window overflow trap
+	set SYM(win_ovf_trap), %l1		! Setup window overflow trap
 	ldd [%l1], %l2
 	std %l2, [%l0 + 5 * 16]
 	ldd [%l1 + 8], %l2
 	std %l2, [%l0 + 5 * 16 + 8]
 
-	set win_unf_trap, %l1		! Setup window underflow trap
+	set SYM(win_unf_trap), %l1		! Setup window underflow trap
 	ldd [%l1], %l2
 	std %l2, [%l0 + 6 * 16]
 	ldd [%l1 + 8], %l2
 	std %l2, [%l0 + 6 * 16 + 8]
 
-! Try enabling the FPU by setting EF.  If that causes a trap, then we probably
-! don't have an FPU.
+/*
+ * Try enabling the FPU by setting EF.  If that causes a trap, then we probably
+ * don't have an FPU.
+ */
 
-	ldd [%l0 + 2 * 16], %l4		! Save original trap routine
-	set no_fpu_trap, %l1		! Install new one
+	ldd [%l0 + 2 * 16], %l4			! Save original trap routine
+	set SYM(no_fpu_trap), %l1		! Install new one
 	ldd [%l1], %l2
 	std %l2, [%l0 + 2 * 16]
 
@@ -77,7 +108,65 @@
 	bset %l1, %l0
 !	mov %l0, %psr
 
-	std %l4, [2 * 16]		! Restore original trap routine
+	std %l4, [2 * 16]			! Restore original trap routine
 
-	call _main
+/*
+ * Move the data segment from it's ROM address to RAM where it
+ * belongs. 
+ */
+relocd:
+        set (_sdata),%g2				! %g2 = start of data in aout file
+        set (_environ),%g4			! %g4 = actual data base address
+        set (_edata),%g3				! %g3 = end of where data should go
+        subcc   %g3, %g4, %g5			! %g5 = length of data
+
+        subcc   %g4, %g2, %g0			! need to relocate data ?
+        ble     init
+        ld      [%g4], %g6
+        subcc   %g6, 1, %g0
+        be      init
+mvdata:
+        subcc   %g5, 8, %g5
+        ldd     [%g2 + %g5], %g6
+        bg      mvdata
+
+/*
+ * initialize target specific stuff. Only execute these
+ * functions it they exist.
+ */
+init:
+	sethi	%hi(SYM(hardware_init_hook)), %g1
+        or      %g1,%lo(SYM(hardware_init_hook)),%g1
+	cmp	%g0,%g1
+	be	1f
+	nop
+	call	SYM(hardware_init_hook)
 	nop
+
+1:	
+	sethi	%hi(SYM(software_init_hook)), %g1
+        or      %g1,%lo(SYM(software_init_hook)),%g1
+	cmp	%g0,%g1
+	be	2f
+	nop
+	call	SYM(software_init_hook)
+	nop
+2:	
+	call SYM(main)
+	nop
+
+	/* call exit from the C library so atexit gets called, and the
+	 * C++ destructors get run. This calls our exit routine below	 
+	 * when it's done.
+	 */
+	call	SYM(exit)
+	nop
+
+/*
+ * This should drop control back to the ROM monitor, if there is
+ * one.
+ */
+	.globl	SYM(_exit)
+SYM(_exit):
+	call	0
+	nop
\ No newline at end of file
diff -r -u -N cdk/libgloss/sparc/crt0.s old/cdk/libgloss/sparc/crt0.s
--- cdk/libgloss/sparc/crt0.s	Wed Dec 31 19:00:00 1969
+++ old/cdk/libgloss/sparc/crt0.s	Tue Apr 15 04:46:43 1997
@@ -0,0 +1,83 @@
+! Copyright (c) 1995 Cygnus Support
+!
+! The authors hereby grant permission to use, copy, modify, distribute,
+! and license this software and its documentation for any purpose, provided
+! that existing copyright notices are retained in all copies and that this
+! notice is included verbatim in any distributions. No written agreement,
+! license, or royalty fee is required for any of the authorized uses.
+! Modifications to this software may be copyrighted by their authors
+! and need not follow the licensing terms described here, provided that
+! the new terms are clearly indicated on the first page of each file where
+! they apply.
+!
+! C startup code for the Fujitsu SPARClite demo board
+
+	.text
+	.align 8
+
+win_ovf_trap:
+	sethi %hi(win_ovf), %l3
+	jmpl %lo(win_ovf)+%l3, %g0
+	mov %wim, %l0
+	nop
+
+win_unf_trap:
+	sethi %hi(win_unf), %l3
+	jmpl %lo(win_unf)+%l3, %g0
+	mov %wim, %l0
+	nop
+
+no_fpu_trap:		! Come here when no fpu exists.  This just skips the
+	jmpl %l2, %g0	! offending instruction.
+	rett %l2+4
+
+	.globl start
+	.globl _start
+
+start:
+_start:
+
+! First, copy prom & trap vectors to sram
+
+	set 0x30000000, %l0
+	set 0xfff8, %l1
+	tst %l1				! Set condition codes
+
+copyloop:
+	ldd [%l1], %l2
+	std %l2, [%l0 + %l1]
+	bg copyloop
+	deccc 8, %l1
+
+	set 0x30000000, %l0		! Base of new trap vector
+	mov %l0, %tbr			! Install the new tbr
+
+	set win_ovf_trap, %l1		! Setup window overflow trap
+	ldd [%l1], %l2
+	std %l2, [%l0 + 5 * 16]
+	ldd [%l1 + 8], %l2
+	std %l2, [%l0 + 5 * 16 + 8]
+
+	set win_unf_trap, %l1		! Setup window underflow trap
+	ldd [%l1], %l2
+	std %l2, [%l0 + 6 * 16]
+	ldd [%l1 + 8], %l2
+	std %l2, [%l0 + 6 * 16 + 8]
+
+! Try enabling the FPU by setting EF.  If that causes a trap, then we probably
+! don't have an FPU.
+
+	ldd [%l0 + 2 * 16], %l4		! Save original trap routine
+	set no_fpu_trap, %l1		! Install new one
+	ldd [%l1], %l2
+	std %l2, [%l0 + 2 * 16]
+
+	mov %psr, %l0
+	sethi %hi(0x1000), %l1
+	bset %l1, %l0
+!	mov %l0, %psr
+
+	std %l4, [2 * 16]		! Restore original trap routine
+
+	call _main
+	nop
diff -r -u -N cdk/tcl/win/Makefile.in old/cdk/tcl/win/Makefile.in
--- cdk/tcl/win/Makefile.in	Wed Aug 27 20:30:41 1997
+++ old/cdk/tcl/win/Makefile.in	Tue Apr 15 04:42:32 1997
@@ -22,7 +22,7 @@
 # to the "configure" script.
 
 prefix =        @prefix@
-exec_prefix =   @exec_prefix@
+exec_prefix =   @exec_prefix@ 
 
 # The following definition can be set to non-null for special systems
 # like AFS with replication.  It allows the pathnames used for installation
@@ -66,7 +66,7 @@
  
 # To change the compiler switches, for example to change from -O
 # to -g, change the following line:
-CFLAGS = @CFLAGS@ -I/usr/X11R6.3/include
+CFLAGS = @CFLAGS@ 
 
 # Mathematical functions like sin and atan2 are enabled for expressions
 # by default.  To disable them, reverse the comment characters on the
diff -r -u -N cdk/tcl/win/configure old/cdk/tcl/win/configure
--- cdk/tcl/win/configure	Wed Aug 27 20:47:49 1997
+++ old/cdk/tcl/win/configure	Tue Apr 15 04:42:32 1997
@@ -4829,7 +4829,6 @@
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
 s%@RANLIB@%$RANLIB%g
-s%@DLLTOOL@%$DLLTOOL%g
 s%@CC@%$CC%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
diff -r -u -N cdk/tk/win/Makefile.in old/cdk/tk/win/Makefile.in
--- cdk/tk/win/Makefile.in	Wed Aug 27 20:28:07 1997
+++ old/cdk/tk/win/Makefile.in	Tue Apr 15 04:43:33 1997
@@ -22,7 +22,7 @@
 # to the "configure" script.
 
 prefix =        @prefix@
-exec_prefix =   @exec_prefix@
+exec_prefix =   @exec_prefix@ 
 
 # The following definition can be set to non-null for special systems
 # like AFS with replication.  It allows the pathnames used for installation
@@ -306,7 +306,7 @@
 		else true; \
 		fi; \
 	    done;
-	@cd $(TOP_DIR)/doc; for i in *.1; \
+	@cd $(SRC_DIR)/doc; for i in *.1; \
 	    do \
 	    echo "Installing doc/$$i"; \
 	    rm -f $(MAN1_INSTALL_DIR)/$$i; \
@@ -315,7 +315,7 @@
 	    chmod 644 $(MAN1_INSTALL_DIR)/$$i; \
 	    done;
 	$(UNIX_DIR)/mkLinks $(MAN1_INSTALL_DIR)
-	@cd $(TOP_DIR)/doc; for i in *.3; \
+	@cd $(SRC_DIR)/doc; for i in *.3; \
 	    do \
 	    echo "Installing doc/$$i"; \
 	    rm -f $(MAN3_INSTALL_DIR)/$$i; \
@@ -323,7 +323,7 @@
 		    $$i > $(MAN3_INSTALL_DIR)/$$i; \
 	    chmod 644 $(MAN3_INSTALL_DIR)/$$i; \
 	    done;
-	@cd $(TOP_DIR)/doc; for i in *.n; \
+	@cd $(SRC_DIR)/doc; for i in *.n; \
 	    do \
 	    echo "Installing doc/$$i"; \
 	    rm -f $(MAN3_INSTALL_DIR)/$$i; \
diff -r -u -N cdk/tk/win/configure old/cdk/tk/win/configure
--- cdk/tk/win/configure	Fri Aug 29 01:13:13 1997
+++ old/cdk/tk/win/configure	Tue Apr 15 05:25:46 1997
@@ -2807,11 +2807,8 @@
 
 trap 'rm -fr `echo "Makefile tkConfig.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
-DLLTOOL=${DLLTOOL-dlltool}
 cat >> $CONFIG_STATUS <<EOF
 
-DLLTOOL=$DLLTOOL
-
 # Protect against being on the right side of a sed subst in config.status.
 sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
@@ -2857,7 +2854,6 @@
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@RANLIB@%$RANLIB%g
-s%@DLLTOOL@%$DLLTOOL%g
 s%@CPP@%$CPP%g
 s%@DL_LIBS@%$DL_LIBS%g
 s%@LD_FLAGS@%$LD_FLAGS%g
diff -r -u -N cdk/tk/win/install-sh old/cdk/tk/win/install-sh
--- cdk/tk/win/install-sh	Fri Aug 29 01:23:07 1997
+++ old/cdk/tk/win/install-sh	Wed Dec 31 19:00:00 1969
@@ -1,271 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "install:	no input file specified"
-	exit 1
-else
-	true
-fi
-
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-	
-	if [ -d $dst ]; then
-		instcmd=:
-	else
-		instcmd=mkdir
-	fi
-else
-
-# CYGNUS LOCAL noer
-# Win32-based gcc automatically appends .exe to produced executables,
-# whether asked for or not.  This breaks installs.  The following
-# changes the value of $src to $src.exe if $src is missing
-
-	if [ -f $src -a ! -f $src.exe ]
-	then 
-		true
-	else
-		echo "install:  $src does not exist, trying with .exe appended"
-		src="$src".exe
-	fi
-
-if echo "x$src" | grep cygwin.dll > /dev/null
-then
-	echo "Asked to copy $src to $dst" >> /tmp/todo
-	exit 0
-fi
-
-# end CYGNUS LOCAL noer
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f $src -o -d $src ]
-	then
-		true
-	else
-		echo "install:  $src does not exist"
-		exit 1
-	fi
-	
-	if [ x"$dst" = x ]
-	then
-		echo "install:	no destination specified"
-		exit 1
-	else
-		true
-	fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-	if [ -d $dst ]
-	then
-		dst="$dst"/`basename $src`
-	else
-		true
-	fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='	
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp="${pathcomp}${1}"
-	shift
-
-	if [ ! -d "${pathcomp}" ] ;
-        then
-		$mkdirprog "${pathcomp}"
-	else
-		true
-	fi
-
-	pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd $dst &&
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-	if [ x"$transformarg" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		dstfile=`basename $dst $transformbasename | 
-			sed $transformarg`$transformbasename
-	fi
-
-# don't allow the sed command to completely eliminate the filename
-
-	if [ x"$dstfile" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		true
-	fi
-
-# Make a temp file name in the proper directory.
-
-	dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-	$doit $instcmd $src $dsttmp &&
-
-	trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
-	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
-
-fi &&
-
-
-exit 0
diff -r -u -N cdk/winsup/console.cc old/cdk/winsup/console.cc
--- cdk/winsup/console.cc	Wed Aug 27 20:33:33 1997
+++ old/cdk/winsup/console.cc	Mon May  5 16:24:38 1997
@@ -33,12 +33,6 @@
 int
 ScreenRows (int fd)
 {
-  if (NOT_OPEN_FD (fd))
-    {
-      set_errno (EBADF);
-      return -1;
-    }
-
   CONSOLE_SCREEN_BUFFER_INFO p;
   fhandler_console *fhc = (fhandler_console *)u->self->hmap[fd].h;
   if (GetConsoleScreenBufferInfo (fhc->get_output_handle (), &p))
@@ -51,12 +45,6 @@
 int
 ScreenCols (int fd)
 {
-  if (NOT_OPEN_FD (fd))
-    {
-      set_errno (EBADF);
-      return -1;
-    }
-
   CONSOLE_SCREEN_BUFFER_INFO p;
   fhandler_console *fhc = (fhandler_console *)u->self->hmap[fd].h;
   if (GetConsoleScreenBufferInfo (fhc->get_output_handle (), &p))
@@ -69,13 +57,6 @@
 void
 ScreenGetCursor (int fd, int *row, int *col)
 {
-  if (NOT_OPEN_FD (fd))
-    {
-      set_errno (EBADF);
-      *row = *col = -1;
-      return;
-    }
-
   CONSOLE_SCREEN_BUFFER_INFO p;
   fhandler_console *fhc = (fhandler_console *)u->self->hmap[fd].h;
   if (GetConsoleScreenBufferInfo (fhc->get_output_handle (), &p))
@@ -93,12 +74,6 @@
 void
 ScreenSetCursor (int fd, int row, int col)
 {
-  if (NOT_OPEN_FD (fd))
-    {
-      set_errno (EBADF);
-      return;	/* The interface doesn't permit us to show an error */
-    }
-
   COORD p;
   p.X = col;
   p.Y = row;
@@ -1054,9 +1029,8 @@
     }
   if (flags & ENABLE_LINE_INPUT)
     {
-      //FlushConsoleInputBuffer (hndl);
-      res = ReadFile (hndl, pv, lenin, done, ov);
-      return res;
+      FlushConsoleInputBuffer (hndl);
+      return ReadFile (hndl, pv, lenin, done, ov);
     }
 
   /* otherwise, do something that works */
diff -r -u -N cdk/winsup/pinfo.cc old/cdk/winsup/pinfo.cc
--- cdk/winsup/pinfo.cc	Wed Aug 27 20:33:33 1997
+++ old/cdk/winsup/pinfo.cc	Thu Apr 24 19:45:39 1997
@@ -83,8 +83,7 @@
          entry and pretend we are starting afresh.
       */
       pid = atoi (buf);
-      pinfo *p = s->p[pid];
-      if(p && p->dwProcessId == dwProcessId)
+      if(s->p[pid]->dwProcessId == dwProcessId)
         execed = 1;
      }
 
diff -r -u -N cdk/winsup/signal.cc old/cdk/winsup/signal.cc
--- cdk/winsup/signal.cc	Wed Aug 27 20:38:00 1997
+++ old/cdk/winsup/signal.cc	Fri May  2 15:12:46 1997
@@ -111,6 +111,8 @@
 int
 _raise (int sig)
 {
+  _sig_func_ptr p = u->self->sigs[sig].sa_handler;
+
   /* check that sig is in right range */
   if (sig < 0 || sig >= NSIG)
     {
@@ -121,9 +123,6 @@
   if (sig == SIGSTOP || sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU
         || sig == SIGCONT)
     return 0;
-
-  _sig_func_ptr p = u->self->sigs[sig].sa_handler;
-
   if (p == SIG_DFL)
     exit ((sig<<8) | 0x10000);
   if (p == SIG_ERR)
diff -r -u -N cdk/winsup/syscalls.cc old/cdk/winsup/syscalls.cc
--- cdk/winsup/syscalls.cc	Wed Aug 27 20:33:33 1997
+++ old/cdk/winsup/syscalls.cc	Thu Apr 24 19:45:42 1997
@@ -264,21 +264,6 @@
     {
       /* Could block, so let user know we at least got here.  */
       syscall_printf ("read (%d, 0x%x, %d)\n", fd, ptr, len);
-      {
-	    int r;
-	    struct timeval tv;
-	    fd_set rfds;
-	    do {
-		FD_ZERO( &rfds );
-		FD_SET( fd, &rfds );
-		tv.tv_sec = 0;
-		tv.tv_usec = 500 * 1000;
-	    } while( !(r=cygwin32_select(fd+1,&rfds,NULL, NULL, &tv)) );
-	    
-	    if( r < 0 ){
-		return -1;
-	    }
-      }
       res = u->self->hmap[fd].h->read (ptr, len);
       syscall_printf ("%d = read (%d, 0x%x, %d)\n", res, fd, ptr, len);
     }
@@ -307,21 +292,7 @@
     {
       syscall_printf  ("write (%d, 0x%x, %d)\n", fd, ptr, len);
     }
-      {
-	    int r;
-	    struct timeval tv;
-	    fd_set wfds;
-	    do {
-		FD_ZERO( &wfds );
-		FD_SET( fd, &wfds );
-		tv.tv_sec = 0;
-		tv.tv_usec = 500 * 1000;
-	    } while( !(r=cygwin32_select(fd+1,NULL,&wfds, NULL, &tv)) );
-	    
-	    if( r < 0 ){
-		return -1;
-	    }
-      }
+
   res = u->self->hmap[fd].h->write (ptr, len);
 
 done:

-- 
# -- Michael Van Biesbrouck,      [email-masked]
:b^Js/\(.*\)\(,.*\):\1\(.\)\([a-z]*\)\(.\)r\(:.*\)>\3/\4\2:\1\3\4\5r\6\5>/
s/\(.*\)\(,.*\):\1\(.\)\([a-z]*\)\(.\)l\(:.*\)\(.\)>\3/\4\2:\1\3\4\5l\6>\7\5/
s/>$/>0/^J/^halt/!bb^J#           http://www.csclub.uwaterloo.ca/u/mlvanbie/
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".