Re: patch: global -u on win32 with src root at drive root

"Shigio YAMAGUCHI" <[email protected]> Tue, 20 Oct 2009 15:28:36 +0900
Newsgroups gmane.comp.gnu.global.general
Message-ID <[email protected]>
Hi Kai

It seems that there is no problem in acceptance of tag files in system's
root directory.

Here is a patch for it.
I don't know whether or not this code works in Windows environment.
If you can modify this for Windows, I will accept it. Thanks.

diff -c -r1.25 getdbpath.c
*** libutil/getdbpath.c	6 Oct 2009 15:39:32 -0000	1.25
--- libutil/getdbpath.c	20 Oct 2009 05:34:31 -0000
***************
*** 268,278 ****
  		strlimcpy(root, cwd, MAXPATHLEN);
  		p = root + strlen(root);
  		while (!gtagsexist(root, dbpath, MAXPATHLEN, verbose)) {
  			while (*--p != '/' && p > root)
  				;
  			*p = 0;
- 			if (root == p)	/* reached root directory */
- 				break;
  		}
  		if (*root == 0)
  			die_with_code(3, "GTAGS not found.");
--- 268,282 ----
  		strlimcpy(root, cwd, MAXPATHLEN);
  		p = root + strlen(root);
  		while (!gtagsexist(root, dbpath, MAXPATHLEN, verbose)) {
+ 			if (!strcmp(root, "/")) { 	/* reached the system's root directory */
+ 				*root = '\0';
+ 				break;
+ 			}
  			while (*--p != '/' && p > root)
  				;
+ 			if (p == root)
+ 				p++;
  			*p = 0;
  		}
  		if (*root == 0)
  			die_with_code(3, "GTAGS not found.");
--
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3