From df267b31c5dbe4d9fe774c63acc31ef0b804f902 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 13 Feb 2006 23:38:36 +0000 Subject: Fix bug #11183. --- ChangeLog | 6 ++++++ implicit.c | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d71f4e7..52f7340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-13 Paul D. Smith + + * implicit.c (pattern_search): Add checking for DOS pathnames to + the pattern rule target LASTSLASH manipulation. + Fixes Savannah bug #11183. + 2006-02-11 Paul D. Smith * (ALL FILES): Updated copyright and license notices. diff --git a/implicit.c b/implicit.c index 03172f2..7b34fba 100644 --- a/implicit.c +++ b/implicit.c @@ -346,17 +346,28 @@ pattern_search (struct file *file, int archive, /* Set CHECK_LASTSLASH if FILENAME contains a directory prefix and the target pattern does not contain a slash. */ + check_lastslash = 0; + if (lastslash) + { #ifdef VMS - check_lastslash = lastslash != 0 - && ((strchr (target, ']') == 0) - && (strchr (target, ':') == 0)); + check_lastslash = (strchr (target, ']') == 0 + && strchr (target, ':') == 0); #else - check_lastslash = lastslash != 0 && strchr (target, '/') == 0; + check_lastslash = strchr (target, '/') == 0; +#ifdef HAVE_DOS_PATHS + /* Didn't find it yet: check for DOS-type directories. */ + if (!check_lastslash) + { + char *b = strrchr (target, '\\'); + check_lastslash = !(b ? b > lastslash + : (target[0] && target[1] == ':')); + } +#endif #endif + } if (check_lastslash) { - /* In that case, don't include the - directory prefix in STEM here. */ + /* If so, don't include the directory prefix in STEM here. */ unsigned int difference = lastslash - filename + 1; if (difference > stemlen) continue; -- cgit v1.2.3