Just a fix for some old path issues that came up (I hadn't ignored
case in abs2rel, nor translated backslashes in GTAGSLIBPATH).
--
Jason.
diff -urp global-6.5/global/global.c global-6-5/global/global.c
--- global-6.5/global/global.c 2015-06-10 11:45:07 +1000
+++ global-6-5/global/global.c 2015-06-12 21:35:49 +1000
@@ -53,6 +53,29 @@
#include "literal.h"
#include "convert.h"
+/*
+ * ensure GTAGSLIBPATH compares correctly
+ */
+#if defined(_WIN32) || defined(__DJGPP__)
+#define STRCMP stricmp
+#define back2slash(sb) do { \
+ char *p = strbuf_value(sb); \
+ for (; *p; p++) \
+ if (*p == '\\') \
+ *p = '/'; \
+} while (0)
+#else
+#define STRCMP strcmp
+#define back2slash(sb)
+#endif
+
+/*
+ * enable [set] globbing, if available
+ */
+#ifdef __CRT_GLOB_BRACKET_GROUPS__
+int _CRT_glob = __CRT_GLOB_USE_MINGW__ | __CRT_GLOB_BRACKET_GROUPS__;
+#endif
+
/**
* @file global.c
* @NAME{global} - print locations of the specified object.
@@ -339,12 +362,13 @@ finish:
sb = strbuf_open(0);
strbuf_puts(sb, getenv("GTAGSLIBPATH"));
+ back2slash(sb);
for (libdir = strbuf_value(sb); libdir; libdir = nextp) {
if ((nextp = locatestring(libdir, PATHSEP,
MATCH_FIRST)) != NULL)
*nextp++ = 0;
if (!gtagsexist(libdir, libdbpath, sizeof(libdbpath),
0))
continue;
- if (!strcmp(dbpath, libdbpath))
+ if (!STRCMP(dbpath, libdbpath))
continue;
dbop = dbop_open(makepath(libdbpath, dbname(GTAGS),
NULL), 0, 0, 0);
if (dbop == NULL)
@@ -997,15 +1021,16 @@ completion(const char *dbpath, const cha
char *libdir, *nextp = NULL;
strbuf_puts(sb, getenv("GTAGSLIBPATH"));
+ back2slash(sb);
/*
- * search for each tree in the library path.
- */
+ * search for each tree in the library path.
+ */
for (libdir = strbuf_value(sb); libdir; libdir = nextp) {
if ((nextp = locatestring(libdir, PATHSEP,
MATCH_FIRST)) != NULL)
*nextp++ = 0;
if (!gtagsexist(libdir, libdbpath, sizeof(libdbpath),
0))
continue;
- if (!strcmp(dbpath, libdbpath))
+ if (!STRCMP(dbpath, libdbpath))
continue;
if (!test("f", makepath(libdbpath, dbname(db), NULL)))
continue;
@@ -1788,6 +1813,7 @@ tagsearch(const char *pattern, const cha
char *libdir, *nextp = NULL;
strbuf_puts(sb, getenv("GTAGSLIBPATH"));
+ back2slash(sb);
/*
* search for each tree in the library path.
*/
@@ -1796,7 +1822,7 @@ tagsearch(const char *pattern, const cha
*nextp++ = 0;
if (!gtagsexist(libdir, libdbpath, sizeof(libdbpath),
0))
continue;
- if (!strcmp(dbpath, libdbpath))
+ if (!STRCMP(dbpath, libdbpath))
continue;
if (!test("f", makepath(libdbpath, dbname(db), NULL)))
continue;
diff -urp global-6.5/gtags/gtags.c global-6-5/gtags/gtags.c
--- global-6.5/gtags/gtags.c 2015-06-10 11:45:07 +1000
+++ global-6-5/gtags/gtags.c 2015-06-12 21:35:49 +1000
@@ -56,6 +56,13 @@
#include "parser.h"
#include "const.h"
+/*
+ * enable [set] globbing, if available
+ */
+#ifdef __CRT_GLOB_BRACKET_GROUPS__
+int _CRT_glob = __CRT_GLOB_USE_MINGW__ | __CRT_GLOB_BRACKET_GROUPS__;
+#endif
+
/**
@file
@NAME{gtags} - create tag files for @NAME{global}.
diff -urp global-6.5/libutil/abs2rel.c global-6-5/libutil/abs2rel.c
--- global-6.5/libutil/abs2rel.c 2015-06-10 11:45:09 +1000
+++ global-6-5/libutil/abs2rel.c 2015-06-12 22:10:31 +1000
@@ -38,6 +38,11 @@
#include "path.h"
#if defined(_WIN32) || defined(__DJGPP__)
#include "checkalloc.h"
+#define LOCATEFLAG MATCH_AT_FIRST|IGNORE_CASE
+#define PATHCHAR(c) tolower(c)
+#else
+#define LOCATEFLAG MATCH_AT_FIRST
+#define PATHCHAR(c) c
#endif
#define COLOR_PATH
@@ -217,9 +222,9 @@ normalize(const char *path, const char *
* rootdir /a/b/
* path /a/b/c/d.c -> c/d.c -> ./c/d.c
*/
- p = locatestring(abs, root, MATCH_AT_FIRST);
+ p = locatestring(abs, root, LOCATEFLAG);
if (p == NULL) {
- p = locatestring(root, abs, MATCH_AT_FIRST);
+ p = locatestring(root, abs, LOCATEFLAG);
/*
* abs == /usr/src should be considered to be equal to root ==
/usr/src/.
*/
@@ -402,7 +407,7 @@ abs2rel(const char *path, const char *ba
die("invalid escape sequence in the path.
'%s'", path);
}
#endif
- if (*pp != *bp)
+ if (PATHCHAR(*pp) != PATHCHAR(*bp))
break;
if (*pp == '/')
branch = pp;
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global