This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problem with here documents in tcsh on cygwin v1.0 cdrom


Here is a bug report with a fix for tcsh from /contrib on the
Cygwin v1.0 CDROM.  I hope that this is the right place to
post this to get this to whoever maintains tcsh for cygwin.

Tcsh writes the contents of the here document into a temporary file.
When tcsh processes a second here document, it does not discard the contents
of the first here document.  Here is an example of the bug

"F:/ro/bin/bash.exe"-2.03$ /contrib/bin/tcsh
> cat <<END
? long long long
? END
long long long
> cat <<END
? short
? END
short
ong long


Here is the change I made to fix it:

diff -c tcsh-6.09.00/sh.dol.c tcsh-6.09.00.works/sh.dol.c
*** tcsh-6.09.00/sh.dol.c	Sun Oct 25 07:10:04 1998
--- tcsh-6.09.00.works/sh.dol.c	Sun Jan 30 10:20:50 2000
***************
*** 1009,1015 ****
  #ifndef O_TEMPORARY
  # define O_TEMPORARY 0
  #endif
!     if (open(tmp, O_RDWR|O_CREAT|O_TEMPORARY) < 0) {
  	int     oerrno = errno;
  
  	(void) unlink(tmp);
--- 1009,1015 ----
  #ifndef O_TEMPORARY
  # define O_TEMPORARY 0
  #endif
!     if (open(tmp, O_RDWR|O_TRUNC|O_CREAT|O_TEMPORARY) < 0) {
  	int     oerrno = errno;
  
  	(void) unlink(tmp);



In order to compile tcsh I had to make an addtional small change:

	take the source code to tcsh from the contrib sources
on the Cygwin v1.0 CDROM

	apply the patch tcsh-6.09.00.p0, from the contrib patches
		the last hunk will be rejected,
		and if you try make it will bomb out with :
			tc.os.h:534: conflicting types for `gethostname'
		but then apply the following patch and it will compile:

diff -c tcsh-6.09.00/tc.os.h tcsh-6.09.00.works/tc.os.h
*** tcsh-6.09.00/tc.os.h	Sun Jan 30 16:33:36 2000
--- tcsh-6.09.00.works/tc.os.h	Sun Jan 30 09:31:56 2000
***************
*** 529,539 ****
  # define free tcsh_free
  #endif /* NeXT */
  
! #if !defined(BSD4_4) && !defined(__linux__) && !defined(__hpux) && !defined(sgi)
  #ifndef NEEDgethostname
  extern int gethostname __P((char *, int));
  #endif /* NEEDgethostname */
! #endif /* !BDS4_4 && !__linux__ && !__hpux && !sgi */
  
  #if !defined(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88)
  extern time_t time();
--- 529,539 ----
  # define free tcsh_free
  #endif /* NeXT */
  
! #if !defined(BSD4_4) && !defined(__linux__) && !defined(__hpux) && !defined(sgi) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
  #ifndef NEEDgethostname
  extern int gethostname __P((char *, int));
  #endif /* NEEDgethostname */
! #endif /* !BDS4_4 && !__linux__ && !__hpux && !sgi && !__CYGWIN__ && !__CYGWIN32__ */
  
  #if !defined(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88)
  extern time_t time();


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]