diff --context --new-file --recursive ../../store/tcsh-6.03/Makefile ./Makefile
*** ../../store/tcsh-6.03/Makefile	Tue Nov 24 13:04:36 1992
--- ./Makefile	Wed Mar 10 05:54:44 1993
***************
*** 7,12 ****
--- 7,16 ----
  # With an input editor, command completion, etc. and ported to all sorts of
  # things; Paul Placeway, CIS Dept., Ohio State University
  #
+ 
+ CROSSDIR = /usr/users1/mat91/mh1/atari/cross-gcc
+ CROSSBIN = $(CROSSDIR)/bin
+ 
  SHELL=/bin/sh
  VERSION=6.03
  BUILD=tcsh
***************
*** 24,30 ****
  SUF=o
  CF=-c
  
! INCLUDES=-I. -I..
  
  LFLAGS=$(INCLUDES)
  #LFLAGS=$(INCLUDES) -Zn10000		# hpux lint
--- 28,35 ----
  SUF=o
  CF=-c
  
! #INCLUDES=-I. -I..
! INCLUDES=-I.
  
  LFLAGS=$(INCLUDES)
  #LFLAGS=$(INCLUDES) -Zn10000		# hpux lint
***************
*** 49,55 ****
  #CFLAGS=-O $(INCLUDES)
  
  # gcc-2.1
! CFLAGS=-O2 $(INCLUDES)
  
  # gcc 2.1 on linux
  #CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
--- 54,60 ----
  #CFLAGS=-O $(INCLUDES)
  
  # gcc-2.1
! #CFLAGS=-O2 $(INCLUDES)
  
  # gcc 2.1 on linux
  #CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
***************
*** 83,88 ****
--- 88,96 ----
  # Dnix 5.3
  #CFLAGS = -O -X7
  
+ # MiNT
+ CFLAGS = -O6 -fomit-frame-pointer -finline-functions -fstrength-reduce $(INCLUDES)
+ 
  # Apollo's with cc [apollo builtins don't work with gcc]
  # and apollo should not define __STDC__ if it does not have
  # the standard header files. RT's (aos4.3) need that too;
***************
*** 100,106 ****
  #DFLAGS=-D_VMS_POSIX
  # DEC/osf-1 on the alpha
  #DFLAGS=-D_BSD
! DFLAGS=
  
  
  ################################################################
--- 108,115 ----
  #DFLAGS=-D_VMS_POSIX
  # DEC/osf-1 on the alpha
  #DFLAGS=-D_BSD
! # MiNT has no crypt()
! DFLAGS=-DNO_CRYPT -DINBUFSIZE=BUFSIZE
  
  
  ################################################################
***************
*** 117,123 ****
  ################################################################
  ## LIBES.  Pick one, or roll your own.
  ################################################################
! LIBES= -ltermcap 		## BSD style things, hpux
  #LIBES= -ltermc			## emx under OS/2
  #LIBES= -ltermcap -lsec		## Tek XD88/10 (UTekV) with PW_SHADOW
  #LIBES= -ltermcap -lsec		## Motorola MPC (sysV88) with PW_SHADOW
--- 126,132 ----
  ################################################################
  ## LIBES.  Pick one, or roll your own.
  ################################################################
! #LIBES= -ltermcap 		## BSD style things, hpux
  #LIBES= -ltermc			## emx under OS/2
  #LIBES= -ltermcap -lsec		## Tek XD88/10 (UTekV) with PW_SHADOW
  #LIBES= -ltermcap -lsec		## Motorola MPC (sysV88) with PW_SHADOW
***************
*** 152,159 ****
  #LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
  #LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
  #LIBES= -ltermcap -lauth        ## for Ultrix with Enhanced Security
  
- 
  # The difficult choice of a c-compiler...
  # First, you should try your own c-compiler. 
  # Gcc -traditional is also a safe choice. 
--- 161,168 ----
  #LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
  #LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
  #LIBES= -ltermcap -lauth        ## for Ultrix with Enhanced Security
+ LIBES=	-lbtermcap		## when compiling with -mbaserel in MiNT
  
  # The difficult choice of a c-compiler...
  # First, you should try your own c-compiler. 
  # Gcc -traditional is also a safe choice. 
***************
*** 164,170 ****
  
  # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
  # on the suns does not know how to make dynamically linked binaries.
! CC=	gcc -Wall -B/bin/	
  #CC=	gcc -m486 -Wall # Generate code for Intel 486 (linux)
  #CC=	cc
  #CC=	occ
--- 173,179 ----
  
  # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
  # on the suns does not know how to make dynamically linked binaries.
! #CC=	gcc -Wall -B/bin/	
  #CC=	gcc -m486 -Wall # Generate code for Intel 486 (linux)
  #CC=	cc
  #CC=	occ
***************
*** 173,178 ****
--- 182,190 ----
  #CC=	/bin/cc	# For suns, w/o gcc and SVR4
  #CC=	/usr/lib/sun.compile/cc  # FPS 500 (+FPX) with Sun C compiler
  #CC=	scc 	# Alliant fx2800
+ #CC=	$(CROSSBIN)/cgcc -Wall
+ CC=	gcc -mbaserel -Wall # generate shareable code for MiNT
+ 
  ED=	ed
  AS=	as
  RM=	rm
diff --context --new-file --recursive ../../store/tcsh-6.03/config.h ./config.h
*** ../../store/tcsh-6.03/config.h
--- ./config.h	Tue Feb 23 21:51:32 1993
***************
*** 0 ****
--- 1,125 ----
+ /*
+  * config.h -- configure various defines for tcsh
+  *
+  * All source files should #include this FIRST.
+  *
+  * Edit this to match your system type.
+  */
+ 
+ /****************** System dependant compilation flags ****************/
+ /*
+  * POSIX	This system supports IEEE Std 1003.1-1988 (POSIX).
+  */
+ #undef POSIX
+ 
+ /*
+  * POSIXJOBS	This system supports the optional IEEE Std 1003.1-1988 (POSIX)
+  *		job control facilities.
+  */
+ #undef POSIXJOBS
+ 
+ /*
+  * POSIXSIGS	Use the POSIX signal facilities to emulate BSD signals.
+  */
+ #undef POSIXSIGS
+ 
+ /*
+  * VFORK	This machine has a vfork().  
+  *		It used to be that for job control to work, this define
+  *		was mandatory. This is not the case any more.
+  *		If you think you still need it, but you don't have vfork, 
+  *		define this anyway and then do #define vfork fork.  
+  *		I do this anyway on a Sun because of yellow pages brain damage,
+  *		[should not be needed under 4.1]
+  *		and on the iris4d cause	SGI's fork is sufficiently "virtual" 
+  *		that vfork isn't necessary.  (Besides, SGI's vfork is weird).
+  *		Note that some machines eg. rs6000 have a vfork, but not
+  *		with the berkeley semantics, so we cannot use it there either.
+  */
+ #define VFORK
+ 
+ /*
+  * BSDJOBS	You have BSD-style job control (both process groups and
+  *		a tty that deals correctly
+  */
+ #define BSDJOBS
+ 
+ /*
+  * BSDSIGS	You have 4.2-style signals, rather than USG style.
+  *		Note: POSIX systems should not define this unless they
+  *		have sigvec() and friends (ie: 4.3BSD-RENO, HP-UX).
+  */
+ #define BSDSIGS
+ 
+ /*
+  * BSDTIMES	You have BSD-style process time stuff (like rusage)
+  *		This may or may not be true.  For example, Apple Unix
+  *		(OREO) has BSDJOBS and BSDSIGS but not BSDTIMES.
+  */
+ #define BSDTIMES
+ 
+ /*
+  * BSDLIMIT	You have BSD-style resource limit stuff (getrlimit/setrlimit)
+  */
+ #define BSDLIMIT
+ 
+ /*
+  * BSDNICE	Your system uses setpriority() instead of nice, to
+  *		change a processes scheduling priority
+  */
+ #undef BSDNICE
+ 
+ /*
+  * TERMIO	You have struct termio instead of struct sgttyb.
+  * 		This is usually the case for SYSV systems, where
+  *		BSD uses sgttyb. POSIX systems should define this
+  *		anyway, even though they use struct termios.
+  */
+ #undef TERMIO
+ 
+ /*
+  * SYSVREL	Your machine is SYSV based (HPUX, A/UX)
+  *		NOTE: don't do this if you are on a Pyramid -- tcsh is
+  *		built in a BSD universe.
+  *		Set SYSVREL to 1, 2, 3, or 4, depending the version of System V
+  *		you are running. Or set it to 0 if you are not SYSV based
+  */
+ #define SYSVREL	0
+ 
+ /*
+  * YPBUGS	Work around Sun YP bugs that cause expansion of ~username
+  *		to send command output to /dev/null
+  */
+ #undef YPBUGS
+ 
+ /*
+  * SIGVOID	Define this if your signal handlers return void.  On older
+  *		systems, signal returns int, but on newer ones, it returns void.
+  */
+ #define SIGVOID 
+ 
+ /*
+  * HAVEDUP2	Define this if your system supports dup2().
+  */
+ #define HAVEDUP2
+ 
+ /*
+  * UTHOST	Does the utmp file have a host field?
+  */
+ #define UTHOST
+ 
+ /*
+  * DIRENT	Your system has <dirent.h> instead of <sys/dir.h>
+  */
+ #define DIRENT
+ /****************** local defines *********************/
+ 
+ #ifndef __MINT__
+ # define __MINT__
+ #endif
+ 
+ /****************** configurable hacks ****************/
+ /* have been moved to config_f.h */
+ #include "config_f.h"
+ 
+ #undef NLS
diff --context --new-file --recursive ../../store/tcsh-6.03/config_f.h ./config_f.h
*** ../../store/tcsh-6.03/config_f.h	Tue Nov 24 13:04:38 1992
--- ./config_f.h	Thu Mar 11 00:37:34 1993
***************
*** 56,62 ****
   *		if you don't have <locale.h>, you don't want
   *		to define this.
   */
! #define NLS
  
  /*
   * LOGINFIRST   Source ~/.login before ~/.cshrc
--- 56,62 ----
   *		if you don't have <locale.h>, you don't want
   *		to define this.
   */
! #undef NLS
  
  /*
   * LOGINFIRST   Source ~/.login before ~/.cshrc
***************
*** 90,96 ****
   *		on the name of the tty, and environment.
   *		Does not make sense in the modern window systems!
   */
! #define AUTOLOGOUT
  
  /*
   * SUSPENDED	Newer shells say 'Suspended' instead of 'Stopped'.
--- 90,96 ----
   *		on the name of the tty, and environment.
   *		Does not make sense in the modern window systems!
   */
