From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: avoid hashing command names twice on Cygwin
Date: Fri, 26 Jan 2001 16:25:34 +0300 [thread overview]
Message-ID: <000201c0879b$76bca8d0$21c9ca95@mow.siemens.ru> (raw)
Under Cygwin every foo.exe was hashed twice - as foo and foo.exe.
Actually, the code was funny. It contained one block that was executed
unconditionally and exactly the same later under condition.
-andrej
Have a nice DOS!
B >>
Index: Src/hashtable.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v
retrieving revision 1.8
diff -u -r1.8 hashtable.c
--- Src/hashtable.c 2001/01/16 13:44:20 1.8
+++ Src/hashtable.c 2001/01/26 13:21:33
@@ -638,29 +638,25 @@
return;
while ((fn = zreaddir(dir, 1))) {
+#if defined(_WIN32) || defined(__CYGWIN__)
+ /*
+ * Hash foo.exe as foo, since when no real foo exists, foo.exe
+ * will get executed by DOS and Cygwin 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;
+#endif /* _WIN32 || __CYGWIN__ */
if (!cmdnamtab->getnode(cmdnamtab, fn)) {
cn = (Cmdnam) zcalloc(sizeof *cn);
cn->flags = 0;
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 /* _WIN32 */
+
}
closedir(dir);
}
next reply other threads:[~2001-01-26 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-26 13:25 Andrej Borsenkow [this message]
2001-01-26 13:36 ` Andrej Borsenkow
2001-01-26 14:32 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000201c0879b$76bca8d0$21c9ca95@mow.siemens.ru' \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).