|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
gtags under win32Hi,
Few days ago I have sent a question on help-global, regarding "-f" option on windows. I was always getting "Warning: '...path here...' is out of source tree. (Ignored)" message when trying use gtags with "-f". Now I know the purpose of that behavior. It occurs when the root directory consists only of a drive letter. Then its sometimes "c:" and sometimes "c:/". Therefore comparing the paths like "c:/adir" and "c://adir" failed. The solution is included in the patch at the end of email. Patch also contains solution to my second problem. I have dir with sources mounted over network as a drive letter. When connection temporary fails - which happens very often - I am getting message "command failed in xargs_read()" and process exit. Its because of error on closing the pipe. So I included conditional ignoring error (based on flag IGNORE_ERROR). Now I can use global which unbelievable speeds up my work! Thanks a lot for such great package! Regards Mikolaj Sitarz diff -ru global-5.7.5/libutil/find.c global-5.7.5a/libutil/find.c --- global-5.7.5/libutil/find.c 2009-03-14 01:30:37.000000000 +0100 +++ global-5.7.5a/libutil/find.c 2009-08-01 16:02:17.000000000 +0200 @@ -477,8 +477,19 @@ */ if (!strcmp(root, "/")) strlimcpy(rootdir, root, sizeof(rootdir)); - else - snprintf(rootdir, sizeof(rootdir), "%s/", root); + else { +#if defined(_WIN32) || defined(__DJGPP__) + /* + * on windows its sometimes 'C:', sometimes 'C:/' + */ + if(strlen(root) >= 1 && root[strlen(root)-1] == '/') + snprintf(rootdir, sizeof(rootdir), "%s", root); + else + snprintf(rootdir, sizeof(rootdir), "%s/", root); +#else + snprintf(rootdir, sizeof(rootdir), "%s/", root); +#endif + } strlimcpy(cwddir, root, sizeof(cwddir)); /* * prepare regular expressions. diff -ru global-5.7.5/libutil/xargs.c global-5.7.5a/libutil/xargs.c --- global-5.7.5/libutil/xargs.c 2009-03-14 01:30:37.000000000 +0100 +++ global-5.7.5a/libutil/xargs.c 2009-08-01 16:05:11.000000000 +0200 @@ -283,7 +283,12 @@ * was not found. If you would like to use such command, set the * flag to 1. */ +#ifdef IGNORE_ERROR + xp->ignore_error = 1; +#else xp->ignore_error = 0; +#endif + /* * By default, we doesn't put the path to GPATH. * This option is prepared for createtags() and updatetags(). _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags under win32Mikolaj Sitarz wrote:
> directory consists only of a drive letter. Then its sometimes "c:" and > sometimes "c:/". Therefore comparing the paths like "c:/adir" and > "c://adir" failed. It should always be "c:/", it's only the test that's failing. The same test is also made in setupdbpath. I would suggest conditionalising the strcmp itself, comparing with root+2. Jason. _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags under win32On Sun, Aug 2, 2009 at 3:24 PM, Jason Hood<jadoxa@...> wrote:
> It should always be "c:/", it's only the test that's failing. > The same test is also made in setupdbpath. I would suggest > conditionalising the strcmp itself, comparing with root+2. OK. Do you suggest some checking of the root length? Or rather we can be 100% sure and use strcmp(root+2,'/') ? Do you suggest any other place that it should be conditionalised? Mikolaj Sitarz _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
|
|
Re: gtags under win32Ok, now I think I understand what you mean.
Corrected patch is below. regards Mikolaj Sitarz diff -ru global-5.7.5/libutil/find.c global-5.7.5b/libutil/find.c --- global-5.7.5/libutil/find.c 2009-03-14 01:30:37.000000000 +0100 +++ global-5.7.5b/libutil/find.c 2009-08-02 17:16:31.000000000 +0200 @@ -475,7 +475,11 @@ /* * rootdir always ends with '/'. */ +#if defined(_WIN32) || defined(__DJGPP__) + if (!strcmp(root+2, "/")) +#else if (!strcmp(root, "/")) +#endif strlimcpy(rootdir, root, sizeof(rootdir)); else snprintf(rootdir, sizeof(rootdir), "%s/", root); @@ -305,7 +305,11 @@ break; } while (0); } +#if defined(_WIN32) || defined(__DJGPP__) + if (!strcmp(root+2, "/")) +#else if (!strcmp(root, "/")) +#endif strlimcpy(root_with_slash, root, sizeof(root_with_slash)); else snprintf(root_with_slash, sizeof(root_with_slash), "%s/", root); @@ -283,7 +283,12 @@ * was not found. If you would like to use such command, set the * flag to 1. */ +#ifdef IGNORE_ERROR + xp->ignore_error = 1; +#else xp->ignore_error = 0; +#endif + /* * By default, we doesn't put the path to GPATH. * This option is prepared for createtags() and updatetags(). On 8/2/09, Mikolaj Sitarz <sitarz@...> wrote: > On Sun, Aug 2, 2009 at 3:24 PM, Jason Hood<jadoxa@...> wrote: >> It should always be "c:/", it's only the test that's failing. >> The same test is also made in setupdbpath. I would suggest >> conditionalising the strcmp itself, comparing with root+2. > > OK. Do you suggest some checking of the root length? Or rather we can > be 100% sure and use strcmp(root+2,'/') ? Do you suggest any other > place that it should be conditionalised? > > Mikolaj Sitarz > _______________________________________________ Bug-global mailing list Bug-global@... http://lists.gnu.org/mailman/listinfo/bug-global |
| Free embeddable forum powered by Nabble | Forum Help |