! #undef AUTOLOGOUT
  
  /*
   * SUSPENDED	Newer shells say 'Suspended' instead of 'Stopped'.
***************
*** 116,121 ****
--- 116,144 ----
  # undef SYSMALLOC
  #endif
  
+ #if 1
+ # ifndef SYSMALLOC
+ #  define SYSMALLOC
+ # endif
+ #endif
+ 
+ /*
+  * HASHBANG   Emulate #! interpretation (if both library and kernel don't
+  *            support it)
+  */
+ #define HASHBANG
+ 
+ /*
+  * DOSFS      Support DOS filessystems (which have a 12345678.123 limit),
+  *            and allow backslashes as path separators
+  */
+ #define DOSFS
+ 
+ /*
+  * DOSTEXT    Support DOS text mode/files (ignore 0x0d)
+  */
+ #define DOSTEXT
+ 
  /*
   * RCSID	This defines if we want rcs strings in the binary or not
   *
diff --context --new-file --recursive ../../store/tcsh-6.03/ed.init.c ./ed.init.c
*** ../../store/tcsh-6.03/ed.init.c	Tue Nov 24 13:04:28 1992
--- ./ed.init.c	Thu Feb 25 04:30:40 1993
***************
*** 626,631 ****
--- 626,649 ----
  	char    buf[BUFSIZE];
  
  	chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
+ 
+ # ifdef DOSTEXT
+         /* strip out carriage returns */
+         if (chrs > 0) {
+                 char *src, *dst;
+                 int i;
+ 
+                 src = dst = buf;
+                 for (i = chrs; i > 0; --i) {
+                         if (*src == '\r')
+                                 --chrs;
+                         else
+                                 *dst++ = *src;
+                         src++;
+                 }
+         }
+ # endif
+ 
  	if (chrs > 0) {
  	    buf[chrs] = '\0';
  	    Input_Line = Strsave(str2short(buf));
diff --context --new-file --recursive ../../store/tcsh-6.03/ed.inputl.c ./ed.inputl.c
*** ../../store/tcsh-6.03/ed.inputl.c	Tue Nov 24 13:04:30 1992
--- ./ed.inputl.c	Thu Feb 25 04:33:52 1993
***************
*** 99,105 ****
      if (!Tty_raw_mode && MacroLvl < 0) {
  	long    chrs = 0;
  
! 	(void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
  	if (chrs == 0) {
  	    if (Rawmode() < 0)
  		return 0;
--- 99,111 ----
      if (!Tty_raw_mode && MacroLvl < 0) {
  	long    chrs = 0;
  
! # ifndef __MINT__
! /* MiNT _always_ wants to go into raw mode, so don't bother with the
!  * FIONREAD test
!  */
!         (void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
! # endif
! 
  	if (chrs == 0) {
  	    if (Rawmode() < 0)
  		return 0;
diff --context --new-file --recursive ../../store/tcsh-6.03/pathnames.h ./pathnames.h
*** ../../store/tcsh-6.03/pathnames.h	Tue Nov 24 13:04:38 1992
--- ./pathnames.h	Thu Feb 25 04:36:08 1993
***************
*** 69,74 ****
--- 69,80 ----
  # endif /* !_PATH_DOTCSHRC */
  #endif /* NeXT */
  
+ #ifdef DOSFS
+ # define _PATH_DOTLOGIN         "/etc/login.csh"
+ # define _PATH_DOTLOGOUT        "/etc/logout.csh"
+ # define _PATH_DOTCSHRC         "/etc/cshrc.csh"
+ #endif
+ 
  #if defined(sgi) || defined(OREO) || defined(cray) || defined(AMIX) || defined(CDC)
  # ifndef _PATH_DOTLOGIN
  #  define _PATH_DOTLOGIN	"/etc/cshrc"
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.c ./sh.c
*** ../../store/tcsh-6.03/sh.c	Tue Nov 24 13:04:16 1992
--- ./sh.c	Sun Mar  7 17:43:04 1993
***************
*** 118,123 ****
--- 118,128 ----
  static	void		  mailchk	__P((void));
  static	Char	 	**defaultpath	__P((void));
  
+ #ifdef __MINT__
+ static  Char            **defaultsuffixes __P((void));
+ void    importsuffixes  __P((Char *));
+ #endif
+ 
  int
  main(argc, argv)
      int     argc;
***************
*** 229,234 ****
--- 234,249 ----
  	loginsh = (argc == 1 && getppid() == 1);
  #endif /* _VMS_POSIX */
  
+ #ifdef __MINT__
+     /* under MiNT, we're also a login shell if we ran from the desktop and
+      * have no arguments
+      */
+     if (!loginsh && tempv[0][0] == 0 && !tempv[1]) {
+         loginsh = 1;
+         tempv[0] = "-tcsh";
+     }
+ #endif
+ 
      if (loginsh && **tempv != '-') {
  	/*
  	 * Mangle the argv space
***************
*** 373,379 ****
      if (loginsh || (uid == 0)) {
  	if (*cp) {
  	    /* only for login shells or root and we must have a tty */
! 	    if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) {
  		cp = cp2 + 1;
  	    }
  	    if (!((Strncmp(cp, STRtty, 3) == 0) &&
--- 388,394 ----
      if (loginsh || (uid == 0)) {
  	if (*cp) {
  	    /* only for login shells or root and we must have a tty */
! 	    if ((cp2 = Lastslash(cp)) != NULL) {
  		cp = cp2 + 1;
  	    }
  	    if (!((Strncmp(cp, STRtty, 3) == 0) &&
***************
*** 535,540 ****
--- 550,564 ----
  	 */
  	importpath(str2short(tcp));
  
+ #ifdef __MINT__
+     /*
+      * set the suffix search list
+      */
+     if ((tcp = getenv("SUFFIXES")) == NULL)
+         set1(STRsuffixes, defaultsuffixes(), &shvhed);
+     else
+         importsuffixes(SAVE(tcp));
+ #endif
  
      {
  	/* If the SHELL environment variable ends with "tcsh", set
***************
*** 769,774 ****
--- 793,808 ----
       */
      if (nofile == 0 && argc > 0) {
  	nofile = open(tempv[0], O_RDONLY);
+ #ifdef __MINT__
+         /* maybe the user tried to execute "foo.csh" as just "foo"
+          */
+         if (nofile < 0) {
+             char *cshfile = alloca(strlen(tempv[0]) + 5);
+             strcpy(cshfile, tempv[0]);
+             strcat(cshfile, ".csh");
+             nofile = open(cshfile, O_RDONLY);
+         }
+ #endif
  	if (nofile < 0) {
  	    child = 1;		/* So this ... */
  	    /* ... doesn't return */
***************
*** 1165,1171 ****
  srccat(cp, dp)
      Char   *cp, *dp;
  {
!     if (cp[0] == '/' && cp[1] == '\0') 
  	return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
      else {
  	register Char *ep = Strspl(cp, dp);
--- 1199,1205 ----
  srccat(cp, dp)
      Char   *cp, *dp;
  {
!     if (is_dirsep(cp[0]) && cp[1] == '\0') 
  	return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
      else {
  	register Char *ep = Strspl(cp, dp);
***************
*** 1952,1957 ****
--- 1986,1995 ----
  #endif
      int     i;
  {
+ #ifdef __MINT__
+     void rm_tmpfiles();
+     rm_tmpfiles();                      /* remove temporary files, see below */
+ #endif
  #ifdef TESLA
      if (loginsh && do_logout) {
  	/* this is to send hangup signal to the develcon */
***************
*** 2018,2020 ****
--- 2056,2196 ----
      *blkp = NULL;
      return (blk);
  }
+ 
+ #ifdef __MINT__
+ /*
+  * unlink() doesn't always work on an open file, so we try to arrange
+  * to remove temporary files (e.g. for here documents) before exiting.
+  */
+ 
+ struct tmpfile_rec {
+         char *name;     /* the name of the temp. file */
+         int pid;        /* the associated pid */
+         struct tmpfile_rec *next;
+ } *root;
+ 
+ extern int __mint;
+ 
+ int
+ csh_tmpfile()
+ {
+         extern char *tmpnam();
+         struct tmpfile_rec *u;
+         int fd;
+         char *name;
+ 
+         if ( !(name = tmpnam((char *)0)) )
+                 return -1;
+ 
+         fd = open(name, O_CREAT|O_EXCL|O_RDWR, 0600);
+         if (fd < 0) {
+                 free(name);
+                 return -1;
+         }
+ 
+ /* in MiNT 0.9 and above, we can often unlink a file and continue to use
+  * it; some file systems may return EACCDN for unlinking an open file,
+  * in which case we use the old method of unlinking the file at exit
+  */
+         if (__mint >= 9) {
+                 if (unlink(name) == 0)
+                         return fd;
+         }
+ 
+ /* if the unlink failed, save the name for future deleting */
+ 
+         u = (struct tmpfile_rec *)malloc(sizeof(*u));
+         if (!u) {
+ /* would it be better to fail? I dunno, but at worst the user is left
+  * with a junk file in a temporary directory
+  */
+                 return fd;
+         }
+ 
+         u->name = name;
+         u->pid = getpid();
+         u->next = root;
+         root = u;
+         return fd;
+ }
+ 
+ void
+ rm_tmpfiles()
+ {
+         int pid = getpid();
+         struct tmpfile_rec **old, *u;
+ 
+         old = &root;
+         u = root;
+         while (u) {
+                 if (u->pid == pid) {
+                         (void) unlink(u->name);
+                         *old = u->next;
+                 } else {
+                         old = &u->next;
+                 }
+                 u = u->next;
+         }
+ }
+ 
+ /* MiNT suffix stuff
+  */
+ 
+ void
+ importsuffixes(cp)
+     Char   *cp;
+ {
+     register int i = 0;
+     register Char *dp;
+     register Char **pv;
+     int     c;
+ 
+     for (dp = cp; *dp; dp++)
+         if (*dp == ',')
+             i++;
+     /*
+      * i+2 where i is the number of ',' in the suffix list. There are i+1
+      * suffixes plus we need room for a zero terminator.
+      */
+     pv = (Char **) xcalloc((size_t) (i + 2), sizeof(Char *));
+     dp = cp;
+     i = 0;
+     if (*dp)
+         for (;;) {
+             if ((c = *dp) == ',' || c == 0) {
+                 *dp = 0;
+                 pv[i++] = Strsave(cp);
+                 if (c) {
+                     cp = dp + 1;
+                     *dp = ',';
+                 }
+                 else
+                     break;
+             }
+             dp++;
+         }
+     pv[i] = 0;
+     set1(STRsuffixes, pv, &shvhed);
+ }
+ 
+ static Char **
+ defaultsuffixes()
+ {
+     Char  **blk, **blkp;
+ 
+     blkp = blk = (Char **) xmalloc((size_t) sizeof(Char *) * 9);
+ 
+     *blkp++ = SAVE("ttp");
+     *blkp++ = SAVE("prg");
+     *blkp++ = SAVE("tos");
+     *blkp++ = SAVE("app");
+     *blkp++ = SAVE("gtp");
+     *blkp++ = SAVE("csh");
+     *blkp++ = SAVE("");
+     *blkp = NULL;
+ 
+     return (blk);
+ }
+ 
+ #endif /* __MINT__ */
+ 
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.char.c ./sh.char.c
*** ../../store/tcsh-6.03/sh.char.c	Tue Nov 24 13:04:18 1992
--- ./sh.char.c	Thu Feb 25 04:57:24 1993
***************
*** 51,58 ****
  	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
  
  /*	 12 np		 13 cr		 14 so		 15 si	*/
! 	_CTR,		_CTR,		_CTR,		_CTR,
! 
  /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
  	_CTR,		_CTR,		_CTR,		_CTR,
  
--- 51,62 ----
  	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
  
  /*	 12 np		 13 cr		 14 so		 15 si	*/
! #ifndef DOSTEXT
!         _CTR,           _CTR,           _CTR,           _CTR,
! #else
! /* cr is whitespace */
!         _CTR,           _CTR|_SP|_META, _CTR,           _CTR,
! #endif
  /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
  	_CTR,		_CTR,		_CTR,		_CTR,
  
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.dir.c ./sh.dir.c
*** ../../store/tcsh-6.03/sh.dir.c	Tue Nov 24 13:04:18 1992
--- ./sh.dir.c	Sun Mar  7 18:46:50 1993
***************
*** 242,248 ****
  	len = Strlen(hp);
  	if (!(dflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
  	    Strncmp(hp, dp->di_name, len) == 0 &&
! 	    (dp->di_name[len] == '\0' || dp->di_name[len] == '/')) 
  	    len = Strlen(s = (dp->di_name + len)) + 2;
  	else
  	    len = Strlen(s = dp->di_name) + 1;
--- 242,248 ----
  	len = Strlen(hp);
  	if (!(dflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
  	    Strncmp(hp, dp->di_name, len) == 0 &&
! 	    (dp->di_name[len] == '\0' || is_dirsep(dp->di_name[len])))
  	    len = Strlen(s = (dp->di_name + len)) + 2;
  	else
  	    len = Strlen(s = dp->di_name) + 1;
***************
*** 301,308 ****
  {
  
  /* return true if dp is of the form "../xxx" or "/../xxx" */
! #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
! #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
  
  #ifdef S_IFLNK
      if (exp) {
--- 301,308 ----
  {
  
  /* return true if dp is of the form "../xxx" or "/../xxx" */
! #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || is_dirsep(*((p) - 1))))
! #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || is_dirsep(*((p) - 1))))
  
  #ifdef S_IFLNK
      if (exp) {
***************
*** 332,338 ****
  	 * If the path starts with a slash, we are not relative to
  	 * the current working directory.
  	 */
! 	if ( *start == '/' )
  	    *cwd = '\0';
  # ifdef apollo
  	slashslash = cwd[0] == '/' && cwd[1] == '/';
--- 332,338 ----
  	 * If the path starts with a slash, we are not relative to
  	 * the current working directory.
  	 */
! 	if ( is_abspath(start) )
  	    *cwd = '\0';
  # ifdef apollo
  	slashslash = cwd[0] == '/' && cwd[1] == '/';
***************
*** 363,369 ****
  
  	    *dp = '\0';
  	    while (dotdot > 0) 
! 	        if ((dp = Strrchr(cwd, '/')) != NULL) {
  # ifdef apollo
  		    if (dp == &cwd[1]) 
  		        slashslash = 1;
--- 363,369 ----
  
  	    *dp = '\0';
  	    while (dotdot > 0) 
! 	        if ((dp = Lastslash(cwd)) != NULL) {
  # ifdef apollo
  		    if (dp == &cwd[1]) 
  		        slashslash = 1;
***************
*** 391,403 ****
  # endif /* apollo */
  
  	    if (buf[0]) {
! 	        if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) != '/')
  		    cwd[dotdot++] = '/';
  	        cwd[dotdot] = '\0';
! 	        dp = Strspl(cwd, TRM(buf[0]) == '/' ? &buf[1] : buf);
  	        xfree((ptr_t) cwd);
  	        cwd = dp;
! 	        if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) == '/')
  		    cwd[--dotdot] = '\0';
  	    }
  	    if (!*cp)
--- 391,403 ----
  # endif /* apollo */
  
  	    if (buf[0]) {
! 	        if (! is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
  		    cwd[dotdot++] = '/';
  	        cwd[dotdot] = '\0';
! 	        dp = Strspl(cwd, is_dirsep(TRM(buf[0])) ? &buf[1] : buf);
  	        xfree((ptr_t) cwd);
  	        cwd = dp;
! 	        if (is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
  		    cwd[--dotdot] = '\0';
  	    }
  	    if (!*cp)
***************
*** 470,476 ****
  {
      Char   *dp;
  
!     if (*cp != '/') {
  	register Char *p, *q;
  	int     cwdlen;
  
--- 470,476 ----
  {
      Char   *dp;
  
!     if (! is_abspath(cp)) {
  	register Char *p, *q;
  	int     cwdlen;
  
***************
*** 547,553 ****
  	serrno = errno;
      }
  
!     if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
  	&& (c = adrof(STRcdpath))) {
  	Char  **cdp;
  	register Char *p;
--- 547,553 ----
  	serrno = errno;
      }
  
!     if (!is_abspath(cp) && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
  	&& (c = adrof(STRcdpath))) {
  	Char  **cdp;
  	register Char *p;
***************
*** 578,584 ****
  	}
      }
      dp = value(cp);
!     if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
  	xfree((ptr_t) cp);
  	cp = Strsave(dp);
  	printd = 1;
--- 578,584 ----
  	}
      }
      dp = value(cp);
!     if ((is_abspath(dp) || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
  	xfree((ptr_t) cp);
  	cp = Strsave(dp);
  	printd = 1;
***************
*** 801,811 ****
       * christos: if the path given does not start with a slash prepend cwd. If
       * cwd does not start with a slash or the result would be too long abort().
       */
!     if (*cp != '/') {
  	Char    tmpdir[MAXPATHLEN];
  
  	p1 = value(STRcwd);
! 	if (p1 == STRNULL || *p1 != '/')
  	    abort();
  	if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
  	    abort();
--- 801,811 ----
       * christos: if the path given does not start with a slash prepend cwd. If
       * cwd does not start with a slash or the result would be too long abort().
       */
!     if (! is_abspath(cp)) {
  	Char    tmpdir[MAXPATHLEN];
  
  	p1 = value(STRcwd);
! 	if (p1 == STRNULL || !is_abspath(p1))
  	    abort();
  	if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
  	    abort();
***************
*** 817,823 ****
      }
  
  #ifdef COMMENT
!     if (*cp != '/')
  	abort();
  #endif /* COMMENT */
  
--- 817,823 ----
      }
  
  #ifdef COMMENT
!     if (!is_abspath(cp))
  	abort();
  #endif /* COMMENT */
  
***************
*** 827,833 ****
  
      while (*p) {		/* for each component */
  	sp = p;			/* save slash address */
! 	while (*++p == '/')	/* flush extra slashes */
  	    continue;
  	if (p != ++sp)
  	    for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
--- 827,833 ----
  
      while (*p) {		/* for each component */
  	sp = p;			/* save slash address */
! 	while (is_dirsep(*++p))	/* flush extra slashes */
  	    continue;
  	if (p != ++sp)
  	    for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
***************
*** 835,841 ****
  	p = sp;			/* save start of component */
  	slash = 0;
  	while (*++p)		/* find next slash or end of path */
! 	    if (*p == '/') {
  		slash = 1;
  		*p = 0;
  		break;
--- 835,841 ----
  	p = sp;			/* save start of component */
  	slash = 0;
  	while (*++p)		/* find next slash or end of path */
! 	    if (is_dirsep(*p)) {
  		slash = 1;
  		*p = 0;
  		break;
***************
*** 885,896 ****
  		 */
  		for (p1 = p; *p1++;)
  		    continue;
! 		if (*link != '/') {
  		    /*
  		     * Relative path, expand it between the "yyy/" and the
  		     * "/..". First, back sp up to the character past "yyy/".
  		     */
! 		    while (*--sp != '/')
  			continue;
  		    sp++;
  		    *sp = 0;
--- 885,896 ----
  		 */
  		for (p1 = p; *p1++;)
  		    continue;
! 		if (! is_abspath(link)) {
  		    /*
  		     * Relative path, expand it between the "yyy/" and the
  		     * "/..". First, back sp up to the character past "yyy/".
  		     */
! 		    while (!is_dirsep(*--sp))
  			continue;
  		    sp++;
  		    *sp = 0;
***************
*** 942,948 ****
  #endif /* S_IFLNK */
  	    *sp = '/';
  	    if (sp != cp)
! 		while (*--sp != '/')
  		    continue;
  	    if (slash) {
  		for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
--- 942,948 ----
  #endif /* S_IFLNK */
  	    *sp = '/';
  	    if (sp != cp)
! 		while (!is_dirsep(*--sp))
  		    continue;
  	    if (slash) {
  		for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
***************
*** 979,991 ****
  		 */
  		for (p1 = p; *p1++;)
  		    continue;
! 		if (*link != '/') {
  		    /*
  		     * Relative path, expand it between the "yyy/" and the
  		     * remainder. First, back sp up to the character past
  		     * "yyy/".
  		     */
! 		    while (*--sp != '/')
  			continue;
  		    sp++;
  		    *sp = 0;
--- 979,991 ----
  		 */
  		for (p1 = p; *p1++;)
  		    continue;
! 		if (! is_abspath(link)) {
  		    /*
  		     * Relative path, expand it between the "yyy/" and the
  		     * remainder. First, back sp up to the character past
  		     * "yyy/".
  		     */
! 		    while (! is_dirsep(*--sp))
  			continue;
  		    sp++;
  		    *sp = 0;
***************
*** 1049,1056 ****
      /*
       * See if we're not in a subdir of STRhome
       */
!     if (p1 && *p1 == '/' &&
! 	(Strncmp(p1, cp, cc) != 0 || (cp[cc] != '/' && cp[cc] != '\0'))) {
  	static ino_t home_ino = (ino_t) -1;
  	static dev_t home_dev = -1;
  	static Char *home_ptr = NULL;
--- 1049,1056 ----
      /*
       * See if we're not in a subdir of STRhome
       */
!     if (p1 && is_abspath(p1) &&
! 	(Strncmp(p1, cp, cc) != 0 || (!is_dirsep(cp[cc]) && cp[cc] != '\0'))) {
  	static ino_t home_ino = (ino_t) -1;
  	static dev_t home_dev = -1;
  	static Char *home_ptr = NULL;
***************
*** 1075,1081 ****
  			sp = (Char *) - 1;
  			break;
  	    }
! 	    if ((sp = Strrchr(p2, '/')) != NULL)
  		*sp = '\0';
  	}
  	/*
--- 1075,1081 ----
  			sp = (Char *) - 1;
  			break;
  	    }
! 	    if ((sp = Lastslash(p2)) != NULL)
  		*sp = '\0';
  	}
  	/*
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.dol.c ./sh.dol.c
*** ../../store/tcsh-6.03/sh.dol.c	Tue Nov 24 13:04:18 1992
--- ./sh.dol.c	Thu Feb 25 05:37:04 1993
***************
*** 480,485 ****
--- 480,491 ----
  	if (length)
  	    stderror(ERR_NOTALLOWED, "$%<");
  	for (np = wbuf; read(OLDSTD, &tnp, 1) == 1; np++) {
+ #ifdef DOSTEXT
+             /* strip out cr's */
+             while (tnp == '\r') {
+                 if (read(OLDSTD, &tnp, 1) != 1) break;
+             }
+ #endif
  	    *np = (unsigned char) tnp;
  	    if (np >= &wbuf[BUFSIZE - 1])
  		stderror(ERR_LTOOLONG);
***************
*** 940,945 ****
--- 946,961 ----
      register Char *lbp, *obp, *mbp;
      Char  **vp;
      bool    quoted;
+ #ifdef __MINT__
+     int tf;
+     extern int csh_tmpfile __P((void));   /* in sh.c */
+ 
+     tf = csh_tmpfile();
+     if (tf < 0)
+         stderror(ERR_SYSTEM, "tmpfile", strerror(errno));
+     (void)dup2(tf, 0);
+     (void)close(tf);
+ #else
      char   *tmp;
  
      if (creat(tmp = short2str(shtemp), 0600) < 0)
***************
*** 953,958 ****
--- 969,976 ----
  	stderror(ERR_SYSTEM, tmp, strerror(errno));
      }
      (void) unlink(tmp);		/* 0 0 inode! */
+ #endif /* __MINT__ */
+ 
      Dv[0] = term;
      Dv[1] = NULL;
      gflag = 0;
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.exec.c ./sh.exec.c
*** ../../store/tcsh-6.03/sh.exec.c	Tue Nov 24 13:04:18 1992
--- ./sh.exec.c	Wed Mar 10 08:54:36 1993
***************
*** 49,54 ****
--- 49,60 ----
  # define FASTHASH	/* Fast hashing is the default */
  #endif /* OLDHASH */
  
+ #ifdef __MINT__
+ extern char **environ;
+ int     csh_execve      __P((char *, char **, char **));
+ #define execv(f, t) csh_execve(f, t, environ)
+ #endif
+ 
  /*
   * System level search and execute of a command.
   * We look in each directory for the specified command name.
***************
*** 180,190 ****
  #endif /* VFORK */
  
      v = adrof(STRpath);
!     if (v == 0 && expath[0] != '/') {
  	blkfree(pv);
  	pexerr();
      }
!     slash = any(short2str(expath), '/');
  
      /*
       * Glob the argument list, if necessary. Otherwise trim off the quote bits.
--- 186,196 ----
  #endif /* VFORK */
  
      v = adrof(STRpath);
!     if (v == 0 && !is_abspath(expath)) {
  	blkfree(pv);
  	pexerr();
      }
!     slash = has_slash(short2str(expath));
  
      /*
       * Glob the argument list, if necessary. Otherwise trim off the quote bits.
***************
*** 266,272 ****
  	 * one at a time, as the user enters them.  This is kinda like Korn
  	 * Shell's "tracked aliases".
  	 */
! 	if (!slash && pv[0][0] == '/' && havhash) {
  #ifdef FASTHASH
  	    if (!bit(hashval, i))
  		goto cont;
--- 272,278 ----
  	 * one at a time, as the user enters them.  This is kinda like Korn
  	 * Shell's "tracked aliases".
  	 */
! 	if (!slash && is_abspath(pv[0]) && havhash) {
  #ifdef FASTHASH
  	    if (!bit(hashval, i))
  		goto cont;
***************
*** 421,427 ****
--- 427,438 ----
  	 */
  	if ((fd = open(f, O_RDONLY)) != -1) {
  	    if (read(fd, (char *) pref, 2) == 2) {
+ #ifndef DOSTEXT
  		if (!Isprint(pref[0]) && (pref[0] != '\n' && pref[0] != '\t')) {
+ #else
+ 		if (!Isprint(pref[0]) && (pref[0] != '\n' && pref[0] != '\t'
+ 		                          && pref[0] != '\r')) {
+ #endif
  		    (void) close(fd);
  		    /*
  		     * We *know* what ENOEXEC means.
***************
*** 637,642 ****
--- 648,657 ----
      struct varent *v = adrof(STRpath);
      Char  **pv;
      int hashval;
+ #ifdef __MINT__
+     struct varent *suffv = adrof(STRsuffixes);
+     Char **suffpv;
+ #endif
  
  #ifdef FASTHASH
      if (vv && vv[1]) {
***************
*** 677,683 ****
      if (v == NULL)
  	return;
      for (pv = v->vec; *pv; pv++, i++) {
! 	if (pv[0][0] != '/')
  	    continue;
  	dirp = opendir(short2str(*pv));
  	if (dirp == NULL)
--- 692,698 ----
      if (v == NULL)
  	return;
      for (pv = v->vec; *pv; pv++, i++) {
! 	if (! is_abspath(pv[0]))
  	    continue;
  	dirp = opendir(short2str(*pv));
  	if (dirp == NULL)
***************
*** 696,701 ****
--- 711,729 ----
  		(dp->d_name[1] == '\0' ||
  		 (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
  		continue;
+ #ifdef __MINT__
+             {   char *s = rindex(dp->d_name, '.');
+ 
+                 if (s && suffv) {
+                     for (suffpv = suffv->vec; *suffpv; suffpv++) {
+                         if (!strcmp(s+1, short2str(*suffpv))) {
+                             *s = 0; break;
+                         }
+                     }
+                 }
+             }
+ #endif /* __MINT__ */
+ 
  #ifdef FASTHASH
  	    hashval = hashname(str2short(dp->d_name));
  	    bis(hashval, i);
***************
*** 769,775 ****
      register Char **pv;
      register Char *sav;
      register struct varent *v;
!     register bool slash = any(short2str(name), '/');
      register int hashval, i;
  
      v = adrof(STRpath);
--- 797,803 ----
      register Char **pv;
      register Char *sav;
      register struct varent *v;
!     register bool slash = has_slash(short2str(name));
      register int hashval, i;
  
      v = adrof(STRpath);
***************
*** 781,787 ****
      hashval = havhash ? hashname(name) : 0;
      i = 0;
      do {
! 	if (!slash && pv[0][0] == '/' && havhash) {
  #ifdef FASTHASH
  	    if (!bit(hashval, i))
  		goto cont;
--- 809,815 ----
      hashval = havhash ? hashname(name) : 0;
      i = 0;
      do {
! 	if (!slash && is_abspath(pv[0]) && havhash) {
  #ifdef FASTHASH
  	    if (!bit(hashval, i))
  		goto cont;
***************
*** 827,832 ****
--- 855,912 ----
   * if dir_ok is set and the pathname refers to a directory.
   * This is a bit kludgy, but in the name of optimization...
   */
+ #ifdef __MINT__
+ int
+ executable(dir, name, dir_ok)
+     Char   *dir, *name;
+     bool    dir_ok;
+ {
+     char *ext, *base;
+     struct stat stbuf;
+     Char    path[MAXPATHLEN + 1];
+     char   *strname;
+     struct varent *v;
+     Char **pv;
+ 
+     if (dir && *dir) {
+         copyn(path, dir, MAXPATHLEN);
+         catn(path, name, MAXPATHLEN);
+         strname = short2str(path);
+     }
+     else
+         strname = short2str(name);
+ 
+     ext = base = alloca(strlen(strname) + 5);
+     while (*strname)
+         *ext++ = *strname++;
+ 
+     *ext = 0;
+ 
+     if (stat(base, &stbuf) != -1 &&
+         ((dir_ok && S_ISDIR(stbuf.st_mode)) ||
+           (S_ISREG(stbuf.st_mode) &&
+           ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR))))))
+                 return 1;
+ 
+     if (dir_ok) return 0;
+ 
+     v = adrof(STRsuffixes);
+     if (v == 0) return 0;
+ 
+     *ext++ = '.';
+     for (pv = v->vec; *pv; pv++) {
+         strcpy(ext, short2str(*pv));
+         if (stat(base, &stbuf) != -1 &&
+             (S_ISREG(stbuf.st_mode) &&
+              ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR)) ||
+               !strcmp(ext, "csh"))))
+                return 1;
+     }
+     return 0;
+ }
+ 
+ #else /* __MINT__ */
+ 
  int
  executable(dir, name, dir_ok)
      Char   *dir, *name;
***************
*** 851,856 ****
--- 931,937 ----
  	      (stbuf.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)) &&
  	      access(strname, X_OK) == 0)));
  }
+ #endif /* __MINT__ */
  
  void
  tellmewhat(lex)
***************
*** 910,916 ****
      if ((i = iscommand(strip(sp->word))) != 0) {
  	register Char **pv;
  	register struct varent *v;
! 	bool    slash = any(short2str(sp->word), '/');
  
  	v = adrof(STRpath);
  	if (v == 0 || v->vec[0] == 0 || slash)
--- 991,997 ----
      if ((i = iscommand(strip(sp->word))) != 0) {
  	register Char **pv;
  	register struct varent *v;
! 	bool    slash = has_slash(short2str(sp->word));
  
  	v = adrof(STRpath);
  	if (v == 0 || v->vec[0] == 0 || slash)
***************
*** 975,981 ****
      Char *sv;
      int hashval, i, ex, rval = 0;
  
!     if (prt && any(short2str(cmd), '/')) {
  	xprintf("where: / in command makes no sense\n");
  	return 0;
      }
--- 1056,1062 ----
      Char *sv;
      int hashval, i, ex, rval = 0;
  
!     if (prt && has_slash(short2str(cmd))) {
  	xprintf("where: / in command makes no sense\n");
  	return 0;
      }
***************
*** 1042,1044 ****
--- 1123,1163 ----
      xfree((ptr_t) sv);
      return rval;
  }
+ 
+ #ifdef __MINT__
+ 
+ #include <process.h>
+ 
+ int
+ csh_execve(path, argv, envp)
+         char *path;
+         char **argv, **envp;
+ {
+         char *newpath, *s;
+         Char **pv;
+         struct varent *v;
+ 
+         newpath = s = alloca(strlen(path) + 5);
+         while (*path) {
+                 *s++ = *path++;
+         }
+         *s = 0;
+ 
+         if (access(newpath, 0) == 0)
+                 return _spawnve(P_OVERLAY, newpath, argv, envp);
+ 
+         v = adrof(STRsuffixes);
+         if (v == 0)
+                 return -1;
+         *s++ = '.';
+ 
+         for (pv = v->vec; *pv; pv++) {
+                 strcpy(s, short2str(*pv));
+                 if (access(newpath, 0) == 0) {
+                         return _spawnve(P_OVERLAY, newpath, argv, envp);
+                 }
+         }
+         return -1;
+ }
+ #endif /* __MINT__ */
+ 
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.file.c ./sh.file.c
*** ../../store/tcsh-6.03/sh.file.c	Tue Nov 24 13:04:18 1992
--- ./sh.file.c	Fri Feb 26 01:26:22 1993
***************
*** 407,413 ****
      if (old[0] != '~')
  	return (Strcpy(new, old));
  
!     for (p = person, o = &old[1]; *o && *o != '/'; *p++ = *o++);
      *p = '\0';
      if (person[0] == '\0')
  	(void) Strcpy(new, value(STRhome));
--- 407,413 ----
      if (old[0] != '~')
  	return (Strcpy(new, old));
  
!     for (p = person, o = &old[1]; *o && !is_dirsep(*o); *p++ = *o++);
      *p = '\0';
      if (person[0] == '\0')
  	(void) Strcpy(new, value(STRhome));
***************
*** 502,508 ****
  {
      register Char *p;
  
!     p = Strrchr(path, '/');
      if (p == NULL) {
  	copyn(name, path, MAXNAMLEN);
  	dir[0] = '\0';
--- 502,508 ----
  {
      register Char *p;
  
!     p = Lastslash(path);
      if (p == NULL) {
  	copyn(name, path, MAXNAMLEN);
  	dir[0] = '\0';
***************
*** 590,596 ****
      if (items != NULL)
  	FREE_ITEMS(items);
  
!     looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
      if (looking_for_lognames) {
  #ifndef _VMS_POSIX
  	(void) setpwent();
--- 590,596 ----
      if (items != NULL)
  	FREE_ITEMS(items);
  
!     looking_for_lognames = (*word == '~') && (Has_slash(word) == NULL);
      if (looking_for_lognames) {
  #ifndef _VMS_POSIX
  	(void) setpwent();
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.func.c ./sh.func.c
*** ../../store/tcsh-6.03/sh.func.c	Tue Nov 24 13:04:20 1992
--- ./sh.func.c	Fri Feb 26 01:32:22 1993
***************
*** 66,71 ****
--- 66,75 ----
  static	void	toend		__P((void));
  static	void	xecho		__P((int, Char **));
  
+ #ifdef __MINT__
+ extern  void    importsuffixes  __P((Char *));  /* in sh.c */
+ #endif
+ 
  struct biltins *
  isbfunc(t)
      struct command *t;
***************
*** 276,282 ****
--- 280,297 ----
      islogin();
      rechist(NULL);
      (void) signal(SIGTERM, parterm);
+ #ifdef __MINT__
+     {
+         extern int csh_execve __P((char *, char **, char **)); /* in sh.exec.c */
+         extern char **environ;
+         char *args[3];
+ 
+         args[0] = "login"; args[1] = short2str(v[1]); args[2] = NULL;
+         (void)csh_execve(_PATH_LOGIN, args, environ);
+     }
+ #else
      (void) execl(_PATH_LOGIN, "login", short2str(v[1]), NULL);
+ #endif
      untty();
      xexit(1);
  }
***************
*** 1190,1195 ****
--- 1205,1216 ----
  	importpath(lp);
  	dohash(NULL, NULL);
      }
+ #ifdef __MINT__
+     else if (eq(vp, STRSUFFIXES)) {
+         importsuffixes(lp);
+         dohash(NULL, NULL);
+     }
+ #endif /* __MINT__ */
  #ifdef apollo
      else if (eq(vp, STRSYSTYPE))
  	dohash(NULL, NULL);
***************
*** 1313,1318 ****
--- 1334,1343 ----
  
  		if (eq(name, STRNOREBIND))
  		    NoNLSRebind = 0;
+ #ifdef __MINT__
+                 else if (eq(name, STRSUFFIXES))
+                     dohash(NULL, NULL);
+ #endif
  #ifdef apollo
  		else if (eq(name, STRSYSTYPE))
  		    dohash(NULL, NULL);
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.glob.c ./sh.glob.c
*** ../../store/tcsh-6.03/sh.glob.c	Tue Nov 24 13:04:20 1992
--- ./sh.glob.c	Sun Mar  7 18:17:44 1993
***************
*** 97,103 ****
      *gstart++ = *s++;
      u = s;
      for (b = gstart, e = &gbuf[BUFSIZE - 1]; 
! 	 *s && *s != '/' && *s != ':' && b < e;
  	 *b++ = *s++)
  	continue;
      *b = EOS;
--- 97,103 ----
      *gstart++ = *s++;
      u = s;
      for (b = gstart, e = &gbuf[BUFSIZE - 1]; 
! 	 *s && !is_dirsep(*s) && *s != ':' && b < e;
  	 *b++ = *s++)
  	continue;
      *b = EOS;
***************
*** 135,141 ****
       * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
       * in stack. PWP: let =foobar pass through (for X windows)
       */
!     if (old[1] == '-' && (old[2] == '\0' || old[2] == '/')) {
  	/* =- */
  	dig = -1;
  	b = &old[2];
--- 135,141 ----
       * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
       * in stack. PWP: let =foobar pass through (for X windows)
       */
!     if (old[1] == '-' && (old[2] == '\0' || is_dirsep(old[2]))) {
  	/* =- */
  	dig = -1;
  	b = &old[2];
***************
*** 145,151 ****
  	dig = old[1] - '0';
  	for (b = &old[2]; Isdigit(*b); b++)
  	    dig = dig * 10 + (*b - '0');
! 	if (*b != '\0' && *b != '/')
  	    /* =<number>foobar */
  	    return old;
      }
--- 145,151 ----
  	dig = old[1] - '0';
  	for (b = &old[2]; Isdigit(*b); b++)
  	    dig = dig * 10 + (*b - '0');
! 	if (*b != '\0' && !is_dirsep(*b))
  	    /* =<number>foobar */
  	    return old;
      }
***************
*** 674,680 ****
  	    else if (isglob(*c))
  		gflag |= G_GLOB;
  	    else if (symlinks == SYM_EXPAND && 
! 		*p && ISDOTDOT(c) && (c == *(t-1) || *(c-1) == '/') )
  	    	gflag |= G_CSH;
  	}
      }
--- 674,680 ----
  	    else if (isglob(*c))
  		gflag |= G_GLOB;
  	    else if (symlinks == SYM_EXPAND && 
! 		*p && ISDOTDOT(c) && (c == *(t-1) || is_dirsep(*(c-1))) )
  	    	gflag |= G_CSH;
  	}
      }
***************
*** 834,839 ****
--- 834,855 ----
  		do
  		    icnt = read(pvec[0], tibuf, BUFSIZE);
  		while (icnt == -1 && errno == EINTR);
+ #ifdef DOSTEXT
+                 /* strip out carriage returns */
+                 {
+                         char *src, *dst;
+                         int i;
+                         src = dst = tibuf;
+ 
+                         for (i = icnt; i > 0; --i) {
+                                 if (*src == '\r')
+                                         --icnt;
+                                 else
+                                         *dst++ = *src;
+                                 src++;
+                         }
+                 }
+ #endif
  		if (icnt <= 0) {
  		    c = -1;
  		    break;
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.h ./sh.h
*** ../../store/tcsh-6.03/sh.h	Tue Nov 24 13:04:24 1992
--- ./sh.h	Fri Feb 26 01:46:40 1993
***************
*** 177,183 ****
  #ifdef _SEQUENT_
  # include <sys/procstats.h>
  #endif /* _SEQUENT_ */
! #if defined(POSIX) || SYSVREL > 0
  # include <sys/times.h>
  #endif /* POSIX || SYSVREL > 0 */
  
--- 177,183 ----
  #ifdef _SEQUENT_
  # include <sys/procstats.h>
  #endif /* _SEQUENT_ */
! #if defined(POSIX) || SYSVREL > 0 || defined(__MINT__)
  # include <sys/times.h>
  #endif /* POSIX || SYSVREL > 0 */
  
***************
*** 190,195 ****
--- 190,199 ----
  #endif /* _MINIX && vmsposix atp */
  #include <sys/stat.h>
  
+ #ifdef __MINT__
+ #include <support.h>
+ #endif
+ 
  #if defined(BSDTIMES) || defined(BSDLIMIT)
  # include <sys/time.h>
  # if SYSVREL>3 && !defined(sgi)
***************
*** 223,229 ****
  # include <sys/ttold.h>
  #endif /* sonyrisc */
  
! #ifdef POSIX
  /*
   * We should be using setpgid and setpgid
   * by now, but in some systems we use the
--- 227,233 ----
  # include <sys/ttold.h>
  #endif /* sonyrisc */
  
! #if defined(POSIX) || defined(__MINT__)
  /*
   * We should be using setpgid and setpgid
   * by now, but in some systems we use the
***************
*** 289,294 ****
--- 293,305 ----
  
  #include <errno.h>
  
+ #ifdef __MINT__
+ /* undef E_SEEK from errno.h */
+ # undef E_SEEK
+ # define ENOTDIR EPATH
+ # define ESPIPE EINVAL
+ #endif
+ 
  #include <setjmp.h>
  
  #if __STDC__
***************
*** 353,358 ****
--- 364,384 ----
  # endif 
  #endif 
  
+ #ifndef DOSFS
+ # define is_dirsep(c)   ((c) == '/')
+ # define is_abspath(p)  (is_dirsep(*(p)))
+ # define lastslash(p)   (strrchr((p), '/'))
+ # define Lastslash(p)   (Strrchr((p), '/'))
+ # define has_slash(p)   (any((p), '/'))
+ # define Has_slash(p)   (Strrchr((p), '/'))
+ #else
+ extern int      is_dirsep       __P((int));
+ extern int      is_abspath      __P((Char *));
+ extern char *   lastslash       __P((char *));
+ extern Char *   Lastslash       __P((Char *));
+ extern int      has_slash       __P((char *));
+ extern int      Has_slash       __P((Char *));
+ #endif
  
  typedef int bool;
  
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.lex.c ./sh.lex.c
*** ../../store/tcsh-6.03/sh.lex.c	Tue Nov 24 13:04:20 1992
--- ./sh.lex.c	Fri Feb 26 02:05:56 1993
***************
*** 430,436 ****
      for (;;) {
  	if ((c = peekc) != 0) {
  	    peekc = 0;
! 	    return (c);
  	}
  	if (lap) {
  	    if ((c = *lap++) == 0)
--- 430,436 ----
      for (;;) {
  	if ((c = peekc) != 0) {
  	    peekc = 0;
! 	    goto ret_c;
  	}
  	if (lap) {
  	    if ((c = *lap++) == 0)
***************
*** 438,453 ****
  	    else {
  		if (cmap(c, _META | _Q | _Q1))
  		    c |= QUOTE;
! 		return (c);
  	    }
  	}
  	if ((c = peekd) != 0) {
  	    peekd = 0;
! 	    return (c);
  	}
  	if (exclp) {
  	    if ((c = *exclp++) != 0)
! 		return (c);
  	    if (exclnxt && --exclc >= 0) {
  		exclnxt = exclnxt->next;
  		setexclp(exclnxt->word);
--- 438,453 ----
  	    else {
  		if (cmap(c, _META | _Q | _Q1))
  		    c |= QUOTE;
! 		goto ret_c;
  	    }
  	}
  	if ((c = peekd) != 0) {
  	    peekd = 0;
! 	    goto ret_c;
  	}
  	if (exclp) {
  	    if ((c = *exclp++) != 0)
! 		goto ret_c;
  	    if (exclnxt && --exclc >= 0) {
  		exclnxt = exclnxt->next;
  		setexclp(exclnxt->word);
***************
*** 475,481 ****
--- 475,486 ----
  	}
  	break;
      }
+ ret_c:
+ #ifdef DOSTEXT
+     return (c == '\r' ? getC1(flag) : c);
+ #else
      return (c);
+ #endif
  }
  
  static void
***************
*** 1125,1134 ****
  
      case 'h':
      case 't':
! 	if (!any(short2str(cp), '/'))
  	    return (type == 't' ? Strsave(cp) : 0);
  	wp = Strend(cp);
! 	while (*--wp != '/')
  	    continue;
  	if (type == 'h')
  	    xp = Strsave(cp), xp[wp - cp] = 0;
--- 1130,1139 ----
  
      case 'h':
      case 't':
! 	if (!has_slash(short2str(cp)))
  	    return (type == 't' ? Strsave(cp) : 0);
  	wp = Strend(cp);
! 	while (!is_dirsep(*--wp))
  	    continue;
  	if (type == 'h')
  	    xp = Strsave(cp), xp[wp - cp] = 0;
***************
*** 1139,1145 ****
      case 'e':
      case 'r':
  	wp = Strend(cp);
! 	for (wp--; wp >= cp && *wp != '/'; wp--)
  	    if (*wp == '.') {
  		if (type == 'e')
  		    xp = Strsave(wp + 1);
--- 1144,1150 ----
      case 'e':
      case 'r':
  	wp = Strend(cp);
! 	for (wp--; wp >= cp && !is_dirsep(*wp); wp--)
  	    if (*wp == '.') {
  		if (type == 'e')
  		    xp = Strsave(wp + 1);
***************
*** 1622,1628 ****
  	}
  	c = fbuf[0][fseekp - fbobp];
  	fseekp++;
! 	return (c);
      }
  again:
      buf = (int) fseekp / BUFSIZE;
--- 1627,1633 ----
  	}
  	c = fbuf[0][fseekp - fbobp];
  	fseekp++;
! 	goto ret_c;
      }
  again:
      buf = (int) fseekp / BUFSIZE;
***************
*** 1699,1705 ****
--- 1704,1716 ----
      }
      c = fbuf[buf][(int) fseekp % BUFSIZE];
      fseekp++;
+ 
+ ret_c:
+ #ifdef DOSTEXT
+     return (c == '\r' ? bgetc() : c);
+ #else
      return (c);
+ #endif
  }
  
  static void
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.misc.c ./sh.misc.c
*** ../../store/tcsh-6.03/sh.misc.c	Tue Nov 24 13:04:20 1992
--- ./sh.misc.c	Mon Mar  8 20:35:22 1993
***************
*** 38,43 ****
--- 38,47 ----
  
  RCSID("$Id: sh.misc.c,v 3.17 1992/10/18 00:43:08 christos Exp $")
  
+ #ifdef __MINT__
+ extern int __mint;      /* kernel version */
+ #endif
+ 
  static	int	renum	__P((int, int));
  static  Char  **blkend	__P((Char **));
  static  Char  **blkcat	__P((Char **, Char **));
***************
*** 270,275 ****
--- 274,285 ----
  {
      register int f;
  
+ #ifdef __MINT__
+ /* in TOS, all handles are shared by all processes! (ack!) */
+     if (__mint == 0)
+         return;
+ #endif
+ 
      if (didcch)
  	return;
      didcch = 1;
***************
*** 308,313 ****
--- 318,326 ----
      if (i == j || i < 0)
  	return (i);
  #ifdef HAVEDUP2
+ # ifdef __MINT__
+     if (__mint != 0)    /* TOS screws up dup2 */
+ # endif
      if (j >= 0) {
  	(void) dup2(i, j);
  	if (j != i)
***************
*** 328,333 ****
--- 341,351 ----
  
      if (i == j || i < 0 || (j < 0 && i > 2))
  	return (i);
+ #ifdef __MINT__
+     if (__mint == 0 && j > 5) {
+         return (i <= 5) ? dup(i) : j;
+     }
+ #endif
      if (j >= 0) {
  #ifdef HAVEDUP2
  	(void) dup2(i, j);
***************
*** 464,466 ****
--- 482,567 ----
  	    return (0);
      }
  }
+ 
+ #ifdef DOSFS
+ 
+ int
+ is_dirsep(i)
+         int i;
+ {
+         return i == '/' || i == '\\' ;
+ }
+ 
+ int
+ is_abspath(pth)
+         register Char *pth;
+ {
+         return is_dirsep(TRM(*pth)) || TRM(pth[1]) == ':';
+ }
+ 
+ char *
+ lastslash(pth)
+         register char *pth;
+ {
+         register char *slash = 0, *s = pth, c;
+ 
+         if (! s) return 0;
+ 
+         while ( (c = *s++) != 0) {
+                 if (is_dirsep(c))
+                         slash = s - 1;
+         }
+         if (slash)
+                 return slash;
+         return (pth[1] == ':') ? pth : 0;
+ }
+ 
+ Char *
+ Lastslash(pth)
+         register Char *pth;
+ {
+         register Char *slash = 0, *s = pth, c;
+ 
+         if (! s) return 0;
+ 
+         while ( (c = *s++) != 0) {
+                 if (is_dirsep(c))
+                         slash = s - 1;
+         }
+         if (slash)
+                 return slash;
+         return (pth[1] == ':') ? pth : 0;
+ }
+ 
+ int
+ has_slash(pth)
+         register char *pth;
+ {
+         register char c;
+ 
+         if (! pth) return 0;
+ 
+         while ( (c = *pth++) != 0)
+                 if (is_dirsep(c))
+                         return 1;
+ 
+         return 0;
+ }
+ 
+ int
+ Has_slash(pth)
+         register Char *pth;
+ {
+         register Char c;
+ 
+         if (! pth) return 0;
+ 
+         while ( (c = *pth++) != 0)
+                 if (is_dirsep(c))
+                         return 1;
+ 
+         return 0;
+ }
+ 
+ #endif /* DOSFS */
+ 
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.proc.c ./sh.proc.c
*** ../../store/tcsh-6.03/sh.proc.c	Tue Nov 24 13:04:22 1992
--- ./sh.proc.c	Fri Feb 26 02:23:04 1993
***************
*** 83,94 ****
  			    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
  
  # else /* !SUNOS4 && !hp9000 */
! #  ifdef masscomp
  /*
   * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
   * because the first two elements are unions of a time_t and a struct timeval.
   * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
   */
  static struct rusage zru;
  #  else	/* masscomp */
  static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0, 
--- 83,97 ----
  			    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
  
  # else /* !SUNOS4 && !hp9000 */
! #  if defined(masscomp) || defined(__MINT__)
  /*
   * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
   * because the first two elements are unions of a time_t and a struct timeval.
   * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
   */
+ /* MiNT is missing a lot of fields, so we also trust the loader (we can
+  * trust it) to avoid getting errors from the compiler
+  */
  static struct rusage zru;
  #  else	/* masscomp */
  static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0, 
***************
*** 119,124 ****
--- 122,145 ----
  static	struct process	*pgetcurr	__P((struct process *));
  static	void		 okpcntl	__P((void));
  
+ #ifdef __MINT__
+ /*
+  * MiNT's fork() is a lot like vfork() in some respects; in particular,
+  * if we set job control signals to SIG_DFL after fork() and then
+  * get a signal, our parent will never be able to reclaim the address
+  * space and everything will hang :-(. Solution: rather than SIG_DFL,
+  * set the signals to a null signal handler; if we exec(), they will
+  * be set to SIG_DFL automatically, and before then the signals will
+  * effectively be ignored.
+  */
+ 
+ void
+ sig_tmp_ign(int sig)
+ {
+ /* do nothing, and rely on the magic of restartable system calls :-) */
+ }
+ #endif
+ 
  /*
   * pchild - called at interrupt level by the SIGCHLD signal
   *	indicating that at least one child has terminated or stopped
***************
*** 1856,1865 ****
--- 1877,1893 ----
  	    (void) signal(SIGQUIT, ignint ? SIG_IGN : SIG_DFL);
  #ifdef BSDJOBS
  	    if (wanttty >= 0) {
+ # ifdef __MINT__
+ /* see comments for sig_tmp_ign above */
+                 (void) signal(SIGTSTP, sig_tmp_ign);
+                 (void) signal(SIGTTIN, sig_tmp_ign);
+                 (void) signal(SIGTTOU, sig_tmp_ign);
+ # else
  		/* make stoppable */
  		(void) signal(SIGTSTP, SIG_DFL);
  		(void) signal(SIGTTIN, SIG_DFL);
  		(void) signal(SIGTTOU, SIG_DFL);
+ # endif
  	    }
  #endif /* BSDJOBS */
  	    (void) signal(SIGTERM, parterm);
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.sem.c ./sh.sem.c
*** ../../store/tcsh-6.03/sh.sem.c	Tue Nov 24 13:04:22 1992
--- ./sh.sem.c	Fri Feb 26 02:36:24 1993
***************
*** 489,497 ****
--- 489,506 ----
  			}
  # ifdef BSDJOBS
  			if (_gv.wanttty >= 0) {
+ #  ifdef __MINT__
+ /* see sh.proc.c */
+                             extern void sig_tmp_ign();
+ 
+                             (void) signal(SIGTSTP, sig_tmp_ign);
+                             (void) signal(SIGTTIN, sig_tmp_ign);
+                             (void) signal(SIGTTOU, sig_tmp_ign);
+ #  else
  			    (void) signal(SIGTSTP, SIG_DFL);
  			    (void) signal(SIGTTIN, SIG_DFL);
  			    (void) signal(SIGTTOU, SIG_DFL);
+ #  endif
  			}
  # endif /* BSDJOBS */
  
***************
*** 612,619 ****
--- 621,630 ----
  	execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
  	t->t_dcar->t_dflg |= F_PIPEOUT |
  	    (t->t_dflg & (F_PIPEIN | F_AMPERSAND | F_STDERR | F_NOINTERRUPT));
+ # ifndef __MINT__
  	if (_gv.wanttty > 0)
  	    _gv.wanttty = 0;	/* got tty already */
+ # endif
  	execute(t->t_dcar, _gv.wanttty, pipein, pv);
  #else /* !BACKPIPE */
  	t->t_dcar->t_dflg |= F_PIPEOUT |
***************
*** 621,628 ****
--- 632,641 ----
  	execute(t->t_dcar, _gv.wanttty, pipein, pv);
  	t->t_dcdr->t_dflg |= F_PIPEIN | (t->t_dflg &
  			(F_PIPEOUT | F_AMPERSAND | F_NOFORK | F_NOINTERRUPT));
+ # ifndef __MINT__
  	if (_gv.wanttty > 0)
  	    _gv.wanttty = 0;	/* got tty already */
+ # endif
  	execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
  #endif /* BACKPIPE */
  	break;
***************
*** 795,812 ****
--- 808,839 ----
  	    (void) dmove(fd, 0);
  	}
  	else if (flags & F_PIPEIN) {
+ #ifdef __MINT__
+             (void) dup2(pipein[0], 0);
+ #else
  	    (void) close(0);
  	    (void) dup(pipein[0]);
+ #endif
  	    (void) close(pipein[0]);
  	    (void) close(pipein[1]);
  	}
  	else if ((flags & F_NOINTERRUPT) && tpgrp == -1) {
+ #ifdef __MINT__
+             int fd = open(_PATH_DEVNULL, O_RDONLY);
+             (void) dup2(fd, 0);
+             (void) close(fd);
+ #else
  	    (void) close(0);
  	    (void) open(_PATH_DEVNULL, O_RDONLY);
+ #endif
  	}
  	else {
+ #ifdef __MINT__
+             (void) dup2(OLDSTD, 0);
+ #else
  	    (void) close(0);
  	    (void) dup(OLDSTD);
+ #endif
  #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
  	    /*
  	     * PWP: Unlike Bezerkeley 4.3, FIONCLEX for Pyramid is preserved
***************
*** 853,865 ****
--- 880,900 ----
  	is1atty = isatty(1);
      }
      else if (flags & F_PIPEOUT) {
+ #ifdef __MINT__
+         (void) dup2(pipeout[1], 1);
+ #else
  	(void) close(1);
  	(void) dup(pipeout[1]);
+ #endif
  	is1atty = 0;
      }
      else {
+ #ifdef __MINT__
+         (void) dup2(SHOUT, 1);
+ #else
  	(void) close(1);
  	(void) dup(SHOUT);
+ #endif
  	is1atty = isoutatty;
  # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
  	(void) close_on_exec(1, 0);
***************
*** 868,878 ****
--- 903,921 ----
  
      (void) close(2);
      if (flags & F_STDERR) {
+ #ifdef __MINT__
+         (void) dup2(1, 2);
+ #else
  	(void) dup(1);
+ #endif
  	is2atty = is1atty;
      }
      else {
+ #ifdef __MINT__
+         (void) dup2(SHDIAG, 2);
+ #else
  	(void) dup(SHDIAG);
+ #endif
  	is2atty = isdiagatty;
  # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
  	(void) close_on_exec(2, 0);
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.set.c ./sh.set.c
*** ../../store/tcsh-6.03/sh.set.c	Tue Nov 24 13:04:22 1992
--- ./sh.set.c	Mon Mar  8 05:43:22 1993
***************
*** 54,59 ****
--- 54,62 ----
  static	struct varent	*madrof		__P((Char *, struct varent *));
  static	void		 unsetv1	__P((struct varent *));
  static	void		 exportpath	__P((Char **));
+ #ifdef __MINT__
+ static  void             exportsuffixes __P((Char **));
+ #endif
  static	void		 balance	__P((struct varent *, int, int));
  
  /*
***************
*** 68,73 ****
--- 71,82 ----
  	exportpath(adrof(STRpath)->vec);
  	dohash(NULL, NULL);
      }
+ #ifdef __MINT__
+     else if (eq(vp, STRsuffixes)) {
+         exportsuffixes(adrof(STRsuffixes)->vec);
+         dohash(NULL, NULL);
+     }
+ #endif
      else if (eq(vp, STRhistchars)) {
  	register Char *pn = value(vp);
  
***************
*** 418,424 ****
      }
      else {
  	num = 4;		/* confuse lint */
! 	if (sizeof(int) == num && ((unsigned int) n) == 2147483648) {
  	    *putp++ = '2';
  	    n = 147483648;
  	}
--- 427,433 ----
      }
      else {
  	num = 4;		/* confuse lint */
! 	if (sizeof(int) == num && ((unsigned int) n) == 2147483648U) {
  	    *putp++ = '2';
  	    n = 147483648;
  	}
***************
*** 731,736 ****
--- 740,769 ----
      tsetenv(STRKPATH, exppath);
  }
  
+ #ifdef __MINT__
+ static void
+ exportsuffixes(val)
+     Char  **val;
+ {
+     Char    expsuff[BUFSIZE];
+     static Char STRcomma[] = { ',' , '\0' };
+ 
+     expsuff[0] = 0;
+     if (val)
+         while (*val) {
+             if (Strlen(*val) + Strlen(expsuff) + 2 > BUFSIZE) {
+                 xprintf("Warning: ridiculously long SUFFIXES truncated\n");
+                 break;
+             }
+             (void) Strcat(expsuff, *val++);
+             if (*val == 0 || eq(*val, STRRparen))
+                 break;
+             (void) Strcat(expsuff, STRcomma);
+         }
+     tsetenv(STRSUFFIXES, expsuff);
+ }
+ #endif /* __MINT__ */
+ 
  #ifndef lint
   /*
    * Lint thinks these have null effect
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.time.c ./sh.time.c
*** ../../store/tcsh-6.03/sh.time.c	Tue Nov 24 13:04:22 1992
--- ./sh.time.c	Fri Feb 26 02:46:54 1993
***************
*** 178,183 ****
--- 178,184 ----
  {
      tvadd(&ru->ru_utime, &ru2->ru_utime);
      tvadd(&ru->ru_stime, &ru2->ru_stime);
+ #ifndef __MINT__
      if (ru2->ru_maxrss > ru->ru_maxrss)
  	ru->ru_maxrss = ru2->ru_maxrss;
  
***************
*** 194,199 ****
--- 195,201 ----
      ru->ru_nsignals += ru2->ru_nsignals;
      ru->ru_nvcsw += ru2->ru_nvcsw;
      ru->ru_nivcsw += ru2->ru_nivcsw;
+ #endif
  }
  
  #else /* BSDTIMES */
***************
*** 325,331 ****
--- 327,337 ----
      int     ms =
      (e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
  
+ # ifdef __MINT__
+     cp = "%Uu %Ss %E %P";
+ # else
      cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
+ # endif
  #else
  # ifdef _SEQUENT_
      int     ms =
***************
*** 416,422 ****
  		xprintf("%ld.%01ld%%", i / 10, i % 10);	/* nn.n% */
  		break;
  
! #ifdef BSDTIMES
  	    case 'W':		/* number of swaps */
  		i = r1->ru_nswap - r0->ru_nswap;
  		xprintf("%ld", i);
--- 422,428 ----
  		xprintf("%ld.%01ld%%", i / 10, i % 10);	/* nn.n% */
  		break;
  
! #if defined(BSDTIMES) && !defined(__MINT__)
  	    case 'W':		/* number of swaps */
  		i = r1->ru_nswap - r0->ru_nswap;
  		xprintf("%ld", i);
diff --context --new-file --recursive ../../store/tcsh-6.03/sh.types.h ./sh.types.h
*** ../../store/tcsh-6.03/sh.types.h	Tue Nov 24 13:04:34 1992
--- ./sh.types.h	Sat Mar 13 23:58:14 1993
***************
*** 487,492 ****
--- 487,502 ----
  # endif /* _SIZE_T */
  #endif /* _VMS_POSIX */
  
+ /*
+  *  MiNT
+  */
+ #ifdef __MINT__
+ # ifndef _SIGMASK_T
+ #  define _SIGMASK_T
+    typedef long sigmask_t;
+ # endif
+ #endif
+ 
  /***
   *** Catch all for non POSIX and/or non ANSI systems.
   *** Systems up to spec *should* define these automatically
diff --context --new-file --recursive ../../store/tcsh-6.03/sldiffs ./sldiffs
*** ../../store/tcsh-6.03/sldiffs
--- ./sldiffs	Sun Mar  7 18:07:24 1993
***************
*** 0 ****
--- 1,3012 ----
+ Common subdirectories: /usr/users/staff/hohmuth/tmp/tcsh-6.03/config and ./config
+ Only in .: config.h
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/config_f.h ./config_f.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/config_f.h	Tue Nov 24 13:04:38 1992
+ --- ./config_f.h	Fri Feb 26 04:17:40 1993
+ ***************
+ *** 56,62 ****
+    *		if you don't have <locale.h>, you don't want
+    *		to define this.
+    */
+ ! #define NLS
+   
+   /*
+    * LOGINFIRST   Source ~/.login before ~/.cshrc
+ --- 56,62 ----
+    *		if you don't have <locale.h>, you don't want
+    *		to define this.
+    */
+ ! #undef NLS
+   
+   /*
+    * LOGINFIRST   Source ~/.login before ~/.cshrc
+ ***************
+ *** 90,96 ****
+    *		on the name of the tty, and environment.
+    *		Does not make sense in the modern window systems!
+    */
+ ! #define AUTOLOGOUT
+   
+   /*
+    * SUSPENDED	Newer shells say 'Suspended' instead of 'Stopped'.
+ --- 90,96 ----
+    *		on the name of the tty, and environment.
+    *		Does not make sense in the modern window systems!
+    */
+ ! #undef AUTOLOGOUT
+   
+   /*
+    * SUSPENDED	Newer shells say 'Suspended' instead of 'Stopped'.
+ ***************
+ *** 115,120 ****
+ --- 115,137 ----
+   #else
+   # undef SYSMALLOC
+   #endif
+ + 
+ + #if 0
+ + # ifndef SYSMALLOC
+ + #  define SYSMALLOC
+ + # endif
+ + #endif
+ + 
+ + /*
+ +  * DOSFS      Support DOS filessystems (which have a 12345678.123 limit),
+ +  *            and allow backslashes as path separators
+ +  */
+ + #define DOSFS
+ + 
+ + /*
+ +  * DOSTEXT    Support DOS text mode/files (ignore 0x0d)
+ +  */
+ + #define DOSTEXT
+   
+   /*
+    * RCSID	This defines if we want rcs strings in the binary or not
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/ed,init.c ./ed,init.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/ed,init.c	Tue Nov 24 13:04:28 1992
+ --- ./ed,init.c	Thu Feb 25 04:30:40 1993
+ ***************
+ *** 626,631 ****
+ --- 626,649 ----
+   	char    buf[BUFSIZE];
+   
+   	chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
+ + 
+ + # ifdef DOSTEXT
+ +         /* strip out carriage returns */
+ +         if (chrs > 0) {
+ +                 char *src, *dst;
+ +                 int i;
+ + 
+ +                 src = dst = buf;
+ +                 for (i = chrs; i > 0; --i) {
+ +                         if (*src == '\r')
+ +                                 --chrs;
+ +                         else
+ +                                 *dst++ = *src;
+ +                         src++;
+ +                 }
+ +         }
+ + # endif
+ + 
+   	if (chrs > 0) {
+   	    buf[chrs] = '\0';
+   	    Input_Line = Strsave(str2short(buf));
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/ed,input.c ./ed,input.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/ed,input.c	Tue Nov 24 13:04:30 1992
+ --- ./ed,input.c	Thu Feb 25 04:33:52 1993
+ ***************
+ *** 99,105 ****
+       if (!Tty_raw_mode && MacroLvl < 0) {
+   	long    chrs = 0;
+   
+ ! 	(void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
+   	if (chrs == 0) {
+   	    if (Rawmode() < 0)
+   		return 0;
+ --- 99,111 ----
+       if (!Tty_raw_mode && MacroLvl < 0) {
+   	long    chrs = 0;
+   
+ ! # ifndef __MINT__
+ ! /* MiNT _always_ wants to go into raw mode, so don't bother with the
+ !  * FIONREAD test
+ !  */
+ !         (void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
+ ! # endif
+ ! 
+   	if (chrs == 0) {
+   	    if (Rawmode() < 0)
+   		return 0;
+ Only in .: foobar
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/makefile ./makefile
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/makefile	Tue Nov 24 13:04:36 1992
+ --- ./makefile	Tue Feb 23 21:48:04 1993
+ ***************
+ *** 7,12 ****
+ --- 7,16 ----
+   # With an input editor, command completion, etc. and ported to all sorts of
+   # things; Paul Placeway, CIS Dept., Ohio State University
+   #
+ + 
+ + CROSSDIR = /usr/users1/mat91/mh1/atari/cross-gcc
+ + CROSSBIN = $(CROSSDIR)/bin
+ + 
+   SHELL=/bin/sh
+   VERSION=6.03
+   BUILD=tcsh
+ ***************
+ *** 49,58 ****
+   #CFLAGS=-O $(INCLUDES)
+   
+   # gcc-2.1
+ ! CFLAGS=-O2 $(INCLUDES)
+   
+   # gcc 2.1 on linux
+ ! #CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
+   
+   #hpux 8.0
+   #CFLAGS= $(INCLUDES) +O3 -Aa
+ --- 53,63 ----
+   #CFLAGS=-O $(INCLUDES)
+   
+   # gcc-2.1
+ ! #CFLAGS=-O2 $(INCLUDES)
+   
+   # gcc 2.1 on linux
+ ! # MiNT
+ ! CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
+   
+   #hpux 8.0
+   #CFLAGS= $(INCLUDES) +O3 -Aa
+ ***************
+ *** 117,123 ****
+   ################################################################
+   ## LIBES.  Pick one, or roll your own.
+   ################################################################
+ ! LIBES= -ltermcap 		## BSD style things, hpux
+   #LIBES= -ltermc			## emx under OS/2
+   #LIBES= -ltermcap -lsec		## Tek XD88/10 (UTekV) with PW_SHADOW
+   #LIBES= -ltermcap -lsec		## Motorola MPC (sysV88) with PW_SHADOW
+ --- 122,128 ----
+   ################################################################
+   ## LIBES.  Pick one, or roll your own.
+   ################################################################
+ ! #LIBES= -ltermcap 		## BSD style things, hpux
+   #LIBES= -ltermc			## emx under OS/2
+   #LIBES= -ltermcap -lsec		## Tek XD88/10 (UTekV) with PW_SHADOW
+   #LIBES= -ltermcap -lsec		## Motorola MPC (sysV88) with PW_SHADOW
+ ***************
+ *** 152,157 ****
+ --- 157,163 ----
+   #LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
+   #LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
+   #LIBES= -ltermcap -lauth        ## for Ultrix with Enhanced Security
+ + LIBES=	-lbtermcap		## when compiling with -mbaserel in MiNT
+   
+   
+   # The difficult choice of a c-compiler...
+ ***************
+ *** 164,170 ****
+   
+   # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
+   # on the suns does not know how to make dynamically linked binaries.
+ ! CC=	gcc -Wall -B/bin/	
+   #CC=	gcc -m486 -Wall # Generate code for Intel 486 (linux)
+   #CC=	cc
+   #CC=	occ
+ --- 170,176 ----
+   
+   # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
+   # on the suns does not know how to make dynamically linked binaries.
+ ! #CC=	gcc -Wall -B/bin/	
+   #CC=	gcc -m486 -Wall # Generate code for Intel 486 (linux)
+   #CC=	cc
+   #CC=	occ
+ ***************
+ *** 173,178 ****
+ --- 179,187 ----
+   #CC=	/bin/cc	# For suns, w/o gcc and SVR4
+   #CC=	/usr/lib/sun.compile/cc  # FPS 500 (+FPX) with Sun C compiler
+   #CC=	scc 	# Alliant fx2800
+ + #CC=	$(CROSSBIN)/cgcc -Wall
+ + CC=	gcc -Wall
+ + 
+   ED=	ed
+   AS=	as
+   RM=	rm
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/pathname.h ./pathname.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/pathname.h	Tue Nov 24 13:04:38 1992
+ --- ./pathname.h	Thu Feb 25 04:36:08 1993
+ ***************
+ *** 69,74 ****
+ --- 69,80 ----
+   # endif /* !_PATH_DOTCSHRC */
+   #endif /* NeXT */
+   
+ + #ifdef DOSFS
+ + # define _PATH_DOTLOGIN         "/etc/login.csh"
+ + # define _PATH_DOTLOGOUT        "/etc/logout.csh"
+ + # define _PATH_DOTCSHRC         "/etc/cshrc.csh"
+ + #endif
+ + 
+   #if defined(sgi) || defined(OREO) || defined(cray) || defined(AMIX) || defined(CDC)
+   # ifndef _PATH_DOTLOGIN
+   #  define _PATH_DOTLOGIN	"/etc/cshrc"
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,char.c ./sh,char.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,char.c	Tue Nov 24 13:04:18 1992
+ --- ./sh,char.c	Thu Feb 25 04:57:24 1993
+ ***************
+ *** 51,58 ****
+   	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
+   
+   /*	 12 np		 13 cr		 14 so		 15 si	*/
+ ! 	_CTR,		_CTR,		_CTR,		_CTR,
+ ! 
+   /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
+   	_CTR,		_CTR,		_CTR,		_CTR,
+   
+ --- 51,62 ----
+   	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
+   
+   /*	 12 np		 13 cr		 14 so		 15 si	*/
+ ! #ifndef DOSTEXT
+ !         _CTR,           _CTR,           _CTR,           _CTR,
+ ! #else
+ ! /* cr is whitespace */
+ !         _CTR,           _CTR|_SP|_META, _CTR,           _CTR,
+ ! #endif
+   /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
+   	_CTR,		_CTR,		_CTR,		_CTR,
+   
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,dir.c ./sh,dir.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,dir.c	Tue Nov 24 13:04:18 1992
+ --- ./sh,dir.c	Thu Feb 25 05:31:40 1993
+ ***************
+ *** 242,248 ****
+   	len = Strlen(hp);
+   	if (!(dflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
+   	    Strncmp(hp, dp->di_name, len) == 0 &&
+ ! 	    (dp->di_name[len] == '\0' || dp->di_name[len] == '/')) 
+   	    len = Strlen(s = (dp->di_name + len)) + 2;
+   	else
+   	    len = Strlen(s = dp->di_name) + 1;
+ --- 242,248 ----
+   	len = Strlen(hp);
+   	if (!(dflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
+   	    Strncmp(hp, dp->di_name, len) == 0 &&
+ ! 	    (dp->di_name[len] == '\0' || is_dirsep(dp->di_name[len])) 
+   	    len = Strlen(s = (dp->di_name + len)) + 2;
+   	else
+   	    len = Strlen(s = dp->di_name) + 1;
+ ***************
+ *** 301,308 ****
+   {
+   
+   /* return true if dp is of the form "../xxx" or "/../xxx" */
+ ! #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
+ ! #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
+   
+   #ifdef S_IFLNK
+       if (exp) {
+ --- 301,308 ----
+   {
+   
+   /* return true if dp is of the form "../xxx" or "/../xxx" */
+ ! #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || is_dirsep(*((p) - 1))))
+ ! #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || is_dirsep(*((p) - 1))))
+   
+   #ifdef S_IFLNK
+       if (exp) {
+ ***************
+ *** 332,338 ****
+   	 * If the path starts with a slash, we are not relative to
+   	 * the current working directory.
+   	 */
+ ! 	if ( *start == '/' )
+   	    *cwd = '\0';
+   # ifdef apollo
+   	slashslash = cwd[0] == '/' && cwd[1] == '/';
+ --- 332,338 ----
+   	 * If the path starts with a slash, we are not relative to
+   	 * the current working directory.
+   	 */
+ ! 	if ( is_abspath(start) )
+   	    *cwd = '\0';
+   # ifdef apollo
+   	slashslash = cwd[0] == '/' && cwd[1] == '/';
+ ***************
+ *** 363,369 ****
+   
+   	    *dp = '\0';
+   	    while (dotdot > 0) 
+ ! 	        if ((dp = Strrchr(cwd, '/')) != NULL) {
+   # ifdef apollo
+   		    if (dp == &cwd[1]) 
+   		        slashslash = 1;
+ --- 363,369 ----
+   
+   	    *dp = '\0';
+   	    while (dotdot > 0) 
+ ! 	        if ((dp = Lastslash(cwd)) != NULL) {
+   # ifdef apollo
+   		    if (dp == &cwd[1]) 
+   		        slashslash = 1;
+ ***************
+ *** 391,403 ****
+   # endif /* apollo */
+   
+   	    if (buf[0]) {
+ ! 	        if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) != '/')
+   		    cwd[dotdot++] = '/';
+   	        cwd[dotdot] = '\0';
+ ! 	        dp = Strspl(cwd, TRM(buf[0]) == '/' ? &buf[1] : buf);
+   	        xfree((ptr_t) cwd);
+   	        cwd = dp;
+ ! 	        if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) == '/')
+   		    cwd[--dotdot] = '\0';
+   	    }
+   	    if (!*cp)
+ --- 391,403 ----
+   # endif /* apollo */
+   
+   	    if (buf[0]) {
+ ! 	        if (! is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
+   		    cwd[dotdot++] = '/';
+   	        cwd[dotdot] = '\0';
+ ! 	        dp = Strspl(cwd, is_dirsep(TRM(buf[0])) ? &buf[1] : buf);
+   	        xfree((ptr_t) cwd);
+   	        cwd = dp;
+ ! 	        if (is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
+   		    cwd[--dotdot] = '\0';
+   	    }
+   	    if (!*cp)
+ ***************
+ *** 470,476 ****
+   {
+       Char   *dp;
+   
+ !     if (*cp != '/') {
+   	register Char *p, *q;
+   	int     cwdlen;
+   
+ --- 470,476 ----
+   {
+       Char   *dp;
+   
+ !     if (! is_abspath(cp)) {
+   	register Char *p, *q;
+   	int     cwdlen;
+   
+ ***************
+ *** 547,553 ****
+   	serrno = errno;
+       }
+   
+ !     if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
+   	&& (c = adrof(STRcdpath))) {
+   	Char  **cdp;
+   	register Char *p;
+ --- 547,553 ----
+   	serrno = errno;
+       }
+   
+ !     if (!is_abspath(cp) && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
+   	&& (c = adrof(STRcdpath))) {
+   	Char  **cdp;
+   	register Char *p;
+ ***************
+ *** 578,584 ****
+   	}
+       }
+       dp = value(cp);
+ !     if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
+   	xfree((ptr_t) cp);
+   	cp = Strsave(dp);
+   	printd = 1;
+ --- 578,584 ----
+   	}
+       }
+       dp = value(cp);
+ !     if ((is_abspath(dp) || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
+   	xfree((ptr_t) cp);
+   	cp = Strsave(dp);
+   	printd = 1;
+ ***************
+ *** 801,811 ****
+        * christos: if the path given does not start with a slash prepend cwd. If
+        * cwd does not start with a slash or the result would be too long abort().
+        */
+ !     if (*cp != '/') {
+   	Char    tmpdir[MAXPATHLEN];
+   
+   	p1 = value(STRcwd);
+ ! 	if (p1 == STRNULL || *p1 != '/')
+   	    abort();
+   	if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
+   	    abort();
+ --- 801,811 ----
+        * christos: if the path given does not start with a slash prepend cwd. If
+        * cwd does not start with a slash or the result would be too long abort().
+        */
+ !     if (! is_abspath(cp)) {
+   	Char    tmpdir[MAXPATHLEN];
+   
+   	p1 = value(STRcwd);
+ ! 	if (p1 == STRNULL || !is_abspath(p1))
+   	    abort();
+   	if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
+   	    abort();
+ ***************
+ *** 817,823 ****
+       }
+   
+   #ifdef COMMENT
+ !     if (*cp != '/')
+   	abort();
+   #endif /* COMMENT */
+   
+ --- 817,823 ----
+       }
+   
+   #ifdef COMMENT
+ !     if (!is_abspath(cp))
+   	abort();
+   #endif /* COMMENT */
+   
+ ***************
+ *** 827,833 ****
+   
+       while (*p) {		/* for each component */
+   	sp = p;			/* save slash address */
+ ! 	while (*++p == '/')	/* flush extra slashes */
+   	    continue;
+   	if (p != ++sp)
+   	    for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
+ --- 827,833 ----
+   
+       while (*p) {		/* for each component */
+   	sp = p;			/* save slash address */
+ ! 	while (is_dirsep(*++p))	/* flush extra slashes */
+   	    continue;
+   	if (p != ++sp)
+   	    for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
+ ***************
+ *** 835,841 ****
+   	p = sp;			/* save start of component */
+   	slash = 0;
+   	while (*++p)		/* find next slash or end of path */
+ ! 	    if (*p == '/') {
+   		slash = 1;
+   		*p = 0;
+   		break;
+ --- 835,841 ----
+   	p = sp;			/* save start of component */
+   	slash = 0;
+   	while (*++p)		/* find next slash or end of path */
+ ! 	    if (is_dirsep(*p)) {
+   		slash = 1;
+   		*p = 0;
+   		break;
+ ***************
+ *** 885,896 ****
+   		 */
+   		for (p1 = p; *p1++;)
+   		    continue;
+ ! 		if (*link != '/') {
+   		    /*
+   		     * Relative path, expand it between the "yyy/" and the
+   		     * "/..". First, back sp up to the character past "yyy/".
+   		     */
+ ! 		    while (*--sp != '/')
+   			continue;
+   		    sp++;
+   		    *sp = 0;
+ --- 885,896 ----
+   		 */
+   		for (p1 = p; *p1++;)
+   		    continue;
+ ! 		if (! is_abspath(link)) {
+   		    /*
+   		     * Relative path, expand it between the "yyy/" and the
+   		     * "/..". First, back sp up to the character past "yyy/".
+   		     */
+ ! 		    while (!is_dirsep(*--sp))
+   			continue;
+   		    sp++;
+   		    *sp = 0;
+ ***************
+ *** 942,948 ****
+   #endif /* S_IFLNK */
+   	    *sp = '/';
+   	    if (sp != cp)
+ ! 		while (*--sp != '/')
+   		    continue;
+   	    if (slash) {
+   		for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
+ --- 942,948 ----
+   #endif /* S_IFLNK */
+   	    *sp = '/';
+   	    if (sp != cp)
+ ! 		while (is_dirsep(*--sp))
+   		    continue;
+   	    if (slash) {
+   		for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
+ ***************
+ *** 979,991 ****
+   		 */
+   		for (p1 = p; *p1++;)
+   		    continue;
+ ! 		if (*link != '/') {
+   		    /*
+   		     * Relative path, expand it between the "yyy/" and the
+   		     * remainder. First, back sp up to the character past
+   		     * "yyy/".
+   		     */
+ ! 		    while (*--sp != '/')
+   			continue;
+   		    sp++;
+   		    *sp = 0;
+ --- 979,991 ----
+   		 */
+   		for (p1 = p; *p1++;)
+   		    continue;
+ ! 		if (! is_abspath(link)) {
+   		    /*
+   		     * Relative path, expand it between the "yyy/" and the
+   		     * remainder. First, back sp up to the character past
+   		     * "yyy/".
+   		     */
+ ! 		    while (! is_dirsep(*--sp))
+   			continue;
+   		    sp++;
+   		    *sp = 0;
+ ***************
+ *** 1049,1056 ****
+       /*
+        * See if we're not in a subdir of STRhome
+        */
+ !     if (p1 && *p1 == '/' &&
+ ! 	(Strncmp(p1, cp, cc) != 0 || (cp[cc] != '/' && cp[cc] != '\0'))) {
+   	static ino_t home_ino = (ino_t) -1;
+   	static dev_t home_dev = -1;
+   	static Char *home_ptr = NULL;
+ --- 1049,1056 ----
+       /*
+        * See if we're not in a subdir of STRhome
+        */
+ !     if (p1 && is_abspath(p1) &&
+ ! 	(Strncmp(p1, cp, cc) != 0 || (!is_dirsep(cp[cc]) && cp[cc] != '\0'))) {
+   	static ino_t home_ino = (ino_t) -1;
+   	static dev_t home_dev = -1;
+   	static Char *home_ptr = NULL;
+ ***************
+ *** 1075,1081 ****
+   			sp = (Char *) - 1;
+   			break;
+   	    }
+ ! 	    if ((sp = Strrchr(p2, '/')) != NULL)
+   		*sp = '\0';
+   	}
+   	/*
+ --- 1075,1081 ----
+   			sp = (Char *) - 1;
+   			break;
+   	    }
+ ! 	    if ((sp = Lastslash(p2)) != NULL)
+   		*sp = '\0';
+   	}
+   	/*
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,dol.c ./sh,dol.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,dol.c	Tue Nov 24 13:04:18 1992
+ --- ./sh,dol.c	Thu Feb 25 05:37:04 1993
+ ***************
+ *** 480,485 ****
+ --- 480,491 ----
+   	if (length)
+   	    stderror(ERR_NOTALLOWED, "$%<");
+   	for (np = wbuf; read(OLDSTD, &tnp, 1) == 1; np++) {
+ + #ifdef DOSTEXT
+ +             /* strip out cr's */
+ +             while (tnp == '\r') {
+ +                 if (read(OLDSTD, &tnp, 1) != 1) break;
+ +             }
+ + #endif
+   	    *np = (unsigned char) tnp;
+   	    if (np >= &wbuf[BUFSIZE - 1])
+   		stderror(ERR_LTOOLONG);
+ ***************
+ *** 940,945 ****
+ --- 946,961 ----
+       register Char *lbp, *obp, *mbp;
+       Char  **vp;
+       bool    quoted;
+ + #ifdef __MINT__
+ +     int tf;
+ +     extern int csh_tmpfile __P((void));   /* in sh.c */
+ + 
+ +     tf = csh_tmpfile();
+ +     if (tf < 0)
+ +         stderror(ERR_SYSTEM, "tmpfile", strerror(errno));
+ +     (void)dup2(tf, 0);
+ +     (void)close(tf);
+ + #else
+       char   *tmp;
+   
+       if (creat(tmp = short2str(shtemp), 0600) < 0)
+ ***************
+ *** 953,958 ****
+ --- 969,976 ----
+   	stderror(ERR_SYSTEM, tmp, strerror(errno));
+       }
+       (void) unlink(tmp);		/* 0 0 inode! */
+ + #endif /* __MINT__ */
+ + 
+       Dv[0] = term;
+       Dv[1] = NULL;
+       gflag = 0;
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,exec.c ./sh,exec.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,exec.c	Tue Nov 24 13:04:18 1992
+ --- ./sh,exec.c	Fri Feb 26 01:23:20 1993
+ ***************
+ *** 49,54 ****
+ --- 49,60 ----
+   # define FASTHASH	/* Fast hashing is the default */
+   #endif /* OLDHASH */
+   
+ + #ifdef __MINT__
+ + extern char **environ;
+ + int     csh_execve      __P((char *, char **, char **));
+ + #define execv(f, t) csh_execve(f, t, environ)
+ + #endif
+ + 
+   /*
+    * System level search and execute of a command.
+    * We look in each directory for the specified command name.
+ ***************
+ *** 180,190 ****
+   #endif /* VFORK */
+   
+       v = adrof(STRpath);
+ !     if (v == 0 && expath[0] != '/') {
+   	blkfree(pv);
+   	pexerr();
+       }
+ !     slash = any(short2str(expath), '/');
+   
+       /*
+        * Glob the argument list, if necessary. Otherwise trim off the quote bits.
+ --- 186,196 ----
+   #endif /* VFORK */
+   
+       v = adrof(STRpath);
+ !     if (v == 0 && !is_abspath(expath)) {
+   	blkfree(pv);
+   	pexerr();
+       }
+ !     slash = hash_slash(short2str(expath));
+   
+       /*
+        * Glob the argument list, if necessary. Otherwise trim off the quote bits.
+ ***************
+ *** 266,272 ****
+   	 * one at a time, as the user enters them.  This is kinda like Korn
+   	 * Shell's "tracked aliases".
+   	 */
+ ! 	if (!slash && pv[0][0] == '/' && havhash) {
+   #ifdef FASTHASH
+   	    if (!bit(hashval, i))
+   		goto cont;
+ --- 272,278 ----
+   	 * one at a time, as the user enters them.  This is kinda like Korn
+   	 * Shell's "tracked aliases".
+   	 */
+ ! 	if (!slash && is_abspath(pv[0]) && havhash) {
+   #ifdef FASTHASH
+   	    if (!bit(hashval, i))
+   		goto cont;
+ ***************
+ *** 421,427 ****
+ --- 427,438 ----
+   	 */
+   	if ((fd = open(f, O_RDONLY)) != -1) {
+   	    if (read(fd, (char *) pref, 2) == 2) {
+ + #ifndef DOSTEXT
+   		if (!Isprint(pref[0]) && (pref[0] != '\n' && pref[0] != '\t')) {
+ + #else
+ + 		if (!Isprint(pref[0]) && (pref[0] != '\n' && pref[0] != '\t'
+ + 		                          && pref[0] != '\r')) {
+ + #endif
+   		    (void) close(fd);
+   		    /*
+   		     * We *know* what ENOEXEC means.
+ ***************
+ *** 453,459 ****
+ --- 464,472 ----
+   #ifdef _PATH_BSHELL
+   		if (fd != -1 
+   # ifndef ISC	/* Compatible with ISC's /bin/csh */
+ + #  ifndef __MINT__ /* Compensate for missing #! interpretation */
+   		    && pref[0] != '#'
+ + #  endif
+   # endif /* ISC */
+   		    )
+   		    vp[0] = STR_BSHELL;
+ ***************
+ *** 637,642 ****
+ --- 650,659 ----
+       struct varent *v = adrof(STRpath);
+       Char  **pv;
+       int hashval;
+ + #ifdef __MINT__
+ +     struct varent *suffv = adrof(STRsuffixes);
+ +     Char **suffpv;
+ + #endif
+   
+   #ifdef FASTHASH
+       if (vv && vv[1]) {
+ ***************
+ *** 677,683 ****
+       if (v == NULL)
+   	return;
+       for (pv = v->vec; *pv; pv++, i++) {
+ ! 	if (pv[0][0] != '/')
+   	    continue;
+   	dirp = opendir(short2str(*pv));
+   	if (dirp == NULL)
+ --- 694,700 ----
+       if (v == NULL)
+   	return;
+       for (pv = v->vec; *pv; pv++, i++) {
+ ! 	if (! is_abspath(pv[0]))
+   	    continue;
+   	dirp = opendir(short2str(*pv));
+   	if (dirp == NULL)
+ ***************
+ *** 696,701 ****
+ --- 713,731 ----
+   		(dp->d_name[1] == '\0' ||
+   		 (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
+   		continue;
+ + #ifdef __MINT__
+ +             {   char *s = rindex(dp->d_name, '.');
+ + 
+ +                 if (s && suffv) {
+ +                     for (suffpv = suffv->vec; *suffpv; suffpv++) {
+ +                         if (!strcmp(s+1, short2str(*suffpv))) {
+ +                             *s = 0; break;
+ +                         }
+ +                     }
+ +                 }
+ +             }
+ + #endif /* __MINT__ */
+ + 
+   #ifdef FASTHASH
+   	    hashval = hashname(str2short(dp->d_name));
+   	    bis(hashval, i);
+ ***************
+ *** 769,775 ****
+       register Char **pv;
+       register Char *sav;
+       register struct varent *v;
+ !     register bool slash = any(short2str(name), '/');
+       register int hashval, i;
+   
+       v = adrof(STRpath);
+ --- 799,805 ----
+       register Char **pv;
+       register Char *sav;
+       register struct varent *v;
+ !     register bool slash = has_slash(short2str(name));
+       register int hashval, i;
+   
+       v = adrof(STRpath);
+ ***************
+ *** 781,787 ****
+       hashval = havhash ? hashname(name) : 0;
+       i = 0;
+       do {
+ ! 	if (!slash && pv[0][0] == '/' && havhash) {
+   #ifdef FASTHASH
+   	    if (!bit(hashval, i))
+   		goto cont;
+ --- 811,817 ----
+       hashval = havhash ? hashname(name) : 0;
+       i = 0;
+       do {
+ ! 	if (!slash && is_abspath(pv[0]) && havhash) {
+   #ifdef FASTHASH
+   	    if (!bit(hashval, i))
+   		goto cont;
+ ***************
+ *** 827,832 ****
+ --- 857,915 ----
+    * if dir_ok is set and the pathname refers to a directory.
+    * This is a bit kludgy, but in the name of optimization...
+    */
+ + #ifdef __MINT__
+ + int
+ + executable(dir, name, dir_ok)
+ +     Char   *dir, *name;
+ +     bool    dir_ok;
+ + {
+ +     char *ext, *base;
+ +     int i;
+ +     struct stat stbuf;
+ +     Char    path[MAXPATHLEN + 1];
+ +     char   *strname;
+ +     struct varent *v;
+ +     Char **pv;
+ + 
+ +     if (dir && *dir) {
+ +         copyn(path, dir, MAXPATHLEN);
+ +         catn(path, name, MAXPATHLEN);
+ +         strname = short2str(path);
+ +     }
+ +     else
+ +         strname = short2str(name);
+ + 
+ +     ext = base = alloca(strlen(strname) + 5);
+ +     while (*strname)
+ +         *ext++ = *strname++;
+ + 
+ +     *ext = 0;
+ + 
+ +     if (stat(base, &stbuf) != -1 &&
+ +         ((dir_ok && S_ISDIR(stbuf.st_mode)) ||
+ +           (S_ISREG(stbuf.st_mode) &&
+ +           ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR))))))
+ +                 return 1;
+ + 
+ +     if (dir_ok) return 0;
+ + 
+ +     v = adrof(STRsuffixes);
+ +     if (v == 0) return 0;
+ + 
+ +     *ext++ = '.';
+ +     for (pv = v->vec; *pv; pv++) {
+ +         strcpy(ext, short2str(*pv));
+ +         if (stat(base, &stbuf) != -1 &&
+ +             (S_ISREG(stbuf.st_mode) &&
+ +              ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR)) ||
+ +               !strcmp(ext, "csh"))))
+ +                return 1;
+ +     }
+ +     return 0;
+ + }
+ + 
+ + #else /* __MINT__ */
+ + 
+   int
+   executable(dir, name, dir_ok)
+       Char   *dir, *name;
+ ***************
+ *** 851,856 ****
+ --- 934,940 ----
+   	      (stbuf.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)) &&
+   	      access(strname, X_OK) == 0)));
+   }
+ + #endif /* __MINT__ */
+   
+   void
+   tellmewhat(lex)
+ ***************
+ *** 910,916 ****
+       if ((i = iscommand(strip(sp->word))) != 0) {
+   	register Char **pv;
+   	register struct varent *v;
+ ! 	bool    slash = any(short2str(sp->word), '/');
+   
+   	v = adrof(STRpath);
+   	if (v == 0 || v->vec[0] == 0 || slash)
+ --- 994,1000 ----
+       if ((i = iscommand(strip(sp->word))) != 0) {
+   	register Char **pv;
+   	register struct varent *v;
+ ! 	bool    slash = has_slash(short2str(sp->word));
+   
+   	v = adrof(STRpath);
+   	if (v == 0 || v->vec[0] == 0 || slash)
+ ***************
+ *** 975,981 ****
+       Char *sv;
+       int hashval, i, ex, rval = 0;
+   
+ !     if (prt && any(short2str(cmd), '/')) {
+   	xprintf("where: / in command makes no sense\n");
+   	return 0;
+       }
+ --- 1059,1065 ----
+       Char *sv;
+       int hashval, i, ex, rval = 0;
+   
+ !     if (prt && has_slash(short2str(cmd))) {
+   	xprintf("where: / in command makes no sense\n");
+   	return 0;
+       }
+ ***************
+ *** 1042,1044 ****
+ --- 1126,1167 ----
+       xfree((ptr_t) sv);
+       return rval;
+   }
+ + 
+ + #ifdef __MINT__
+ + 
+ + #include <process.h>
+ + 
+ + int
+ + csh_execve(path, argv, envp)
+ +         char *path;
+ +         char **argv, **envp;
+ + {
+ +         int i;
+ +         char *newpath, *s;
+ +         Char **pv;
+ +         struct varent *v;
+ + 
+ +         newpath = s = alloca(strlen(path) + 5);
+ +         while (*path) {
+ +                 *s++ = *path++;
+ +         }
+ +         *s = 0;
+ + 
+ +         if (access(newpath, 0) == 0)
+ +                 return _spawnve(P_OVERLAY, newpath, argv, envp);
+ + 
+ +         v = adrof(STRsuffixes);
+ +         if (v == 0)
+ +                 return -1;
+ +         *s++ = '.';
+ + 
+ +         for (pv = v->vec; *pv; pv++) {
+ +                 strcpy(s, short2str(*pv));
+ +                 if (access(newpath, 0) == 0) {
+ +                         return _spawnve(P_OVERLAY, newpath, argv, envp);
+ +                 }
+ +         }
+ +         return -1;
+ + }
+ + #endif /* __MINT__ */
+ + 
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,file.c ./sh,file.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,file.c	Tue Nov 24 13:04:18 1992
+ --- ./sh,file.c	Fri Feb 26 01:26:22 1993
+ ***************
+ *** 407,413 ****
+       if (old[0] != '~')
+   	return (Strcpy(new, old));
+   
+ !     for (p = person, o = &old[1]; *o && *o != '/'; *p++ = *o++);
+       *p = '\0';
+       if (person[0] == '\0')
+   	(void) Strcpy(new, value(STRhome));
+ --- 407,413 ----
+       if (old[0] != '~')
+   	return (Strcpy(new, old));
+   
+ !     for (p = person, o = &old[1]; *o && !is_dirsep(*o); *p++ = *o++);
+       *p = '\0';
+       if (person[0] == '\0')
+   	(void) Strcpy(new, value(STRhome));
+ ***************
+ *** 502,508 ****
+   {
+       register Char *p;
+   
+ !     p = Strrchr(path, '/');
+       if (p == NULL) {
+   	copyn(name, path, MAXNAMLEN);
+   	dir[0] = '\0';
+ --- 502,508 ----
+   {
+       register Char *p;
+   
+ !     p = Lastslash(path);
+       if (p == NULL) {
+   	copyn(name, path, MAXNAMLEN);
+   	dir[0] = '\0';
+ ***************
+ *** 590,596 ****
+       if (items != NULL)
+   	FREE_ITEMS(items);
+   
+ !     looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
+       if (looking_for_lognames) {
+   #ifndef _VMS_POSIX
+   	(void) setpwent();
+ --- 590,596 ----
+       if (items != NULL)
+   	FREE_ITEMS(items);
+   
+ !     looking_for_lognames = (*word == '~') && (Has_slash(word) == NULL);
+       if (looking_for_lognames) {
+   #ifndef _VMS_POSIX
+   	(void) setpwent();
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,func.c ./sh,func.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,func.c	Tue Nov 24 13:04:20 1992
+ --- ./sh,func.c	Fri Feb 26 01:32:22 1993
+ ***************
+ *** 66,71 ****
+ --- 66,75 ----
+   static	void	toend		__P((void));
+   static	void	xecho		__P((int, Char **));
+   
+ + #ifdef __MINT__
+ + extern  void    importsuffixes  __P((Char *));  /* in sh.c */
+ + #endif
+ + 
+   struct biltins *
+   isbfunc(t)
+       struct command *t;
+ ***************
+ *** 276,282 ****
+ --- 280,297 ----
+       islogin();
+       rechist(NULL);
+       (void) signal(SIGTERM, parterm);
+ + #ifdef __MINT__
+ +     {
+ +         extern int csh_execve __P((char *, char **, char **)); /* in sh.exec.c */
+ +         extern char **environ;
+ +         char *args[3];
+ + 
+ +         args[0] = "login"; args[1] = short2str(v[1]); args[2] = NULL;
+ +         (void)csh_execve(_PATH_LOGIN, args, environ);
+ +     }
+ + #else
+       (void) execl(_PATH_LOGIN, "login", short2str(v[1]), NULL);
+ + #endif
+       untty();
+       xexit(1);
+   }
+ ***************
+ *** 1190,1195 ****
+ --- 1205,1216 ----
+   	importpath(lp);
+   	dohash(NULL, NULL);
+       }
+ + #ifdef __MINT__
+ +     else if (eq(vp, STRSUFFIXES)) {
+ +         importsuffixes(lp);
+ +         dohash(NULL, NULL);
+ +     }
+ + #endif /* __MINT__ */
+   #ifdef apollo
+       else if (eq(vp, STRSYSTYPE))
+   	dohash(NULL, NULL);
+ ***************
+ *** 1313,1318 ****
+ --- 1334,1343 ----
+   
+   		if (eq(name, STRNOREBIND))
+   		    NoNLSRebind = 0;
+ + #ifdef __MINT__
+ +                 else if (eq(name, STRSUFFIXES))
+ +                     dohash(NULL, NULL);
+ + #endif
+   #ifdef apollo
+   		else if (eq(name, STRSYSTYPE))
+   		    dohash(NULL, NULL);
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,glob.c ./sh,glob.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,glob.c	Tue Nov 24 13:04:20 1992
+ --- ./sh,glob.c	Fri Feb 26 01:40:46 1993
+ ***************
+ *** 97,103 ****
+       *gstart++ = *s++;
+       u = s;
+       for (b = gstart, e = &gbuf[BUFSIZE - 1]; 
+ ! 	 *s && *s != '/' && *s != ':' && b < e;
+   	 *b++ = *s++)
+   	continue;
+       *b = EOS;
+ --- 97,103 ----
+       *gstart++ = *s++;
+       u = s;
+       for (b = gstart, e = &gbuf[BUFSIZE - 1]; 
+ ! 	 *s && is_dirsep(*s) && *s != ':' && b < e;
+   	 *b++ = *s++)
+   	continue;
+       *b = EOS;
+ ***************
+ *** 135,141 ****
+        * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
+        * in stack. PWP: let =foobar pass through (for X windows)
+        */
+ !     if (old[1] == '-' && (old[2] == '\0' || old[2] == '/')) {
+   	/* =- */
+   	dig = -1;
+   	b = &old[2];
+ --- 135,141 ----
+        * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
+        * in stack. PWP: let =foobar pass through (for X windows)
+        */
+ !     if (old[1] == '-' && (old[2] == '\0' || is_dirsep(old[2]))) {
+   	/* =- */
+   	dig = -1;
+   	b = &old[2];
+ ***************
+ *** 145,151 ****
+   	dig = old[1] - '0';
+   	for (b = &old[2]; Isdigit(*b); b++)
+   	    dig = dig * 10 + (*b - '0');
+ ! 	if (*b != '\0' && *b != '/')
+   	    /* =<number>foobar */
+   	    return old;
+       }
+ --- 145,151 ----
+   	dig = old[1] - '0';
+   	for (b = &old[2]; Isdigit(*b); b++)
+   	    dig = dig * 10 + (*b - '0');
+ ! 	if (*b != '\0' && !is_dirsep(*b))
+   	    /* =<number>foobar */
+   	    return old;
+       }
+ ***************
+ *** 674,680 ****
+   	    else if (isglob(*c))
+   		gflag |= G_GLOB;
+   	    else if (symlinks == SYM_EXPAND && 
+ ! 		*p && ISDOTDOT(c) && (c == *(t-1) || *(c-1) == '/') )
+   	    	gflag |= G_CSH;
+   	}
+       }
+ --- 674,680 ----
+   	    else if (isglob(*c))
+   		gflag |= G_GLOB;
+   	    else if (symlinks == SYM_EXPAND && 
+ ! 		*p && ISDOTDOT(c) && (c == *(t-1) || is_dirsep(*(c-1))) )
+   	    	gflag |= G_CSH;
+   	}
+       }
+ ***************
+ *** 834,839 ****
+ --- 834,855 ----
+   		do
+   		    icnt = read(pvec[0], tibuf, BUFSIZE);
+   		while (icnt == -1 && errno == EINTR);
+ + #ifdef DOSTEXT
+ +                 /* strip out carriage returns */
+ +                 {
+ +                         char *src, *dst;
+ +                         int i;
+ +                         src = dst = tibuf;
+ + 
+ +                         for (i = icnt; i > 0; --i) {
+ +                                 if (*src == '\r')
+ +                                         --icnt;
+ +                                 else
+ +                                         *dst++ = *src;
+ +                                 src++;
+ +                         }
+ +                 }
+ + #endif
+   		if (icnt <= 0) {
+   		    c = -1;
+   		    break;
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,lex.c ./sh,lex.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,lex.c	Tue Nov 24 13:04:20 1992
+ --- ./sh,lex.c	Fri Feb 26 02:05:56 1993
+ ***************
+ *** 430,436 ****
+       for (;;) {
+   	if ((c = peekc) != 0) {
+   	    peekc = 0;
+ ! 	    return (c);
+   	}
+   	if (lap) {
+   	    if ((c = *lap++) == 0)
+ --- 430,436 ----
+       for (;;) {
+   	if ((c = peekc) != 0) {
+   	    peekc = 0;
+ ! 	    goto ret_c;
+   	}
+   	if (lap) {
+   	    if ((c = *lap++) == 0)
+ ***************
+ *** 438,453 ****
+   	    else {
+   		if (cmap(c, _META | _Q | _Q1))
+   		    c |= QUOTE;
+ ! 		return (c);
+   	    }
+   	}
+   	if ((c = peekd) != 0) {
+   	    peekd = 0;
+ ! 	    return (c);
+   	}
+   	if (exclp) {
+   	    if ((c = *exclp++) != 0)
+ ! 		return (c);
+   	    if (exclnxt && --exclc >= 0) {
+   		exclnxt = exclnxt->next;
+   		setexclp(exclnxt->word);
+ --- 438,453 ----
+   	    else {
+   		if (cmap(c, _META | _Q | _Q1))
+   		    c |= QUOTE;
+ ! 		goto ret_c;
+   	    }
+   	}
+   	if ((c = peekd) != 0) {
+   	    peekd = 0;
+ ! 	    goto ret_c;
+   	}
+   	if (exclp) {
+   	    if ((c = *exclp++) != 0)
+ ! 		goto ret_c;
+   	    if (exclnxt && --exclc >= 0) {
+   		exclnxt = exclnxt->next;
+   		setexclp(exclnxt->word);
+ ***************
+ *** 475,481 ****
+ --- 475,486 ----
+   	}
+   	break;
+       }
+ + ret_c:
+ + #ifdef DOSTEXT
+ +     return (c == '\r' ? getC1(flag) : c);
+ + #else
+       return (c);
+ + #endif
+   }
+   
+   static void
+ ***************
+ *** 1125,1134 ****
+   
+       case 'h':
+       case 't':
+ ! 	if (!any(short2str(cp), '/'))
+   	    return (type == 't' ? Strsave(cp) : 0);
+   	wp = Strend(cp);
+ ! 	while (*--wp != '/')
+   	    continue;
+   	if (type == 'h')
+   	    xp = Strsave(cp), xp[wp - cp] = 0;
+ --- 1130,1139 ----
+   
+       case 'h':
+       case 't':
+ ! 	if (!has_slash(short2str(cp)))
+   	    return (type == 't' ? Strsave(cp) : 0);
+   	wp = Strend(cp);
+ ! 	while (!is_dirsep(*--wp))
+   	    continue;
+   	if (type == 'h')
+   	    xp = Strsave(cp), xp[wp - cp] = 0;
+ ***************
+ *** 1139,1145 ****
+       case 'e':
+       case 'r':
+   	wp = Strend(cp);
+ ! 	for (wp--; wp >= cp && *wp != '/'; wp--)
+   	    if (*wp == '.') {
+   		if (type == 'e')
+   		    xp = Strsave(wp + 1);
+ --- 1144,1150 ----
+       case 'e':
+       case 'r':
+   	wp = Strend(cp);
+ ! 	for (wp--; wp >= cp && !is_dirsep(*wp); wp--)
+   	    if (*wp == '.') {
+   		if (type == 'e')
+   		    xp = Strsave(wp + 1);
+ ***************
+ *** 1622,1628 ****
+   	}
+   	c = fbuf[0][fseekp - fbobp];
+   	fseekp++;
+ ! 	return (c);
+       }
+   again:
+       buf = (int) fseekp / BUFSIZE;
+ --- 1627,1633 ----
+   	}
+   	c = fbuf[0][fseekp - fbobp];
+   	fseekp++;
+ ! 	goto ret_c;
+       }
+   again:
+       buf = (int) fseekp / BUFSIZE;
+ ***************
+ *** 1699,1705 ****
+ --- 1704,1716 ----
+       }
+       c = fbuf[buf][(int) fseekp % BUFSIZE];
+       fseekp++;
+ + 
+ + ret_c:
+ + #ifdef DOSTEXT
+ +     return (c == '\r' ? bgetc() : c);
+ + #else
+       return (c);
+ + #endif
+   }
+   
+   static void
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,misc.c ./sh,misc.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,misc.c	Tue Nov 24 13:04:20 1992
+ --- ./sh,misc.c	Fri Feb 26 02:14:42 1993
+ ***************
+ *** 38,43 ****
+ --- 38,47 ----
+   
+   RCSID("$Id: sh.misc.c,v 3.17 1992/10/18 00:43:08 christos Exp $")
+   
+ + #ifdef __MINT__
+ + extern int __mint;      /* kernel version */
+ + #endif
+ + 
+   static	int	renum	__P((int, int));
+   static  Char  **blkend	__P((Char **));
+   static  Char  **blkcat	__P((Char **, Char **));
+ ***************
+ *** 270,275 ****
+ --- 274,285 ----
+   {
+       register int f;
+   
+ + #ifdef __MINT__
+ + /* in TOS, all handles are shared by all processes! (ack!) */
+ +     if (__mint == 0)
+ +         return;
+ + #endif
+ + 
+       if (didcch)
+   	return;
+       didcch = 1;
+ ***************
+ *** 308,313 ****
+ --- 318,326 ----
+       if (i == j || i < 0)
+   	return (i);
+   #ifdef HAVEDUP2
+ + # ifdef __MINT__
+ +     if (__mint != 0)    /* TOS screws up dup2 */
+ + # endif
+       if (j >= 0) {
+   	(void) dup2(i, j);
+   	if (j != i)
+ ***************
+ *** 328,333 ****
+ --- 341,351 ----
+   
+       if (i == j || i < 0 || (j < 0 && i > 2))
+   	return (i);
+ + #ifdef __MINT__
+ +     if (__mint == 0 && j > 5) {
+ +         return (i <= 5) ? dup(i) : j;
+ +     }
+ + #endif
+       if (j >= 0) {
+   #ifdef HAVEDUP2
+   	(void) dup2(i, j);
+ ***************
+ *** 464,466 ****
+ --- 482,567 ----
+   	    return (0);
+       }
+   }
+ + 
+ + #ifdef DOSFS
+ + 
+ + int
+ + is_dirsep(i)
+ +         int i;
+ + {
+ +         return i == '/' || i == '\\' ;
+ + }
+ + 
+ + int
+ + is_abspath(pth)
+ +         register Char *pth;
+ + {
+ +         return is_dirsep(TRM(*pth)) || TRM(pth[1]) == ':';
+ + }
+ + 
+ + char *
+ + lastslash(pth)
+ +         register char *pth;
+ + {
+ +         register char *slash = 0, *s = pth, c;
+ + 
+ +         if (! s) return 0;
+ + 
+ +         while ( (c = *s++) != 0) {
+ +                 if (is_dirsep(c))
+ +                         slash = s - 1;
+ +         }
+ +         if (slash)
+ +                 return slash;
+ +         return (pth[1] == ':') ? pth : 0;
+ + }
+ + 
+ + Char *
+ + Lastslash(pth)
+ +         register Char *pth;
+ + {
+ +         register Char *slash = 0, *s = pth, c;
+ + 
+ +         if (! s) return 0;
+ + 
+ +         while ( (c = *s++) != 0) {
+ +                 if (is_dirsep(c))
+ +                         slash = s - 1;
+ +         }
+ +         if (slash)
+ +                 return slash;
+ +         return (pth[1] == ':') ? pth : 0;
+ + }
+ + 
+ + int
+ + hasslash(pth)
+ +         register char *pth;
+ + {
+ +         register char c;
+ + 
+ +         if (! pth) return 0;
+ + 
+ +         while ( (c = *pth++) != 0)
+ +                 if (is_dirsep(c))
+ +                         return 1;
+ + 
+ +         return 0;
+ + }
+ + 
+ + int
+ + Hasslash(pth)
+ +         register Char *pth;
+ + {
+ +         register Char c;
+ + 
+ +         if (! pth) return 0;
+ + 
+ +         while ( (c = *pth++) != 0)
+ +                 if (is_dirsep(c))
+ +                         return 1;
+ + 
+ +         return 0;
+ + }
+ + 
+ + #endif /* DOSFS */
+ + 
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,proc.c ./sh,proc.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,proc.c	Tue Nov 24 13:04:22 1992
+ --- ./sh,proc.c	Fri Feb 26 02:23:04 1993
+ ***************
+ *** 83,94 ****
+   			    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
+   
+   # else /* !SUNOS4 && !hp9000 */
+ ! #  ifdef masscomp
+   /*
+    * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
+    * because the first two elements are unions of a time_t and a struct timeval.
+    * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
+    */
+   static struct rusage zru;
+   #  else	/* masscomp */
+   static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0, 
+ --- 83,97 ----
+   			    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
+   
+   # else /* !SUNOS4 && !hp9000 */
+ ! #  if defined(masscomp) || defined(__MINT__)
+   /*
+    * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
+    * because the first two elements are unions of a time_t and a struct timeval.
+    * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
+    */
+ + /* MiNT is missing a lot of fields, so we also trust the loader (we can
+ +  * trust it) to avoid getting errors from the compiler
+ +  */
+   static struct rusage zru;
+   #  else	/* masscomp */
+   static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0, 
+ ***************
+ *** 119,124 ****
+ --- 122,145 ----
+   static	struct process	*pgetcurr	__P((struct process *));
+   static	void		 okpcntl	__P((void));
+   
+ + #ifdef __MINT__
+ + /*
+ +  * MiNT's fork() is a lot like vfork() in some respects; in particular,
+ +  * if we set job control signals to SIG_DFL after fork() and then
+ +  * get a signal, our parent will never be able to reclaim the address
+ +  * space and everything will hang :-(. Solution: rather than SIG_DFL,
+ +  * set the signals to a null signal handler; if we exec(), they will
+ +  * be set to SIG_DFL automatically, and before then the signals will
+ +  * effectively be ignored.
+ +  */
+ + 
+ + void
+ + sig_tmp_ign(int sig)
+ + {
+ + /* do nothing, and rely on the magic of restartable system calls :-) */
+ + }
+ + #endif
+ + 
+   /*
+    * pchild - called at interrupt level by the SIGCHLD signal
+    *	indicating that at least one child has terminated or stopped
+ ***************
+ *** 1856,1865 ****
+ --- 1877,1893 ----
+   	    (void) signal(SIGQUIT, ignint ? SIG_IGN : SIG_DFL);
+   #ifdef BSDJOBS
+   	    if (wanttty >= 0) {
+ + # ifdef __MINT__
+ + /* see comments for sig_tmp_ign above */
+ +                 (void) signal(SIGTSTP, sig_tmp_ign);
+ +                 (void) signal(SIGTTIN, sig_tmp_ign);
+ +                 (void) signal(SIGTTOU, sig_tmp_ign);
+ + # else
+   		/* make stoppable */
+   		(void) signal(SIGTSTP, SIG_DFL);
+   		(void) signal(SIGTTIN, SIG_DFL);
+   		(void) signal(SIGTTOU, SIG_DFL);
+ + # endif
+   	    }
+   #endif /* BSDJOBS */
+   	    (void) signal(SIGTERM, parterm);
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,sem.c ./sh,sem.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,sem.c	Tue Nov 24 13:04:22 1992
+ --- ./sh,sem.c	Fri Feb 26 02:36:24 1993
+ ***************
+ *** 489,497 ****
+ --- 489,506 ----
+   			}
+   # ifdef BSDJOBS
+   			if (_gv.wanttty >= 0) {
+ + #  ifdef __MINT__
+ + /* see sh.proc.c */
+ +                             extern void sig_tmp_ign();
+ + 
+ +                             (void) signal(SIGTSTP, sig_tmp_ign);
+ +                             (void) signal(SIGTTIN, sig_tmp_ign);
+ +                             (void) signal(SIGTTOU, sig_tmp_ign);
+ + #  else
+   			    (void) signal(SIGTSTP, SIG_DFL);
+   			    (void) signal(SIGTTIN, SIG_DFL);
+   			    (void) signal(SIGTTOU, SIG_DFL);
+ + #  endif
+   			}
+   # endif /* BSDJOBS */
+   
+ ***************
+ *** 612,619 ****
+ --- 621,630 ----
+   	execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
+   	t->t_dcar->t_dflg |= F_PIPEOUT |
+   	    (t->t_dflg & (F_PIPEIN | F_AMPERSAND | F_STDERR | F_NOINTERRUPT));
+ + # ifndef __MINT__
+   	if (_gv.wanttty > 0)
+   	    _gv.wanttty = 0;	/* got tty already */
+ + # endif
+   	execute(t->t_dcar, _gv.wanttty, pipein, pv);
+   #else /* !BACKPIPE */
+   	t->t_dcar->t_dflg |= F_PIPEOUT |
+ ***************
+ *** 621,628 ****
+ --- 632,641 ----
+   	execute(t->t_dcar, _gv.wanttty, pipein, pv);
+   	t->t_dcdr->t_dflg |= F_PIPEIN | (t->t_dflg &
+   			(F_PIPEOUT | F_AMPERSAND | F_NOFORK | F_NOINTERRUPT));
+ + # ifndef __MINT__
+   	if (_gv.wanttty > 0)
+   	    _gv.wanttty = 0;	/* got tty already */
+ + # endif
+   	execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
+   #endif /* BACKPIPE */
+   	break;
+ ***************
+ *** 795,812 ****
+ --- 808,839 ----
+   	    (void) dmove(fd, 0);
+   	}
+   	else if (flags & F_PIPEIN) {
+ + #ifdef __MINT__
+ +             (void) dup2(pipein[0], 0);
+ + #else
+   	    (void) close(0);
+   	    (void) dup(pipein[0]);
+ + #endif
+   	    (void) close(pipein[0]);
+   	    (void) close(pipein[1]);
+   	}
+   	else if ((flags & F_NOINTERRUPT) && tpgrp == -1) {
+ + #ifdef __MINT__
+ +             int fd = open(_PATH_DEVNULL, O_RDONLY);
+ +             (void) dup2(fd, 0);
+ +             (void) close(fd);
+ + #else
+   	    (void) close(0);
+   	    (void) open(_PATH_DEVNULL, O_RDONLY);
+ + #endif
+   	}
+   	else {
+ + #ifdef __MINT__
+ +             (void) dup2(OLDSTD, 0);
+ + #else
+   	    (void) close(0);
+   	    (void) dup(OLDSTD);
+ + #endif
+   #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
+   	    /*
+   	     * PWP: Unlike Bezerkeley 4.3, FIONCLEX for Pyramid is preserved
+ ***************
+ *** 853,865 ****
+ --- 880,900 ----
+   	is1atty = isatty(1);
+       }
+       else if (flags & F_PIPEOUT) {
+ + #ifdef __MINT__
+ +         (void) dup2(pipeout[1], 1);
+ + #else
+   	(void) close(1);
+   	(void) dup(pipeout[1]);
+ + #endif
+   	is1atty = 0;
+       }
+       else {
+ + #ifdef __MINT__
+ +         (void) dup2(SHOUT, 1);
+ + #else
+   	(void) close(1);
+   	(void) dup(SHOUT);
+ + #endif
+   	is1atty = isoutatty;
+   # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
+   	(void) close_on_exec(1, 0);
+ ***************
+ *** 868,878 ****
+ --- 903,921 ----
+   
+       (void) close(2);
+       if (flags & F_STDERR) {
+ + #ifdef __MINT__
+ +         (void) dup2(1, 2);
+ + #else
+   	(void) dup(1);
+ + #endif
+   	is2atty = is1atty;
+       }
+       else {
+ + #ifdef __MINT__
+ +         (void) dup2(SHDIAG, 2);
+ + #else
+   	(void) dup(SHDIAG);
+ + #endif
+   	is2atty = isdiagatty;
+   # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
+   	(void) close_on_exec(2, 0);
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,set.c ./sh,set.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,set.c	Tue Nov 24 13:04:22 1992
+ --- ./sh,set.c	Fri Feb 26 02:42:28 1993
+ ***************
+ *** 54,59 ****
+ --- 54,62 ----
+   static	struct varent	*madrof		__P((Char *, struct varent *));
+   static	void		 unsetv1	__P((struct varent *));
+   static	void		 exportpath	__P((Char **));
+ + #ifdef __MINT__
+ + static  void             exportsuffixes __P((Char **));
+ + #endif
+   static	void		 balance	__P((struct varent *, int, int));
+   
+   /*
+ ***************
+ *** 68,73 ****
+ --- 71,82 ----
+   	exportpath(adrof(STRpath)->vec);
+   	dohash(NULL, NULL);
+       }
+ + #ifdef __MINT__
+ +     else if (eq(vp, STRsuffixes)) {
+ +         exportsuffixes(adrof(STRsuffixes)->vec);
+ +         dohash(NULL, NULL);
+ +     }
+ + #endif
+       else if (eq(vp, STRhistchars)) {
+   	register Char *pn = value(vp);
+   
+ ***************
+ *** 418,424 ****
+       }
+       else {
+   	num = 4;		/* confuse lint */
+ ! 	if (sizeof(int) == num && ((unsigned int) n) == 2147483648) {
+   	    *putp++ = '2';
+   	    n = 147483648;
+   	}
+ --- 427,433 ----
+       }
+       else {
+   	num = 4;		/* confuse lint */
+ ! 	if (sizeof(int) == num && ((unsigned int) n) == 2147483648U) {
+   	    *putp++ = '2';
+   	    n = 147483648;
+   	}
+ ***************
+ *** 730,735 ****
+ --- 739,768 ----
+   	}
+       tsetenv(STRKPATH, exppath);
+   }
+ + 
+ + #ifdef __MINT__
+ + static void
+ + exportsuffixes(val)
+ +     Char  **val;
+ + {
+ +     Char    expsuff[BUFSIZE];
+ +     static Char STRcomma[] = { ',' , '\0' };
+ + 
+ +     expsuff[0] = 0;
+ +     if (val)
+ +         while (*val) {
+ +             if (Strlen(*val) + Strlen(expsuff) + 2 > BUFSIZE) {
+ +                 xprintf("Warning: ridiculously long SUFFIXES truncated\n");
+ +                 break;
+ +             }
+ +             (void) Strcat(expsuff, *val++);
+ +             if (*val == 0 || eq(*val, STRRparen))
+ +                 break;
+ +             (void) Strcat(expsuff, STRcomma);
+ +         }
+ +     Setenv(STRSUFFIXES, expsuff);
+ + }
+ + #endif /* __MINT__ */
+   
+   #ifndef lint
+    /*
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,time.c ./sh,time.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,time.c	Tue Nov 24 13:04:22 1992
+ --- ./sh,time.c	Fri Feb 26 02:46:54 1993
+ ***************
+ *** 178,183 ****
+ --- 178,184 ----
+   {
+       tvadd(&ru->ru_utime, &ru2->ru_utime);
+       tvadd(&ru->ru_stime, &ru2->ru_stime);
+ + #ifndef __MINT__
+       if (ru2->ru_maxrss > ru->ru_maxrss)
+   	ru->ru_maxrss = ru2->ru_maxrss;
+   
+ ***************
+ *** 194,199 ****
+ --- 195,201 ----
+       ru->ru_nsignals += ru2->ru_nsignals;
+       ru->ru_nvcsw += ru2->ru_nvcsw;
+       ru->ru_nivcsw += ru2->ru_nivcsw;
+ + #endif
+   }
+   
+   #else /* BSDTIMES */
+ ***************
+ *** 325,331 ****
+ --- 327,337 ----
+       int     ms =
+       (e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
+   
+ + # ifdef __MINT__
+ +     cp = "%Uu %Ss %E %P";
+ + # else
+       cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
+ + # endif
+   #else
+   # ifdef _SEQUENT_
+       int     ms =
+ ***************
+ *** 416,422 ****
+   		xprintf("%ld.%01ld%%", i / 10, i % 10);	/* nn.n% */
+   		break;
+   
+ ! #ifdef BSDTIMES
+   	    case 'W':		/* number of swaps */
+   		i = r1->ru_nswap - r0->ru_nswap;
+   		xprintf("%ld", i);
+ --- 422,428 ----
+   		xprintf("%ld.%01ld%%", i / 10, i % 10);	/* nn.n% */
+   		break;
+   
+ ! #if defined(BSDTIMES) && !defined(__MINT__)
+   	    case 'W':		/* number of swaps */
+   		i = r1->ru_nswap - r0->ru_nswap;
+   		xprintf("%ld", i);
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,types.h ./sh,types.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh,types.h	Tue Nov 24 13:04:34 1992
+ --- ./sh,types.h	Fri Feb 26 02:48:12 1993
+ ***************
+ *** 447,452 ****
+ --- 447,460 ----
+   #endif /* convex */
+   
+   /*
+ +  * MiNT
+ +  */
+ + #ifdef __MINT__
+ + # define _SIGMASK_T
+ + typedef long sigmask_t;
+ + #endif
+ + 
+ + /*
+    * Alliant FX-2800/FX-80
+    */
+   #ifdef alliant
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh.c ./sh.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh.c	Tue Nov 24 13:04:16 1992
+ --- ./sh.c	Sun Mar  7 17:43:04 1993
+ ***************
+ *** 118,123 ****
+ --- 118,128 ----
+   static	void		  mailchk	__P((void));
+   static	Char	 	**defaultpath	__P((void));
+   
+ + #ifdef __MINT__
+ + static  Char            **defaultsuffixes __P((void));
+ + void    importsuffixes  __P((Char *));
+ + #endif
+ + 
+   int
+   main(argc, argv)
+       int     argc;
+ ***************
+ *** 229,234 ****
+ --- 234,249 ----
+   	loginsh = (argc == 1 && getppid() == 1);
+   #endif /* _VMS_POSIX */
+   
+ + #ifdef __MINT__
+ +     /* under MiNT, we're also a login shell if we ran from the desktop and
+ +      * have no arguments
+ +      */
+ +     if (!loginsh && tempv[0][0] == 0 && !tempv[1]) {
+ +         loginsh = 1;
+ +         tempv[0] = "-tcsh";
+ +     }
+ + #endif
+ + 
+       if (loginsh && **tempv != '-') {
+   	/*
+   	 * Mangle the argv space
+ ***************
+ *** 373,379 ****
+       if (loginsh || (uid == 0)) {
+   	if (*cp) {
+   	    /* only for login shells or root and we must have a tty */
+ ! 	    if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) {
+   		cp = cp2 + 1;
+   	    }
+   	    if (!((Strncmp(cp, STRtty, 3) == 0) &&
+ --- 388,394 ----
+       if (loginsh || (uid == 0)) {
+   	if (*cp) {
+   	    /* only for login shells or root and we must have a tty */
+ ! 	    if ((cp2 = Lastslash(cp)) != NULL) {
+   		cp = cp2 + 1;
+   	    }
+   	    if (!((Strncmp(cp, STRtty, 3) == 0) &&
+ ***************
+ *** 535,540 ****
+ --- 550,564 ----
+   	 */
+   	importpath(str2short(tcp));
+   
+ + #ifdef __MINT__
+ +     /*
+ +      * set the suffix search list
+ +      */
+ +     if ((tcp = getenv("SUFFIXES")) == NULL)
+ +         set1(STRsuffixes, defaultsuffixes(), &shvhed);
+ +     else
+ +         importsuffixes(SAVE(tcp));
+ + #endif
+   
+       {
+   	/* If the SHELL environment variable ends with "tcsh", set
+ ***************
+ *** 769,774 ****
+ --- 793,808 ----
+        */
+       if (nofile == 0 && argc > 0) {
+   	nofile = open(tempv[0], O_RDONLY);
+ + #ifdef __MINT__
+ +         /* maybe the user tried to execute "foo.csh" as just "foo"
+ +          */
+ +         if (nofile < 0) {
+ +             char *cshfile = alloca(strlen(tempv[0]) + 5);
+ +             strcpy(cshfile, tempv[0]);
+ +             strcat(cshfile, ".csh");
+ +             nofile = open(cshfile, O_RDONLY);
+ +         }
+ + #endif
+   	if (nofile < 0) {
+   	    child = 1;		/* So this ... */
+   	    /* ... doesn't return */
+ ***************
+ *** 1165,1171 ****
+   srccat(cp, dp)
+       Char   *cp, *dp;
+   {
+ !     if (cp[0] == '/' && cp[1] == '\0') 
+   	return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
+       else {
+   	register Char *ep = Strspl(cp, dp);
+ --- 1199,1205 ----
+   srccat(cp, dp)
+       Char   *cp, *dp;
+   {
+ !     if (is_dirsep(cp[0]) && cp[1] == '\0') 
+   	return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
+       else {
+   	register Char *ep = Strspl(cp, dp);
+ ***************
+ *** 1952,1957 ****
+ --- 1986,1995 ----
+   #endif
+       int     i;
+   {
+ + #ifdef __MINT__
+ +     void rm_tmpfiles();
+ +     rm_tmpfiles();                      /* remove temporary files, see below */
+ + #endif
+   #ifdef TESLA
+       if (loginsh && do_logout) {
+   	/* this is to send hangup signal to the develcon */
+ ***************
+ *** 2018,2020 ****
+ --- 2056,2196 ----
+       *blkp = NULL;
+       return (blk);
+   }
+ + 
+ + #ifdef __MINT__
+ + /*
+ +  * unlink() doesn't always work on an open file, so we try to arrange
+ +  * to remove temporary files (e.g. for here documents) before exiting.
+ +  */
+ + 
+ + struct tmpfile_rec {
+ +         char *name;     /* the name of the temp. file */
+ +         int pid;        /* the associated pid */
+ +         struct tmpfile_rec *next;
+ + } *root;
+ + 
+ + extern int __mint;
+ + 
+ + int
+ + csh_tmpfile()
+ + {
+ +         extern char *tmpnam();
+ +         struct tmpfile_rec *u;
+ +         int fd;
+ +         char *name;
+ + 
+ +         if ( !(name = tmpnam((char *)0)) )
+ +                 return -1;
+ + 
+ +         fd = open(name, O_CREAT|O_EXCL|O_RDWR, 0600);
+ +         if (fd < 0) {
+ +                 free(name);
+ +                 return -1;
+ +         }
+ + 
+ + /* in MiNT 0.9 and above, we can often unlink a file and continue to use
+ +  * it; some file systems may return EACCDN for unlinking an open file,
+ +  * in which case we use the old method of unlinking the file at exit
+ +  */
+ +         if (__mint >= 9) {
+ +                 if (unlink(name) == 0)
+ +                         return fd;
+ +         }
+ + 
+ + /* if the unlink failed, save the name for future deleting */
+ + 
+ +         u = (struct tmpfile_rec *)malloc(sizeof(*u));
+ +         if (!u) {
+ + /* would it be better to fail? I dunno, but at worst the user is left
+ +  * with a junk file in a temporary directory
+ +  */
+ +                 return fd;
+ +         }
+ + 
+ +         u->name = name;
+ +         u->pid = getpid();
+ +         u->next = root;
+ +         root = u;
+ +         return fd;
+ + }
+ + 
+ + void
+ + rm_tmpfiles()
+ + {
+ +         int pid = getpid();
+ +         struct tmpfile_rec **old, *u;
+ + 
+ +         old = &root;
+ +         u = root;
+ +         while (u) {
+ +                 if (u->pid == pid) {
+ +                         (void) unlink(u->name);
+ +                         *old = u->next;
+ +                 } else {
+ +                         old = &u->next;
+ +                 }
+ +                 u = u->next;
+ +         }
+ + }
+ + 
+ + /* MiNT suffix stuff
+ +  */
+ + 
+ + void
+ + importsuffixes(cp)
+ +     Char   *cp;
+ + {
+ +     register int i = 0;
+ +     register Char *dp;
+ +     register Char **pv;
+ +     int     c;
+ + 
+ +     for (dp = cp; *dp; dp++)
+ +         if (*dp == ',')
+ +             i++;
+ +     /*
+ +      * i+2 where i is the number of ',' in the suffix list. There are i+1
+ +      * suffixes plus we need room for a zero terminator.
+ +      */
+ +     pv = (Char **) xcalloc((size_t) (i + 2), sizeof(Char *));
+ +     dp = cp;
+ +     i = 0;
+ +     if (*dp)
+ +         for (;;) {
+ +             if ((c = *dp) == ',' || c == 0) {
+ +                 *dp = 0;
+ +                 pv[i++] = Strsave(cp);
+ +                 if (c) {
+ +                     cp = dp + 1;
+ +                     *dp = ',';
+ +                 }
+ +                 else
+ +                     break;
+ +             }
+ +             dp++;
+ +         }
+ +     pv[i] = 0;
+ +     set1(STRsuffixes, pv, &shvhed);
+ + }
+ + 
+ + static Char **
+ + defaultsuffixes()
+ + {
+ +     Char  **blk, **blkp;
+ + 
+ +     blkp = blk = (Char **) xmalloc((size_t) sizeof(Char *) * 9);
+ + 
+ +     *blkp++ = SAVE("ttp");
+ +     *blkp++ = SAVE("prg");
+ +     *blkp++ = SAVE("tos");
+ +     *blkp++ = SAVE("app");
+ +     *blkp++ = SAVE("gtp");
+ +     *blkp++ = SAVE("csh");
+ +     *blkp++ = SAVE("");
+ +     *blkp = NULL;
+ + 
+ +     return (blk);
+ + }
+ + 
+ + #endif /* __MINT__ */
+ + 
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh.h ./sh.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/sh.h	Tue Nov 24 13:04:24 1992
+ --- ./sh.h	Fri Feb 26 01:46:40 1993
+ ***************
+ *** 177,183 ****
+   #ifdef _SEQUENT_
+   # include <sys/procstats.h>
+   #endif /* _SEQUENT_ */
+ ! #if defined(POSIX) || SYSVREL > 0
+   # include <sys/times.h>
+   #endif /* POSIX || SYSVREL > 0 */
+   
+ --- 177,183 ----
+   #ifdef _SEQUENT_
+   # include <sys/procstats.h>
+   #endif /* _SEQUENT_ */
+ ! #if defined(POSIX) || SYSVREL > 0 || defined(__MINT__)
+   # include <sys/times.h>
+   #endif /* POSIX || SYSVREL > 0 */
+   
+ ***************
+ *** 190,195 ****
+ --- 190,199 ----
+   #endif /* _MINIX && vmsposix atp */
+   #include <sys/stat.h>
+   
+ + #ifdef __MINT__
+ + #include <support.h>
+ + #endif
+ + 
+   #if defined(BSDTIMES) || defined(BSDLIMIT)
+   # include <sys/time.h>
+   # if SYSVREL>3 && !defined(sgi)
+ ***************
+ *** 223,229 ****
+   # include <sys/ttold.h>
+   #endif /* sonyrisc */
+   
+ ! #ifdef POSIX
+   /*
+    * We should be using setpgid and setpgid
+    * by now, but in some systems we use the
+ --- 227,233 ----
+   # include <sys/ttold.h>
+   #endif /* sonyrisc */
+   
+ ! #if defined(POSIX) || defined(__MINT__)
+   /*
+    * We should be using setpgid and setpgid
+    * by now, but in some systems we use the
+ ***************
+ *** 289,294 ****
+ --- 293,305 ----
+   
+   #include <errno.h>
+   
+ + #ifdef __MINT__
+ + /* undef E_SEEK from errno.h */
+ + # undef E_SEEK
+ + # define ENOTDIR EPATH
+ + # define ESPIPE EINVAL
+ + #endif
+ + 
+   #include <setjmp.h>
+   
+   #if __STDC__
+ ***************
+ *** 353,358 ****
+ --- 364,384 ----
+   # endif 
+   #endif 
+   
+ + #ifndef DOSFS
+ + # define is_dirsep(c)   ((c) == '/')
+ + # define is_abspath(p)  (is_dirsep(*(p)))
+ + # define lastslash(p)   (strrchr((p), '/'))
+ + # define Lastslash(p)   (Strrchr((p), '/'))
+ + # define has_slash(p)   (any((p), '/'))
+ + # define Has_slash(p)   (Strrchr((p), '/'))
+ + #else
+ + extern int      is_dirsep       __P((int));
+ + extern int      is_abspath      __P((Char *));
+ + extern char *   lastslash       __P((char *));
+ + extern Char *   Lastslash       __P((Char *));
+ + extern int      has_slash       __P((char *));
+ + extern int      Has_slash       __P((Char *));
+ + #endif
+   
+   typedef int bool;
+   
+ Only in .: sldiffs
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,alloc.c ./tc,alloc.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,alloc.c	Tue Nov 24 13:04:32 1992
+ --- ./tc,alloc.c	Fri Feb 26 02:57:12 1993
+ ***************
+ *** 53,58 ****
+ --- 53,65 ----
+   
+   #ifndef SYSMALLOC
+   
+ + #ifdef __MINT__
+ + /* need large stack because we alloc from stack (cause tcsh assumes
+ +  * continuus memory which MiNT does not provide)
+ +  */
+ + long _stksize = -128*1024L;
+ + #endif
+ + 
+   #undef RCHECK
+   #undef DEBUG
+   
+ ***************
+ *** 244,253 ****
+ --- 251,262 ----
+       memtop = (char *) op;
+       if (membot == NULL)
+   	membot = memtop;
+ + #ifndef __MINT__
+       if ((int) op & 0x3ff) {
+   	memtop = (char *) sbrk(1024 - ((int) op & 0x3ff));
+   	memtop += 1024 - ((int) op & 0x3ff);
+       }
+ + #endif
+   
+       /* take 2k unless the block is bigger than that */
+       rnu = (bucket <= 8) ? 11 : bucket + 3;
+ ***************
+ *** 469,475 ****
+   
+       n = n ? n : 1;
+   
+ ! #ifndef _VMS_POSIX
+       if (membot == NULL)
+   	membot == (char*) sbrk(0);
+   #endif /* !_VMS_POSIX */
+ --- 478,484 ----
+   
+       n = n ? n : 1;
+   
+ ! #if !defined(_VMS_POSIX) && !defined(__MINT__)
+       if (membot == NULL)
+   	membot == (char*) sbrk(0);
+   #endif /* !_VMS_POSIX */
+ ***************
+ *** 478,484 ****
+   	child++;
+   	stderror(ERR_NOMEM);
+       }
+ ! #ifdef _VMS_POSIX
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ --- 487,493 ----
+   	child++;
+   	stderror(ERR_NOMEM);
+       }
+ ! #if defined(_VMS_POSIX) || defined(__MINT__)
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ ***************
+ *** 496,509 ****
+   
+       n = n ? n : 1;
+   
+       if (membot == NULL)
+   	membot == (char*) sbrk(0);
+   
+       if ((ptr = (p ? realloc(p, n) : malloc(n))) == (ptr_t) 0) {
+   	child++;
+   	stderror(ERR_NOMEM);
+       }
+ ! #ifdef _VMS_POSIX
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ --- 505,520 ----
+   
+       n = n ? n : 1;
+   
+ + #ifndef __MINT__
+       if (membot == NULL)
+   	membot == (char*) sbrk(0);
+ + #endif
+   
+       if ((ptr = (p ? realloc(p, n) : malloc(n))) == (ptr_t) 0) {
+   	child++;
+   	stderror(ERR_NOMEM);
+       }
+ ! #if defined(_VMS_POSIX) || defined(__MINT__)
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ ***************
+ *** 522,529 ****
+ --- 533,542 ----
+       n *= s;
+       n = n ? n : 1;
+   
+ + #ifndef __MINT__
+       if (membot == NULL)
+   	membot == (char*) sbrk(0);
+ + #endif
+   
+       if ((ptr = malloc(n)) == (ptr_t) 0) {
+   	child++;
+ ***************
+ *** 536,542 ****
+   	    *sptr++ = 0;
+   	while (--n);
+   
+ ! #ifdef _VMS_POSIX
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ --- 549,555 ----
+   	    *sptr++ = 0;
+   	while (--n);
+   
+ ! #if defined(_VMS_POSIX) || defined(__MINT__)
+       if (memtop < ((char *) ptr) + n)
+   	memtop = ((char *) ptr) + n;
+       if (membot == NULL)
+ ***************
+ *** 592,598 ****
+   	    (unsigned long) membot, (unsigned long) memtop,
+   	    (unsigned long) sbrk(0));
+   #else
+ ! #ifndef _VMS_POSIX
+       memtop = (char *) sbrk(0);
+   #endif /* !_VMS_POSIX */
+       xprintf("Allocated memory from 0x%lx to 0x%lx (%ld).\n",
+ --- 605,611 ----
+   	    (unsigned long) membot, (unsigned long) memtop,
+   	    (unsigned long) sbrk(0));
+   #else
+ ! #if !defined(_VMS_POSIX) && !defined(__MINT__)
+       memtop = (char *) sbrk(0);
+   #endif /* !_VMS_POSIX */
+       xprintf("Allocated memory from 0x%lx to 0x%lx (%ld).\n",
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,const.c ./tc,const.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,const.c	Tue Nov 24 13:04:32 1992
+ --- ./tc,const.c	Fri Feb 26 03:11:00 1993
+ ***************
+ *** 77,91 ****
+ --- 77,101 ----
+   Char STRhistfile[] 	= { 'h', 'i', 's', 't', 'f', 'i', 'l', 'e', '\0' };
+   Char STRsource[]        = { 's', 'o', 'u', 'r', 'c', 'e', '\0' };
+   Char STRmh[]            = { '-', 'h', '\0' };
+ + #ifndef DOSFS
+   Char STRtildothist[]    = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r', 
+   		            'y', '\0' };
+ + #else
+ + Char STRtildothist[]    = { '~', '/', 'h', 'i', 's', 't', 'o', 'r', 'y',
+ +                             '.', 'c', 's', 'h', '\0' };
+ + #endif
+   
+   #ifdef KANJI
+   Char STRnokanji[]       = { 'n', 'o', 'k', 'a', 'n', 'j', 'i', '\0' };
+   #endif
+   
+ + #ifndef DOSFS
+   Char STRtildotdirs[]    = { '~', '/', '.', 'c', 's', 'h', 'd', 'i', 'r',
+   			    's', '\0' };
+ + #else
+ + Char STRtildotdirs[]    = { '~', '/', 'c', 's', 'h', 'd', 'i', 'r', 's',
+ +                             '.', 'c', 's', 'h', '\0' };
+ + #endif
+   Char STRdirsfile[]      = { 'd', 'i', 'r', 's', 'f', 'i', 'l', 'e', '\0' };
+   Char STRsavedirs[]      = { 's', 'a', 'v', 'e', 'd', 'i', 'r', 's', '\0' };
+   Char STRloginsh[]       = { 'l', 'o', 'g', 'i', 'n', 's', 'h', '\0' };
+ ***************
+ *** 93,99 ****
+ --- 103,114 ----
+   Char STRargv[]          = { 'a', 'r', 'g', 'v', '\0' };
+   Char STRsavehist[]      = { 's', 'a', 'v', 'e', 'h', 'i', 's', 't', '\0' };
+   Char STRnormal[]        = { 'n', 'o', 'r', 'm', 'a', 'l', '\0' };
+ + #ifndef DOSFS
+   Char STRsldtlogout[]    = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' };
+ + #else
+ + Char STRsldtlogout[]    = { '/', 'l', 'o', 'g', 'o', 'u', 't', '.', 'c', 's',
+ +                             'h', '\0' };
+ + #endif
+   Char STRjobs[]          = { 'j', 'o', 'b', 's', '\0' };
+   Char STRsymhash[]       = { '#', ' ', '\0' };
+   Char STRsymarrow[]      = { '>', ' ', '\0' };
+ ***************
+ *** 197,205 ****
+ --- 212,230 ----
+   Char STRwatch[]		= { 'w', 'a', 't', 'c', 'h', '\0' };
+   #endif /* HAVENOUTMP */
+   
+ + #ifndef DOSFS
+   Char STRsldottcshrc[]	= { '/', '.', 't', 'c', 's', 'h', 'r', 'c', '\0' };
+   Char STRsldotcshrc[]	= { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' };
+   Char STRsldotlogin[]	= { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
+ + #else
+ + Char STRsldottcshrc[]   = { '/', 't', 'c', 's', 'h', 'r', 'c', '.', 'c',
+ +                             's', 'h', '\0' };
+ + Char STRsldotcshrc[]    = { '/', 'c', 's', 'h', 'r', 'c', '.', 'c', 's',
+ +                             'h', '\0' };
+ + Char STRsldotlogin[]    = { '/', 'l', 'o', 'g', 'i', 'n', '.', 'c', 's',
+ +                             'h', '\0' };
+ + #endif
+ + 
+   Char STRignoreeof[]	= { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
+   Char STRnoclobber[]	= { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
+   Char STRhelpcommand[]	= { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n', 
+ ***************
+ *** 284,286 ****
+ --- 309,317 ----
+   Char STRdown[] = { 'd', 'o', 'w', 'n', '\0' };
+   Char STRleft[] = { 'l', 'e', 'f', 't', '\0' };
+   Char STRright[] = { 'r', 'i', 'g', 'h', 't', '\0' };
+ + 
+ + #ifdef __MINT__
+ + Char STRsuffixes[] = { 's', 'u', 'f', 'f', 'i', 'x', 'e', 's', '\0' };
+ + Char STRSUFFIXES[] = { 'S', 'U', 'F', 'F', 'I', 'X', 'E', 'S', '\0' };
+ + #endif
+ + 
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,func.c ./tc,func.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,func.c	Tue Nov 24 13:04:32 1992
+ --- ./tc,func.c	Fri Feb 26 03:18:42 1993
+ ***************
+ *** 276,282 ****
+   	for (k = 0, i = 0; v[k] != NULL; k++) {
+   	    tmp = dnormalize(v[k], symlinks == SYM_IGNORE);
+   	    dp = &tmp[Strlen(tmp) - 1];
+ ! 	    if (*dp == '/' && dp != tmp)
+   #ifdef apollo
+   		if (dp != &tmp[1])
+   #endif /* apollo */
+ --- 276,282 ----
+   	for (k = 0, i = 0; v[k] != NULL; k++) {
+   	    tmp = dnormalize(v[k], symlinks == SYM_IGNORE);
+   	    dp = &tmp[Strlen(tmp) - 1];
+ ! 	    if (is_dirsep(*dp) && dp != tmp)
+   #ifdef apollo
+   		if (dp != &tmp[1])
+   #endif /* apollo */
+ ***************
+ *** 303,309 ****
+ --- 303,313 ----
+   		xprintf("%S:\n", tmp);
+   		for (cp = tmp, dp = buf; *cp; *dp++ = (*cp++ | QUOTE))
+   		    continue;
+ + #if 0
+   		if (dp[-1] != (Char) ('/' | QUOTE))
+ + #else
+ +                 if (! ((dp[-1] & QUOTE) && is_dirsep(dp[-1] & ~QUOTE)))
+ + #endif
+   		    *dp++ = '/';
+   		else 
+   		    dp[-1] &= TRIM;
+ ***************
+ *** 435,441 ****
+       int     epl, vpl;
+   
+       if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
+ ! 	if ((p = strrchr(ep, '/')) != NULL) 	/* if it has a path */
+   	    ep = p + 1;		/* then we want only the last part */
+       }
+       else 
+ --- 439,445 ----
+       int     epl, vpl;
+   
+       if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
+ ! 	if ((p = lastslash(ep)) != NULL) 	/* if it has a path */
+   	    ep = p + 1;		/* then we want only the last part */
+       }
+       else 
+ ***************
+ *** 442,448 ****
+   	ep = "ed";
+   
+       if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
+ ! 	if ((p = strrchr(vp, '/')) != NULL) 	/* and it has a path */
+   	    vp = p + 1;		/* then we want only the last part */
+       }
+       else 
+ --- 446,452 ----
+   	ep = "ed";
+   
+       if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
+ ! 	if ((p = lastslash(vp)) != NULL) 	/* and it has a path */
+   	    vp = p + 1;		/* then we want only the last part */
+       }
+       else 
+ ***************
+ *** 462,468 ****
+   		continue;
+   	    *cp = '\0';
+   		
+ ! 	    if ((cp = strrchr(p, '/')) != NULL)	/* and it has a path */
+   		cp = cp + 1;		/* then we want only the last part */
+   	    else
+   		cp = p;			/* else we get all of it */
+ --- 466,472 ----
+   		continue;
+   	    *cp = '\0';
+   		
+ ! 	    if ((cp = lastslash(p)) != NULL)	/* and it has a path */
+   		cp = cp + 1;		/* then we want only the last part */
+   	    else
+   		cp = p;			/* else we get all of it */
+ ***************
+ *** 1405,1417 ****
+       }
+       if (((h = value(STRhome)) != STRNULL) &&
+   	(Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
+ ! 	(p[j] == '/' || p[j] == '\0')) {
+   	*hm = &p[j];
+   	return STRNULL;
+       }
+       for (i = 0; i < tlength; i++)
+   	if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
+ ! 	    (p[j] == '/' || p[j] == '\0')) {
+   	    *hm = &p[j];
+   	    return tcache[i].user;
+   	}
+ --- 1409,1421 ----
+       }
+       if (((h = value(STRhome)) != STRNULL) &&
+   	(Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
+ ! 	(is_dirsep(p[j]) || p[j] == '\0')) {
+   	*hm = &p[j];
+   	return STRNULL;
+       }
+       for (i = 0; i < tlength; i++)
+   	if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
+ ! 	    (is_dirsep(p[j]) || p[j] == '\0')) {
+   	    *hm = &p[j];
+   	    return tcache[i].user;
+   	}
+ ***************
+ *** 1471,1478 ****
+ --- 1475,1490 ----
+   
+   		    if ((n = read(fd, tbuf, BUFSIZE)) <= 0)
+   			goto eof;
+ + #ifdef DOSTEXT
+ +         /* we probably should strip the carriage returns, but
+ +          * changing them to blanks will work just as well for most cases
+ +          */
+ +                     for (i = 0; i < n; i++)
+ +                         buf[i] = (tbuf[i] == '\r') ? ' ' : tbuf[i];
+ + #else
+   		    for (i = 0; i < n; i++)
+   			buf[i] = tbuf[i];
+ + #endif
+   		    p = buf;
+   		}
+   		n--;
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,os.c ./tc,os.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,os.c	Tue Nov 24 13:04:32 1992
+ --- ./tc,os.c	Fri Feb 26 03:21:36 1993
+ ***************
+ *** 1036,1042 ****
+   	/* look if we found root yet */
+   	if (st_cur.st_ino == st_root.st_ino &&
+   	    DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
+ ! 	    (void) strcpy(pathname, *pathptr != '/' ? "/" : pathptr);
+   	    return (pathname);
+   	}
+   
+ --- 1036,1042 ----
+   	/* look if we found root yet */
+   	if (st_cur.st_ino == st_root.st_ino &&
+   	    DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
+ ! 	    (void) strcpy(pathname, !is_dirsep(*pathptr) ? "/" : pathptr);
+   	    return (pathname);
+   	}
+   
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,os.h ./tc,os.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,os.h	Tue Nov 24 13:04:32 1992
+ --- ./tc,os.h	Fri Feb 26 03:24:24 1993
+ ***************
+ *** 479,484 ****
+ --- 479,485 ----
+   extern int qsort();
+   # endif
+   #else
+ + # ifndef __MINT__
+   # ifndef hpux
+   #  if __GNUC__ != 2
+   extern int abort();
+ ***************
+ *** 490,495 ****
+ --- 491,497 ----
+   extern void abort();
+   extern void qsort();
+   # endif
+ + # endif /* !__MINT__ */
+   #endif	/* SUNOS4 */
+   extern void perror();
+   
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,promp.c ./tc,promp.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,promp.c	Tue Nov 24 13:04:34 1992
+ --- ./tc,promp.c	Fri Feb 26 03:28:40 1993
+ ***************
+ *** 303,309 ****
+   		    else {
+   			if ((scp != 'C') && (q = value(STRhome)) != STRNULL &&
+   			    Strncmp(buff, q, (k = Strlen(q))) == 0 &&
+ ! 			    (buff[k] == '/' || buff[k] == '\0')) {
+   			    buff[--k] = '~';
+   			    q = &buff[k];
+   			    /* RWM - reset the path length */
+ --- 303,309 ----
+   		    else {
+   			if ((scp != 'C') && (q = value(STRhome)) != STRNULL &&
+   			    Strncmp(buff, q, (k = Strlen(q))) == 0 &&
+ ! 			    (is_dirsep(buff[k]) || buff[k] == '\0')) {
+   			    buff[--k] = '~';
+   			    q = &buff[k];
+   			    /* RWM - reset the path length */
+ ***************
+ *** 312,322 ****
+   			else {
+   			    q = buff;
+   			    /* RWM - in case first char is not '/' */
+ ! 			    if (*q == '/') updirs = 0; else updirs = 1;
+   			}
+   			/* RWM - calculate elements in the path */
+   			for (z = q; *z; z++) {
+ ! 			    if (*z == '/') updirs++;
+   			    continue;	/* find the end */
+   			}
+   			/* RWM - the ones we will skip can be found here */
+ --- 312,322 ----
+   			else {
+   			    q = buff;
+   			    /* RWM - in case first char is not '/' */
+ ! 			    if (is_abspath(q)) updirs = 0; else updirs = 1;
+   			}
+   			/* RWM - calculate elements in the path */
+   			for (z = q; *z; z++) {
+ ! 			    if (is_dirsep(*z)) updirs++;
+   			    continue;	/* find the end */
+   			}
+   			/* RWM - the ones we will skip can be found here */
+ ***************
+ *** 323,334 ****
+   			updirs -= j;
+   			
+   			while (j-- > 0) {
+ ! 			    while ((z > q) && (*z != '/'))
+   				z--;	/* back up */
+   			    if (j && z > q)
+   				z--;
+   			}
+ ! 			if (*z == '/' && z != q)
+   			    z++;
+   
+   			/* RWM - if *q == '~' and *z != '~' then print */
+ --- 323,334 ----
+   			updirs -= j;
+   			
+   			while (j-- > 0) {
+ ! 			    while ((z > q) && (!is_dirsep(*z)))
+   				z--;	/* back up */
+   			    if (j && z > q)
+   				z--;
+   			}
+ ! 			if (is_dirsep(*z) && z != q)
+   			    z++;
+   
+   			/* RWM - if *q == '~' and *z != '~' then print */
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,sig.c ./tc,sig.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,sig.c	Tue Nov 24 13:04:34 1992
+ --- ./tc,sig.c	Fri Feb 26 03:33:50 1993
+ ***************
+ *** 410,412 ****
+ --- 410,433 ----
+       Synch_Cnt++;
+   }
+   #endif /* SIGSYNCH */
+ + 
+ + #ifdef __MINT__
+ + /* MiNT has most BSD signal things, but not sigvec; punt */
+ + void
+ + mysigvec(sig, new, old)
+ +         int sig;
+ +         sigvec_t *new, *old;
+ + {
+ +         void (*oldhandler)();
+ + 
+ +         if (new) {
+ +                 oldhandler = signal(sig, new->sv_handler);
+ +         } else {
+ +                 oldhandler = signal(sig, SIG_IGN);
+ +                 signal(sig, oldhandler);
+ +         }
+ +         if (old)
+ +                 old->sv_handler = oldhandler;
+ + }
+ + #endif /* __MINT__ */
+ + 
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,sig.h ./tc,sig.h
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tc,sig.h	Tue Nov 24 13:04:34 1992
+ --- ./tc,sig.h	Fri Feb 26 03:31:38 1993
+ ***************
+ *** 77,82 ****
+ --- 77,90 ----
+   #  define NEEDsignal
+   # endif /* hpux */
+   
+ + # ifdef __MINT__
+ + #  define HAVE_SIGVEC
+ + typedef struct sigvec {
+ +         sigret_t (*sv_handler)();
+ + } sigvec_t;
+ + extern void mysigvec __P((int, sigvec_t *, sigvec_t *));
+ + #endif /* __MINT__ */
+ + 
+   # ifndef HAVE_SIGVEC
+   #  define mysigvec(a, b, c)	sigvec(a, b, c)
+   typedef struct sigvec sigvec_t;
+ ***************
+ *** 130,139 ****
+ --- 138,149 ----
+   /*
+    * For 4.2bsd signals.
+    */
+ + # ifndef __MINT__
+   # ifdef sigmask
+   #  undef sigmask
+   # endif /* sigmask */
+   # define	sigmask(s)	(1 << ((s)-1))
+ + # endif /* !__MINT__ */
+   # ifdef POSIXSIGS
+   #  define 	sigpause(a)	bsd_sigpause(a)
+   #  define 	signal(a, b)	bsd_signal(a, b)
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,init.c ./tw,init.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,init.c	Tue Nov 24 13:04:26 1992
+ --- ./tw,init.c	Fri Feb 26 03:41:34 1993
+ ***************
+ *** 247,259 ****
+       register Char **pv;
+       struct varent *v = adrof(STRpath);
+       struct varent *recexec = adrof(STRrecognize_only_executables);
+   
+ - 
+       if (v == NULL) /* if no path */
+   	return;
+   
+       for (pv = v->vec; *pv; pv++) {
+ ! 	if (pv[0][0] != '/') {
+   	    tw_cmd_got |= TW_FL_REL;
+   	    continue;
+   	}
+ --- 247,262 ----
+       register Char **pv;
+       struct varent *v = adrof(STRpath);
+       struct varent *recexec = adrof(STRrecognize_only_executables);
+ + #ifdef __MINT__
+ +     struct varent *suffv = adrof(STRsuffixes);
+ +     Char **suffpv;
+ + #endif
+   
+       if (v == NULL) /* if no path */
+   	return;
+   
+       for (pv = v->vec; *pv; pv++) {
+ ! 	if (!is_abspath(pv[0])) {
+   	    tw_cmd_got |= TW_FL_REL;
+   	    continue;
+   	}
+ ***************
+ *** 268,273 ****
+ --- 271,289 ----
+   	    name = str2short(dp->d_name);
+   	    if (dp->d_ino == 0 || (recexec && !executable(dir, name, 0)))
+   		continue;
+ + #ifdef __MINT__
+ +             {   char *s = rindex(name, '.');
+ + 
+ +                 if (s && suffv) {
+ +                     for (suffpv = suffv->vec; *suffpv; suffpv++) {
+ +                         if (!strcmp(s+1, short2str(*suffpv))) {
+ +                             *s = 0; break;
+ +                         }
+ +                     }
+ +                 }
+ +             }
+ + #endif /* __MINT__ */
+ + 
+   	    tw_cmd_add(name);
+   	}
+   	(void) closedir(dirp);
+ ***************
+ *** 421,427 ****
+   
+           CLRDIR(tw_cmd_state.dfd)
+   
+ ! 	while (*tw_cmd_state.pathv && tw_cmd_state.pathv[0][0] == '/')
+   	    tw_cmd_state.pathv++;
+   	if ((ptr = *tw_cmd_state.pathv) != 0) {
+   	    /*
+ --- 437,443 ----
+   
+           CLRDIR(tw_cmd_state.dfd)
+   
+ ! 	while (*tw_cmd_state.pathv && is_abspath(tw_cmd_state.pathv[0]))
+   	    tw_cmd_state.pathv++;
+   	if ((ptr = *tw_cmd_state.pathv) != 0) {
+   	    /*
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,parse.c ./tw,parse.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,parse.c	Tue Nov 24 13:04:26 1992
+ --- ./tw,parse.c	Fri Feb 26 03:50:14 1993
+ ***************
+ *** 261,267 ****
+       case RECOGNIZE:
+       case RECOGNIZE_ALL:
+   	if (adrof(STRautocorrect)) {
+ ! 	    if ((slshp = Strrchr(wordp, '/')) != NULL && slshp[1] != '\0') {
+   		SearchNoDirErr = 1;
+   		for (bptr = wordp; bptr < slshp; bptr++) {
+   		    /*
+ --- 261,267 ----
+       case RECOGNIZE:
+       case RECOGNIZE_ALL:
+   	if (adrof(STRautocorrect)) {
+ ! 	    if ((slshp = Lastslash(wordp)) != NULL && slshp[1] != '\0') {
+   		SearchNoDirErr = 1;
+   		for (bptr = wordp; bptr < slshp; bptr++) {
+   		    /*
+ ***************
+ *** 350,356 ****
+   	items[0] = buffer;
+   	items[1] = NULL;
+   	ptr = items;
+ ! 	count = (looking == TW_COMMAND && Strchr(wordp, '/') == 0) ? 
+   		c_glob(&ptr) : 
+   		t_glob(&ptr, looking == TW_COMMAND);
+   	if (count > 0) {
+ --- 350,356 ----
+   	items[0] = buffer;
+   	items[1] = NULL;
+   	ptr = items;
+ ! 	count = (looking == TW_COMMAND && !Has_slash(wordp)) ? 
+   		c_glob(&ptr) : 
+   		t_glob(&ptr, looking == TW_COMMAND);
+   	if (count > 0) {
+ ***************
+ *** 1156,1162 ****
+   	break;
+   
+       case TW_COMMAND:
+ ! 	if (Strchr(word, '/')) {
+   	    looking = TW_FILE;
+   	    flags |= TW_EXEC_CHK;
+   	    flags |= TW_DIR_OK;
+ --- 1156,1162 ----
+   	break;
+   
+       case TW_COMMAND:
+ ! 	if (Has_slash(word)) {
+   	    looking = TW_FILE;
+   	    flags |= TW_EXEC_CHK;
+   	    flags |= TW_DIR_OK;
+ ***************
+ *** 1197,1208 ****
+        */
+       flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
+   
+ !     if ((*word == '~') && (Strchr(word, '/') == NULL)) {
+   	looking = TW_LOGNAME;
+   	target = name;
+       }
+       else if ((target = Strrchr(name, '$')) != 0 && 
+ ! 	     (Strchr(name, '/') == NULL)) {
+   	target++;
+   	looking = TW_VARIABLE;
+       }
+ --- 1197,1208 ----
+        */
+       flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
+   
+ !     if ((*word == '~') && (! Has_slash(word))) {
+   	looking = TW_LOGNAME;
+   	target = name;
+       }
+       else if ((target = Strrchr(name, '$')) != 0 && 
+ ! 	     (! Has_slash(name))) {
+   	target++;
+   	looking = TW_VARIABLE;
+       }
+ ***************
+ *** 1371,1377 ****
+   {
+       register Char *p;
+   
+ !     p = Strrchr(path, '/');
+       if (p == NULL) {
+   	copyn(name, path, MAXNAMLEN);
+   	dir[0] = '\0';
+ --- 1371,1377 ----
+   {
+       register Char *p;
+   
+ !     p = Lastslash(path);
+       if (p == NULL) {
+   	copyn(name, path, MAXNAMLEN);
+   	dir[0] = '\0';
+ ***************
+ *** 1448,1454 ****
+   
+       switch (old[0]) {
+       case '~':
+ ! 	for (p = new, o = &old[1]; *o && *o != '/'; *p++ = *o++) 
+   	    continue;
+   	*p = '\0';
+   	if (gethdir(new)) {
+ --- 1448,1454 ----
+   
+       switch (old[0]) {
+       case '~':
+ ! 	for (p = new, o = &old[1]; *o && !is_dirsep(*o); *p++ = *o++) 
+   	    continue;
+   	*p = '\0';
+   	if (gethdir(new)) {
+ ***************
+ *** 1516,1525 ****
+   	     */
+   	    for (p = edir; *p; p++)
+   		continue;
+ ! 	    if (*--p == '/') {
+   		for (p = nd; *p; p++)
+   		    continue;
+ ! 		if (*--p != '/')
+   		    p = NULL;
+   	    }
+   	    for (d = edir, s = nd; (*d++ = *s++) != '\0';)
+ --- 1516,1525 ----
+   	     */
+   	    for (p = edir; *p; p++)
+   		continue;
+ ! 	    if (is_dirsep(*--p)) {
+   		for (p = nd; *p; p++)
+   		    continue;
+ ! 		if (!is_dirsep(*--p))
+   		    p = NULL;
+   	    }
+   	    for (d = edir, s = nd; (*d++ = *s++) != '\0';)
+ diff +context /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,spell.c ./tw,spell.c
+ *** /usr/users/staff/hohmuth/tmp/tcsh-6.03/tw,spell.c	Tue Nov 24 13:04:26 1992
+ --- ./tw,spell.c	Fri Feb 26 03:54:20 1993
+ ***************
+ *** 53,60 ****
+       bool    foundslash = 0;
+       int     retval;
+   
+       for (;;) {
+ ! 	while (*old == '/') {	/* skip '/' */
+   	    *new++ = *old++;
+   	    foundslash = 1;
+   	}
+ --- 53,67 ----
+       bool    foundslash = 0;
+       int     retval;
+   
+ + #ifdef DOSFS
+ +     /* skip drive specification, if any */
+ +     if (*old && old[1] == ':' && is_dirsep(old[2])) {
+ +         *new++ = *old++; *new++ = *old++;
+ +     }
+ + #endif
+ + 
+       for (;;) {
+ ! 	while (is_dirsep(*old)) {	/* skip '/' */
+   	    *new++ = *old++;
+   	    foundslash = 1;
+   	}
+ ***************
+ *** 73,79 ****
+   		if (p < guess + FILSIZ)
+   		    *p++ = *cp;
+   	ws = p;
+ ! 	for (; *old != '/' && *old != '\0'; old++)/* add current file name */
+   	    if (p < guess + FILSIZ)
+   		*p++ = *old;
+   	*p = '\0';		/* terminate it */
+ --- 80,86 ----
+   		if (p < guess + FILSIZ)
+   		    *p++ = *cp;
+   	ws = p;
+ ! 	for (; !is_dirsep(*old) && *old != '\0'; old++)/* add current file name */
+   	    if (p < guess + FILSIZ)
+   		*p++ = *old;
+   	*p = '\0';		/* terminate it */
+ ***************
+ *** 84,90 ****
+   	 */
+   	/* (*should* say "looking for directory" whenever '/' is next...) */
+   	retval = t_search(guess, p, SPELL, FILSIZ,
+ ! 			  looking == TW_COMMAND && (foundslash || *old != '/') ?
+   			  TW_COMMAND : looking, 1, STRNULL, 0);
+   	if (retval >= 4 || retval < 0)
+   	    return -1;		/* hopeless */
+ --- 91,97 ----
+   	 */
+   	/* (*should* say "looking for directory" whenever '/' is next...) */
+   	retval = t_search(guess, p, SPELL, FILSIZ,
+ ! 			  looking == TW_COMMAND && (foundslash || !is_dirsep(*old)) ?
+   			  TW_COMMAND : looking, 1, STRNULL, 0);
+   	if (retval >= 4 || retval < 0)
+   	    return -1;		/* hopeless */
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.alloc.c ./tc.alloc.c
*** ../../store/tcsh-6.03/tc.alloc.c	Tue Nov 24 13:04:32 1992
--- ./tc.alloc.c	Thu Mar 11 00:30:52 1993
***************
*** 53,58 ****
--- 53,65 ----
  
  #ifndef SYSMALLOC
  
+ #ifdef __MINT__
+ /* need large stack because we alloc from stack (cause tcsh assumes
+  * continuus memory which MiNT does not provide)
+  */
+ long _stksize = -128*1024L;
+ #endif
+ 
  #undef RCHECK
  #undef DEBUG
  
***************
*** 244,253 ****
--- 251,262 ----
      memtop = (char *) op;
      if (membot == NULL)
  	membot = memtop;
+ #ifndef __MINT__
      if ((int) op & 0x3ff) {
  	memtop = (char *) sbrk(1024 - ((int) op & 0x3ff));
  	memtop += 1024 - ((int) op & 0x3ff);
      }
+ #endif
  
      /* take 2k unless the block is bigger than that */
      rnu = (bucket <= 8) ? 11 : bucket + 3;
***************
*** 449,454 ****
--- 458,469 ----
  
  #else				/* SYSMALLOC */
  
+ #ifdef __MINT__
+ /* Stack for MiNT
+  */
+ long _stksize = 20*1024L;
+ #endif /* __MINT__ */
+ 
  /**
   ** ``Protected versions'' of malloc, realloc, calloc, and free
   **
***************
*** 469,475 ****
  
      n = n ? n : 1;
  
! #ifndef _VMS_POSIX
      if (membot == NULL)
  	membot == (char*) sbrk(0);
  #endif /* !_VMS_POSIX */
--- 484,490 ----
  
      n = n ? n : 1;
  
! #if !defined(_VMS_POSIX) && !defined(__MINT__)
      if (membot == NULL)
  	membot == (char*) sbrk(0);
  #endif /* !_VMS_POSIX */
***************
*** 478,484 ****
  	child++;
  	stderror(ERR_NOMEM);
      }
! #ifdef _VMS_POSIX
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
--- 493,499 ----
  	child++;
  	stderror(ERR_NOMEM);
      }
! #if defined(_VMS_POSIX) || defined(__MINT__)
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
***************
*** 496,509 ****
  
      n = n ? n : 1;
  
      if (membot == NULL)
  	membot == (char*) sbrk(0);
  
      if ((ptr = (p ? realloc(p, n) : malloc(n))) == (ptr_t) 0) {
  	child++;
  	stderror(ERR_NOMEM);
      }
! #ifdef _VMS_POSIX
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
--- 511,526 ----
  
      n = n ? n : 1;
  
+ #ifndef __MINT__
      if (membot == NULL)
  	membot == (char*) sbrk(0);
+ #endif
  
      if ((ptr = (p ? realloc(p, n) : malloc(n))) == (ptr_t) 0) {
  	child++;
  	stderror(ERR_NOMEM);
      }
! #if defined(_VMS_POSIX) || defined(__MINT__)
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
***************
*** 522,529 ****
--- 539,548 ----
      n *= s;
      n = n ? n : 1;
  
+ #ifndef __MINT__
      if (membot == NULL)
  	membot == (char*) sbrk(0);
+ #endif
  
      if ((ptr = malloc(n)) == (ptr_t) 0) {
  	child++;
***************
*** 536,542 ****
  	    *sptr++ = 0;
  	while (--n);
  
! #ifdef _VMS_POSIX
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
--- 555,561 ----
  	    *sptr++ = 0;
  	while (--n);
  
! #if defined(_VMS_POSIX) || defined(__MINT__)
      if (memtop < ((char *) ptr) + n)
  	memtop = ((char *) ptr) + n;
      if (membot == NULL)
***************
*** 592,598 ****
  	    (unsigned long) membot, (unsigned long) memtop,
  	    (unsigned long) sbrk(0));
  #else
! #ifndef _VMS_POSIX
      memtop = (char *) sbrk(0);
  #endif /* !_VMS_POSIX */
      xprintf("Allocated memory from 0x%lx to 0x%lx (%ld).\n",
--- 611,617 ----
  	    (unsigned long) membot, (unsigned long) memtop,
  	    (unsigned long) sbrk(0));
  #else
! #if !defined(_VMS_POSIX) && !defined(__MINT__)
      memtop = (char *) sbrk(0);
  #endif /* !_VMS_POSIX */
      xprintf("Allocated memory from 0x%lx to 0x%lx (%ld).\n",
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.const.c ./tc.const.c
*** ../../store/tcsh-6.03/tc.const.c	Tue Nov 24 13:04:32 1992
--- ./tc.const.c	Fri Feb 26 03:11:00 1993
***************
*** 77,91 ****
--- 77,101 ----
  Char STRhistfile[] 	= { 'h', 'i', 's', 't', 'f', 'i', 'l', 'e', '\0' };
  Char STRsource[]        = { 's', 'o', 'u', 'r', 'c', 'e', '\0' };
  Char STRmh[]            = { '-', 'h', '\0' };
+ #ifndef DOSFS
  Char STRtildothist[]    = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r', 
  		            'y', '\0' };
+ #else
+ Char STRtildothist[]    = { '~', '/', 'h', 'i', 's', 't', 'o', 'r', 'y',
+                             '.', 'c', 's', 'h', '\0' };
+ #endif
  
  #ifdef KANJI
  Char STRnokanji[]       = { 'n', 'o', 'k', 'a', 'n', 'j', 'i', '\0' };
  #endif
  
+ #ifndef DOSFS
  Char STRtildotdirs[]    = { '~', '/', '.', 'c', 's', 'h', 'd', 'i', 'r',
  			    's', '\0' };
+ #else
+ Char STRtildotdirs[]    = { '~', '/', 'c', 's', 'h', 'd', 'i', 'r', 's',
+                             '.', 'c', 's', 'h', '\0' };
+ #endif
  Char STRdirsfile[]      = { 'd', 'i', 'r', 's', 'f', 'i', 'l', 'e', '\0' };
  Char STRsavedirs[]      = { 's', 'a', 'v', 'e', 'd', 'i', 'r', 's', '\0' };
  Char STRloginsh[]       = { 'l', 'o', 'g', 'i', 'n', 's', 'h', '\0' };
***************
*** 93,99 ****
--- 103,114 ----
  Char STRargv[]          = { 'a', 'r', 'g', 'v', '\0' };
  Char STRsavehist[]      = { 's', 'a', 'v', 'e', 'h', 'i', 's', 't', '\0' };
  Char STRnormal[]        = { 'n', 'o', 'r', 'm', 'a', 'l', '\0' };
+ #ifndef DOSFS
  Char STRsldtlogout[]    = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' };
+ #else
+ Char STRsldtlogout[]    = { '/', 'l', 'o', 'g', 'o', 'u', 't', '.', 'c', 's',
+                             'h', '\0' };
+ #endif
  Char STRjobs[]          = { 'j', 'o', 'b', 's', '\0' };
  Char STRsymhash[]       = { '#', ' ', '\0' };
  Char STRsymarrow[]      = { '>', ' ', '\0' };
***************
*** 197,205 ****
--- 212,230 ----
  Char STRwatch[]		= { 'w', 'a', 't', 'c', 'h', '\0' };
  #endif /* HAVENOUTMP */
  
+ #ifndef DOSFS
  Char STRsldottcshrc[]	= { '/', '.', 't', 'c', 's', 'h', 'r', 'c', '\0' };
  Char STRsldotcshrc[]	= { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' };
  Char STRsldotlogin[]	= { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
+ #else
+ Char STRsldottcshrc[]   = { '/', 't', 'c', 's', 'h', 'r', 'c', '.', 'c',
+                             's', 'h', '\0' };
+ Char STRsldotcshrc[]    = { '/', 'c', 's', 'h', 'r', 'c', '.', 'c', 's',
+                             'h', '\0' };
+ Char STRsldotlogin[]    = { '/', 'l', 'o', 'g', 'i', 'n', '.', 'c', 's',
+                             'h', '\0' };
+ #endif
+ 
  Char STRignoreeof[]	= { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
  Char STRnoclobber[]	= { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
  Char STRhelpcommand[]	= { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n', 
***************
*** 284,286 ****
--- 309,317 ----
  Char STRdown[] = { 'd', 'o', 'w', 'n', '\0' };
  Char STRleft[] = { 'l', 'e', 'f', 't', '\0' };
  Char STRright[] = { 'r', 'i', 'g', 'h', 't', '\0' };
+ 
+ #ifdef __MINT__
+ Char STRsuffixes[] = { 's', 'u', 'f', 'f', 'i', 'x', 'e', 's', '\0' };
+ Char STRSUFFIXES[] = { 'S', 'U', 'F', 'F', 'I', 'X', 'E', 'S', '\0' };
+ #endif
+ 
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.func.c ./tc.func.c
*** ../../store/tcsh-6.03/tc.func.c	Tue Nov 24 13:04:32 1992
--- ./tc.func.c	Thu Mar 11 03:10:24 1993
***************
*** 276,282 ****
  	for (k = 0, i = 0; v[k] != NULL; k++) {
  	    tmp = dnormalize(v[k], symlinks == SYM_IGNORE);
  	    dp = &tmp[Strlen(tmp) - 1];
! 	    if (*dp == '/' && dp != tmp)
  #ifdef apollo
  		if (dp != &tmp[1])
  #endif /* apollo */
--- 276,282 ----
  	for (k = 0, i = 0; v[k] != NULL; k++) {
  	    tmp = dnormalize(v[k], symlinks == SYM_IGNORE);
  	    dp = &tmp[Strlen(tmp) - 1];
! 	    if (is_dirsep(*dp) && dp != tmp)
  #ifdef apollo
  		if (dp != &tmp[1])
  #endif /* apollo */
***************
*** 303,309 ****
--- 303,313 ----
  		xprintf("%S:\n", tmp);
  		for (cp = tmp, dp = buf; *cp; *dp++ = (*cp++ | QUOTE))
  		    continue;
+ #if 0
  		if (dp[-1] != (Char) ('/' | QUOTE))
+ #else
+                 if (! ((dp[-1] & QUOTE) && is_dirsep(dp[-1] & ~QUOTE)))
+ #endif
  		    *dp++ = '/';
  		else 
  		    dp[-1] &= TRIM;
***************
*** 435,448 ****
      int     epl, vpl;
  
      if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
! 	if ((p = strrchr(ep, '/')) != NULL) 	/* if it has a path */
  	    ep = p + 1;		/* then we want only the last part */
      }
      else 
  	ep = "ed";
  
      if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
! 	if ((p = strrchr(vp, '/')) != NULL) 	/* and it has a path */
  	    vp = p + 1;		/* then we want only the last part */
      }
      else 
--- 439,452 ----
      int     epl, vpl;
  
      if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
! 	if ((p = lastslash(ep)) != NULL) 	/* if it has a path */
  	    ep = p + 1;		/* then we want only the last part */
      }
      else 
  	ep = "ed";
  
      if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
! 	if ((p = lastslash(vp)) != NULL) 	/* and it has a path */
  	    vp = p + 1;		/* then we want only the last part */
      }
      else 
***************
*** 462,468 ****
  		continue;
  	    *cp = '\0';
  		
! 	    if ((cp = strrchr(p, '/')) != NULL)	/* and it has a path */
  		cp = cp + 1;		/* then we want only the last part */
  	    else
  		cp = p;			/* else we get all of it */
--- 466,472 ----
  		continue;
  	    *cp = '\0';
  		
! 	    if ((cp = lastslash(p)) != NULL)	/* and it has a path */
  		cp = cp + 1;		/* then we want only the last part */
  	    else
  		cp = p;			/* else we get all of it */
***************
*** 1405,1417 ****
      }
      if (((h = value(STRhome)) != STRNULL) &&
  	(Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
! 	(p[j] == '/' || p[j] == '\0')) {
  	*hm = &p[j];
  	return STRNULL;
      }
      for (i = 0; i < tlength; i++)
  	if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
! 	    (p[j] == '/' || p[j] == '\0')) {
  	    *hm = &p[j];
  	    return tcache[i].user;
  	}
--- 1409,1421 ----
      }
      if (((h = value(STRhome)) != STRNULL) &&
  	(Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
! 	(is_dirsep(p[j]) || p[j] == '\0')) {
  	*hm = &p[j];
  	return STRNULL;
      }
      for (i = 0; i < tlength; i++)
  	if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
! 	    (is_dirsep(p[j]) || p[j] == '\0')) {
  	    *hm = &p[j];
  	    return tcache[i].user;
  	}
***************
*** 1471,1478 ****
--- 1475,1490 ----
  
  		    if ((n = read(fd, tbuf, BUFSIZE)) <= 0)
  			goto eof;
+ #ifdef DOSTEXT
+         /* we probably should strip the carriage returns, but
+          * changing them to blanks will work just as well for most cases
+          */
+                     for (i = 0; i < n; i++)
+                         buf[i] = (tbuf[i] == '\r') ? ' ' : tbuf[i];
+ #else
  		    for (i = 0; i < n; i++)
  			buf[i] = tbuf[i];
+ #endif
  		    p = buf;
  		}
  		n--;
***************
*** 1666,1671 ****
--- 1678,1686 ----
  	case '\0':	/* Whoa!! what the hell happened */
  	    return -1;
  
+ #ifdef DOSTEXT
+ 	case '\r':
+ #endif
  	case '\n':	/* The end of the line. */
  	    if (ws) {	/* terminate the last word */
  		*p = '\0';
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.os.c ./tc.os.c
*** ../../store/tcsh-6.03/tc.os.c	Tue Nov 24 13:04:32 1992
--- ./tc.os.c	Fri Feb 26 03:21:36 1993
***************
*** 1036,1042 ****
  	/* look if we found root yet */
  	if (st_cur.st_ino == st_root.st_ino &&
  	    DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
! 	    (void) strcpy(pathname, *pathptr != '/' ? "/" : pathptr);
  	    return (pathname);
  	}
  
--- 1036,1042 ----
  	/* look if we found root yet */
  	if (st_cur.st_ino == st_root.st_ino &&
  	    DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
! 	    (void) strcpy(pathname, !is_dirsep(*pathptr) ? "/" : pathptr);
  	    return (pathname);
  	}
  
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.os.h ./tc.os.h
*** ../../store/tcsh-6.03/tc.os.h	Tue Nov 24 13:04:32 1992
--- ./tc.os.h	Fri Feb 26 03:24:24 1993
***************
*** 479,484 ****
--- 479,485 ----
  extern int qsort();
  # endif
  #else
+ # ifndef __MINT__
  # ifndef hpux
  #  if __GNUC__ != 2
  extern int abort();
***************
*** 490,495 ****
--- 491,497 ----
  extern void abort();
  extern void qsort();
  # endif
+ # endif /* !__MINT__ */
  #endif	/* SUNOS4 */
  extern void perror();
  
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.prompt.c ./tc.prompt.c
*** ../../store/tcsh-6.03/tc.prompt.c	Tue Nov 24 13:04:34 1992
--- ./tc.prompt.c	Fri Feb 26 03:28:40 1993
***************
*** 303,309 ****
  		    else {
  			if ((scp != 'C') && (q = value(STRhome)) != STRNULL &&
  			    Strncmp(buff, q, (k = Strlen(q))) == 0 &&
! 			    (buff[k] == '/' || buff[k] == '\0')) {
  			    buff[--k] = '~';
  			    q = &buff[k];
  			    /* RWM - reset the path length */
--- 303,309 ----
  		    else {
  			if ((scp != 'C') && (q = value(STRhome)) != STRNULL &&
  			    Strncmp(buff, q, (k = Strlen(q))) == 0 &&
! 			    (is_dirsep(buff[k]) || buff[k] == '\0')) {
  			    buff[--k] = '~';
  			    q = &buff[k];
  			    /* RWM - reset the path length */
***************
*** 312,334 ****
  			else {
  			    q = buff;
  			    /* RWM - in case first char is not '/' */
! 			    if (*q == '/') updirs = 0; else updirs = 1;
  			}
  			/* RWM - calculate elements in the path */
  			for (z = q; *z; z++) {
! 			    if (*z == '/') updirs++;
  			    continue;	/* find the end */
  			}
  			/* RWM - the ones we will skip can be found here */
  			updirs -= j;
  			
  			while (j-- > 0) {
! 			    while ((z > q) && (*z != '/'))
  				z--;	/* back up */
  			    if (j && z > q)
  				z--;
  			}
! 			if (*z == '/' && z != q)
  			    z++;
  
  			/* RWM - if *q == '~' and *z != '~' then print */
--- 312,334 ----
  			else {
  			    q = buff;
  			    /* RWM - in case first char is not '/' */
! 			    if (is_abspath(q)) updirs = 0; else updirs = 1;
  			}
  			/* RWM - calculate elements in the path */
  			for (z = q; *z; z++) {
! 			    if (is_dirsep(*z)) updirs++;
  			    continue;	/* find the end */
  			}
  			/* RWM - the ones we will skip can be found here */
  			updirs -= j;
  			
  			while (j-- > 0) {
! 			    while ((z > q) && (!is_dirsep(*z)))
  				z--;	/* back up */
  			    if (j && z > q)
  				z--;
  			}
! 			if (is_dirsep(*z) && z != q)
  			    z++;
  
  			/* RWM - if *q == '~' and *z != '~' then print */
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.sig.h ./tc.sig.h
*** ../../store/tcsh-6.03/tc.sig.h	Tue Nov 24 13:04:34 1992
--- ./tc.sig.h	Sat Mar 13 21:53:04 1993
***************
*** 62,68 ****
  /*
   * sigvec is not the same everywhere
   */
! # if defined(_SEQUENT_) || (defined(_POSIX_SOURCE) && !defined(hpux))
  #  define HAVE_SIGVEC
  #  define mysigvec(a, b, c)	sigaction(a, b, c)
  typedef struct sigaction sigvec_t;
--- 62,68 ----
  /*
   * sigvec is not the same everywhere
   */
! # if defined(_SEQUENT_) || defined(__MINT__) || (defined(_POSIX_SOURCE) && !defined(hpux))
  #  define HAVE_SIGVEC
  #  define mysigvec(a, b, c)	sigaction(a, b, c)
  typedef struct sigaction sigvec_t;
***************
*** 130,139 ****
--- 130,141 ----
  /*
   * For 4.2bsd signals.
   */
+ # ifndef __MINT__
  # ifdef sigmask
  #  undef sigmask
  # endif /* sigmask */
  # define	sigmask(s)	(1 << ((s)-1))
+ # endif /* !__MINT__ */
  # ifdef POSIXSIGS
  #  define 	sigpause(a)	bsd_sigpause(a)
  #  define 	signal(a, b)	bsd_signal(a, b)
diff --context --new-file --recursive ../../store/tcsh-6.03/tc.vers.c ./tc.vers.c
*** ../../store/tcsh-6.03/tc.vers.c	Tue Nov 24 13:04:34 1992
--- ./tc.vers.c	Mon Mar  8 06:04:48 1993
***************
*** 474,479 ****
--- 474,484 ----
     hosttype = "vistra800"; /* Stardent Vistra */
  # endif /* i860  && !_havehosttype_ */
  
+ # if defined(__MINT__)
+ #  define _havehosttype_
+     hosttype = "m68k-atari/MiNT";
+ # endif /* __MINT__ */
+ 
  # ifndef _havehosttype_
  #  if defined(mc68000) || defined(__mc68000__) || defined(mc68k32)
  #   define _havehosttype_
diff --context --new-file --recursive ../../store/tcsh-6.03/tw.init.c ./tw.init.c
*** ../../store/tcsh-6.03/tw.init.c	Tue Nov 24 13:04:26 1992
--- ./tw.init.c	Mon Mar  8 19:25:18 1993
***************
*** 247,259 ****
      register Char **pv;
      struct varent *v = adrof(STRpath);
      struct varent *recexec = adrof(STRrecognize_only_executables);
  
- 
      if (v == NULL) /* if no path */
  	return;
  
      for (pv = v->vec; *pv; pv++) {
! 	if (pv[0][0] != '/') {
  	    tw_cmd_got |= TW_FL_REL;
  	    continue;
  	}
--- 247,262 ----
      register Char **pv;
      struct varent *v = adrof(STRpath);
      struct varent *recexec = adrof(STRrecognize_only_executables);
+ #ifdef __MINT__
+     struct varent *suffv = adrof(STRsuffixes);
+     Char **suffpv;
+ #endif
  
      if (v == NULL) /* if no path */
  	return;
  
      for (pv = v->vec; *pv; pv++) {
! 	if (!is_abspath(pv[0])) {
  	    tw_cmd_got |= TW_FL_REL;
  	    continue;
  	}
***************
*** 268,273 ****
--- 271,289 ----
  	    name = str2short(dp->d_name);
  	    if (dp->d_ino == 0 || (recexec && !executable(dir, name, 0)))
  		continue;
+ #ifdef __MINT__
+             {   Char *s = Strrchr(name, '.');
+ 
+                 if (s && suffv) {
+                     for (suffpv = suffv->vec; *suffpv; suffpv++) {
+                         if (!Strcmp(s+1, *suffpv)) {
+                             *s = 0; break;
+                         }
+                     }
+                 }
+             }
+ #endif /* __MINT__ */
+ 
  	    tw_cmd_add(name);
  	}
  	(void) closedir(dirp);
***************
*** 421,427 ****
  
          CLRDIR(tw_cmd_state.dfd)
  
! 	while (*tw_cmd_state.pathv && tw_cmd_state.pathv[0][0] == '/')
  	    tw_cmd_state.pathv++;
  	if ((ptr = *tw_cmd_state.pathv) != 0) {
  	    /*
--- 437,443 ----
  
          CLRDIR(tw_cmd_state.dfd)
  
! 	while (*tw_cmd_state.pathv && is_abspath(tw_cmd_state.pathv[0]))
  	    tw_cmd_state.pathv++;
  	if ((ptr = *tw_cmd_state.pathv) != 0) {
  	    /*
diff --context --new-file --recursive ../../store/tcsh-6.03/tw.parse.c ./tw.parse.c
*** ../../store/tcsh-6.03/tw.parse.c	Tue Nov 24 13:04:26 1992
--- ./tw.parse.c	Fri Feb 26 03:50:14 1993
***************
*** 261,267 ****
      case RECOGNIZE:
      case RECOGNIZE_ALL:
  	if (adrof(STRautocorrect)) {
! 	    if ((slshp = Strrchr(wordp, '/')) != NULL && slshp[1] != '\0') {
  		SearchNoDirErr = 1;
  		for (bptr = wordp; bptr < slshp; bptr++) {
  		    /*
--- 261,267 ----
      case RECOGNIZE:
      case RECOGNIZE_ALL:
  	if (adrof(STRautocorrect)) {
! 	    if ((slshp = Lastslash(wordp)) != NULL && slshp[1] != '\0') {
  		SearchNoDirErr = 1;
  		for (bptr = wordp; bptr < slshp; bptr++) {
  		    /*
***************
*** 350,356 ****
  	items[0] = buffer;
  	items[1] = NULL;
  	ptr = items;
! 	count = (looking == TW_COMMAND && Strchr(wordp, '/') == 0) ? 
  		c_glob(&ptr) : 
  		t_glob(&ptr, looking == TW_COMMAND);
  	if (count > 0) {
--- 350,356 ----
  	items[0] = buffer;
  	items[1] = NULL;
  	ptr = items;
! 	count = (looking == TW_COMMAND && !Has_slash(wordp)) ? 
  		c_glob(&ptr) : 
  		t_glob(&ptr, looking == TW_COMMAND);
  	if (count > 0) {
***************
*** 1156,1162 ****
  	break;
  
      case TW_COMMAND:
! 	if (Strchr(word, '/')) {
  	    looking = TW_FILE;
  	    flags |= TW_EXEC_CHK;
  	    flags |= TW_DIR_OK;
--- 1156,1162 ----
  	break;
  
      case TW_COMMAND:
! 	if (Has_slash(word)) {
  	    looking = TW_FILE;
  	    flags |= TW_EXEC_CHK;
  	    flags |= TW_DIR_OK;
***************
*** 1197,1208 ****
       */
      flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
  
!     if ((*word == '~') && (Strchr(word, '/') == NULL)) {
  	looking = TW_LOGNAME;
  	target = name;
      }
      else if ((target = Strrchr(name, '$')) != 0 && 
! 	     (Strchr(name, '/') == NULL)) {
  	target++;
  	looking = TW_VARIABLE;
      }
--- 1197,1208 ----
       */
      flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
  
!     if ((*word == '~') && (! Has_slash(word))) {
  	looking = TW_LOGNAME;
  	target = name;
      }
      else if ((target = Strrchr(name, '$')) != 0 && 
! 	     (! Has_slash(name))) {
  	target++;
  	looking = TW_VARIABLE;
      }
***************
*** 1371,1377 ****
  {
      register Char *p;
  
!     p = Strrchr(path, '/');
      if (p == NULL) {
  	copyn(name, path, MAXNAMLEN);
  	dir[0] = '\0';
--- 1371,1377 ----
  {
      register Char *p;
  
!     p = Lastslash(path);
      if (p == NULL) {
  	copyn(name, path, MAXNAMLEN);
  	dir[0] = '\0';
***************
*** 1448,1454 ****
  
      switch (old[0]) {
      case '~':
! 	for (p = new, o = &old[1]; *o && *o != '/'; *p++ = *o++) 
  	    continue;
  	*p = '\0';
  	if (gethdir(new)) {
--- 1448,1454 ----
  
      switch (old[0]) {
      case '~':
! 	for (p = new, o = &old[1]; *o && !is_dirsep(*o); *p++ = *o++) 
  	    continue;
  	*p = '\0';
  	if (gethdir(new)) {
***************
*** 1516,1525 ****
  	     */
  	    for (p = edir; *p; p++)
  		continue;
! 	    if (*--p == '/') {
  		for (p = nd; *p; p++)
  		    continue;
! 		if (*--p != '/')
  		    p = NULL;
  	    }
  	    for (d = edir, s = nd; (*d++ = *s++) != '\0';)
--- 1516,1525 ----
  	     */
  	    for (p = edir; *p; p++)
  		continue;
! 	    if (is_dirsep(*--p)) {
  		for (p = nd; *p; p++)
  		    continue;
! 		if (!is_dirsep(*--p))
  		    p = NULL;
  	    }
  	    for (d = edir, s = nd; (*d++ = *s++) != '\0';)
diff --context --new-file --recursive ../../store/tcsh-6.03/tw.spell.c ./tw.spell.c
*** ../../store/tcsh-6.03/tw.spell.c	Tue Nov 24 13:04:26 1992
--- ./tw.spell.c	Fri Feb 26 03:54:20 1993
***************
*** 53,60 ****
      bool    foundslash = 0;
      int     retval;
  
      for (;;) {
! 	while (*old == '/') {	/* skip '/' */
  	    *new++ = *old++;
  	    foundslash = 1;
  	}
--- 53,67 ----
      bool    foundslash = 0;
      int     retval;
  
+ #ifdef DOSFS
+     /* skip drive specification, if any */
+     if (*old && old[1] == ':' && is_dirsep(old[2])) {
+         *new++ = *old++; *new++ = *old++;
+     }
+ #endif
+ 
      for (;;) {
! 	while (is_dirsep(*old)) {	/* skip '/' */
  	    *new++ = *old++;
  	    foundslash = 1;
  	}
***************
*** 73,79 ****
  		if (p < guess + FILSIZ)
  		    *p++ = *cp;
  	ws = p;
! 	for (; *old != '/' && *old != '\0'; old++)/* add current file name */
  	    if (p < guess + FILSIZ)
  		*p++ = *old;
  	*p = '\0';		/* terminate it */
--- 80,86 ----
  		if (p < guess + FILSIZ)
  		    *p++ = *cp;
  	ws = p;
! 	for (; !is_dirsep(*old) && *old != '\0'; old++)/* add current file name */
  	    if (p < guess + FILSIZ)
  		*p++ = *old;
  	*p = '\0';		/* terminate it */
***************
*** 84,90 ****
  	 */
  	/* (*should* say "looking for directory" whenever '/' is next...) */
  	retval = t_search(guess, p, SPELL, FILSIZ,
! 			  looking == TW_COMMAND && (foundslash || *old != '/') ?
  			  TW_COMMAND : looking, 1, STRNULL, 0);
  	if (retval >= 4 || retval < 0)
  	    return -1;		/* hopeless */
--- 91,97 ----
  	 */
  	/* (*should* say "looking for directory" whenever '/' is next...) */
  	retval = t_search(guess, p, SPELL, FILSIZ,
! 			  looking == TW_COMMAND && (foundslash || !is_dirsep(*old)) ?
  			  TW_COMMAND : looking, 1, STRNULL, 0);
  	if (retval >= 4 || retval < 0)
  	    return -1;		/* hopeless */
