Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo



Under DOS/Win32 most executables have a .exe extension.  When running 
under Cygwin, the command hash gets filled with all the .exe versions of 
the names.  This works fine, except when CORRECT or CORRECT_ALL are set 
-- zsh tries to spell correct when you don't type the trailing .exe.  
This is inconvenient.

This patch introduces a _WIN32 specific change.  If a file foo.exe is in 
the path, the patch causes both foo and foo.exe to be added to the 
command hash.

I didn't use __CYGWIN__ because I think this is useful for both UWIN 
(which may define _WIN32) and a native port (which does define _WIN32).

--
I'm really matt_armstrong@xxxxxxxxxxxx  My ISP is blacklisted by
http://www.orbs.org, so I must use hotmail.  :-(


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
*** Src/hashtable.c	Sat Feb 27 20:06:23 1999
--- ../zsh-3.1.5-pws-9.orig/Src/hashtable.c	Tue Jan 19 04:28:00 1999
***************
*** 607,615 ****
      Cmdnam cn;
      DIR *dir;
      char *fn;
- #ifdef _WIN32
-     char *exe;
- #endif
  
      if (isrelative(*dirp) || !(dir = opendir(unmeta(*dirp))))
  	return;
--- 607,612 ----
***************
*** 621,643 ****
  	    cn->u.name = dirp;
  	    cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn);
  	}
- #ifdef _WIN32
- 	/* Hash foo.exe as foo, since when no real foo exists, foo.exe
- 	   will get executed by DOS automatically.  This quiets
- 	   spurious corrections when CORRECT or CORRECT_ALL is set. */
- 	if ((exe = strrchr(fn, '.')) &&
- 	    (exe[1] == 'E' || exe[1] == 'e') &&
- 	    (exe[2] == 'X' || exe[2] == 'x') &&
- 	    (exe[3] == 'E' || exe[3] == 'e') && exe[4] == 0) {
- 	    *exe = 0;
- 	    if (!cmdnamtab->getnode(cmdnamtab, fn)) {
- 		cn = (Cmdnam) zcalloc(sizeof *cn);
- 		cn->flags = 0;
- 		cn->u.name = dirp;
- 		cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn);
- 	    }
- 	}
- #endif /* __CYGWIN__ */
      }
      closedir(dir);
  }
--- 618,623 ----


Messages sorted by: Reverse Date, Date, Thread, Author