zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo
@ 1999-02-28  4:13 Matt Armstrong
  1999-02-28 10:10 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Armstrong @ 1999-02-28  4:13 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 840 bytes --]

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@bigfoot.com.  My ISP is blacklisted by
http://www.orbs.org, so I must use hotmail.  :-(


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

[-- Attachment #2: cygwin.hashtable.patch.txt --]
[-- Type: text/plain, Size: 1165 bytes --]

*** 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 ----

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo
  1999-02-28  4:13 PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo Matt Armstrong
@ 1999-02-28 10:10 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-02-28 10:10 UTC (permalink / raw)
  To: zsh-workers

On Feb 27,  8:13pm, Matt Armstrong wrote:
} Subject: PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo
}
} 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.

Just for everyone's info, I believe Amol D. put something like this into
the most recent version of his Windows port of 3.0.x, a while back.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-02-28 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-28  4:13 PATCH: zsh-3.1.5-pws-9: Cygwin, hash foo.exe as foo Matt Armstrong
1999-02-28 10:10 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).