Find attached a patch to fix some issues with this release.

* convert.pl's --c was not updated, so some const.h files showed
  @ sequences.  I've also made the grep command use double quotes,
  since Windows doesn't do single.

* fixes 'global -u' on Windows (put a semicolon in front of the quote
  to stop CMD.EXE incorrectly chopping it off; it sees the semicolon
  as whitespace).

* fixes 'global -I' with a regexp (explicitly use the "--regexp" flag,
  since idutils may not see some characters as regexp; use quote_shell,
  not quote_string, as the latter will incorrectly escape the regexp
  characters.  At least, I think that's what was happening, back when
  I did it for 6.2.8.)

* fixes literal_search (-V would not match the last line of a file).

* fixes a typo in global/manual.in (haven't provided any of the
  generated files, but my site[1] has).

* opens the htags cgi pipe differently on Windows ("-|" doesn't work).

* fixes an apparently missed variable rename in htags.c.

* adds mkdir macro to fileop.c; does same for path.c.

* makes MAXKEYLEN at least 1024 (I hope that's enough to allow reading
  Linux-generated tag files on Windows).

* fixes 'global -i literal' (it matched incorrectly if there was no
  lower case match).

[1] http://global.adoxa.vze.com/

-- 
Jason.
diff -pur global-6.2.10/convert.pl global-6.2-10/convert.pl
--- global-6.2.10/convert.pl    2014-01-16 14:57:23 +1000
+++ global-6.2-10/convert.pl    2014-01-21 23:14:36 +1000
@@ -67,7 +67,7 @@ sub getvalue {
        # A value should be defined as:
        # NAME='VALUE'
        #
-       my $line=`grep '$name=' configure.ac`;
+       my $line=`grep "$name=" configure.ac`;
        ($value) = $line =~ /^$name='(.*)'$/;
        unless ($value) {
                print STDERR "$name not found.\n";
@@ -161,7 +161,7 @@ sub ungetline {
 package c;
 sub convert {
        local($arg) = '[^},]+';
-       local($macros) = 'arg|code|var|file|name|option';
+       local($macros) = 'arg|code|var|file|name|option|val|samp|kbd';
        chop;
        s/^\s+//;
        while (s/\@($macros)\{($arg)\}/$2/) {
diff -pur global-6.2.10/global/global.c global-6.2-10/global/global.c
--- global-6.2.10/global/global.c       2014-01-16 14:57:23 +1000
+++ global-6.2-10/global/global.c       2014-01-21 23:14:36 +1000
@@ -642,6 +642,13 @@ main(int argc, char **argv)
                        die("gtags command not found.");
                if (chdir(root) < 0)
                        die("cannot change directory to '%s'.", root);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+               /*
+                * Get around CMD.EXE's weird quoting rules by sticking another
+                * perceived whitespace in front (also works with Take Command).
+                */
+               strbuf_putc(sb, ';');
+#endif
                strbuf_puts(sb, quote_shell(gtags_path));
                strbuf_puts(sb, " -i");
                if (vflag)
@@ -654,8 +661,7 @@ main(int argc, char **argv)
                                        die("rel2abs failed.");
                                single_update = regular_path_name;
                        }
-                       strbuf_puts(sb, " --single-update");
-                       strbuf_putc(sb, ' ');
+                       strbuf_puts(sb, " --single-update ");
                        strbuf_puts(sb, quote_shell(single_update));
                }
                strbuf_putc(sb, ' ');
@@ -1058,8 +1064,10 @@ idutils(const char *pattern, const char
                strbuf_puts(ib, " --result=grep");
        if (iflag)
                strbuf_puts(ib, " --ignore-case");
+       if (isregex(pattern))
+               strbuf_puts(ib, " --regexp");
        strbuf_putc(ib, ' ');
-       strbuf_puts(ib, quote_string(pattern));
+       strbuf_puts(ib, quote_shell(pattern));
        if (debug)
                fprintf(stderr, "idutils: %s\n", strbuf_value(ib));
        if (!(ip = popen(strbuf_value(ib), "r")))
diff -pur global-6.2.10/global/literal.c global-6.2-10/global/literal.c
--- global-6.2.10/global/literal.c      2014-01-16 14:57:23 +1000
+++ global-6.2-10/global/literal.c      2014-01-21 23:14:36 +1000
@@ -159,7 +159,7 @@ literal_search(CONVERT *cv, const char *
        lineno = 1;
        c = w;
        for (;;) {
-               if (--ccount <= 0)
+               if (--ccount < 0)
                        break;
                nstate:
                        if (ccomp(c->inp, *p)) {
@@ -186,7 +186,7 @@ literal_search(CONVERT *cv, const char *
                        }
                if (c->out) {
                        while (*p++ != '\n') {
-                               if (--ccount <= 0)
+                               if (--ccount < 0)
                                        break;
                        }
                        if (Vflag)
@@ -210,7 +210,7 @@ literal_search(CONVERT *cv, const char *
                        c = w;
                        continue;
                }
-               if (*p++ == '\n') {
+               if (*p++ == '\n' || ccount == 0) {
                        if (Vflag)
                                goto succeed;
                        else {
diff -pur global-6.2.10/global/manual.in global-6.2-10/global/manual.in
--- global-6.2.10/global/manual.in      2014-01-16 14:57:23 +1000
+++ global-6.2-10/global/manual.in      2014-01-21 23:14:36 +1000
@@ -151,7 +151,7 @@
                With the @option{-p} option, print the root directory of the 
project.
        @item{@option{--result} @arg{format}}
                Print out using @arg{format}, which may be one of:
-               @val{path} (deault), @val{ctags}, @val{ctags-x}, @val{grep} or 
@val{cscope}.
+               @val{path} (default), @val{ctags}, @val{ctags-x}, @val{grep} or 
@val{cscope}.
                The @option{--result=ctags} and @option{--result=ctags-x} 
options are
                equivalent to the @option{-t} and @option{-x} options 
respectively.
                The @option{--result} option is given more priority than the 
@option{-t} and @option{-x} options.
diff -pur global-6.2.10/htags/completion.cgi.tmpl.in 
global-6.2-10/htags/completion.cgi.tmpl.in
--- global-6.2.10/htags/completion.cgi.tmpl.in  2014-01-16 14:57:23 +1000
+++ global-6.2-10/htags/completion.cgi.tmpl.in  2014-01-21 23:14:36 +1000
@@ -81,7 +81,11 @@ if (-f "../GTAGSROOT" && open(GTAGSROOT,
 }
 chdir($gtagsroot);
 print "Content-Type: text/html\n\n";
-open(PIPE, "-|") || exec '@globalpath@', '-'.$flags, '-e', $q;
+if ($^O eq 'MSWin32') {
+       open(PIPE, '@globalpath@' . " -${flags}e $q |");
+} else {
+       open(PIPE, "-|") || exec '@globalpath@', '-'.$flags.'e', $q;
+}
 if ($limit > 0) {
        while (<PIPE>) {
                print if ($limit-- > 0);
diff -pur global-6.2.10/htags/global.cgi.tmpl.in 
global-6.2-10/htags/global.cgi.tmpl.in
--- global-6.2.10/htags/global.cgi.tmpl.in      2014-01-16 14:57:23 +1000
+++ global-6.2-10/htags/global.cgi.tmpl.in      2014-01-21 23:14:36 +1000
@@ -137,14 +137,14 @@ if ($?) {
 # The --result=ctags-xid print the file id of the path at the head
 # of each line.
 #
-$flags = $flag . $iflag . $oflag;
-if ($flags eq '') {
-       open(PIPE, "-|") || exec '@globalpath@', '--result=ctags-xid', '-e', 
$pattern;
+$flags = '-' . $flag . $iflag . $oflag . 'e';
+if ($^O eq 'MSWin32') {
+       open(PIPE, '@globalpath@' . " --result=ctags-xid $flags $pattern |");
 } else {
-       open(PIPE, "-|") || exec '@globalpath@', '--result=ctags-xid', 
'-'.$flags, '-e', $pattern;
-}
-if ($?) {      
-       error_and_exit("Cannot execute global.");
+       open(PIPE, "-|") || exec '@globalpath@', '--result=ctags-xid', $flags, 
$pattern;
+       if ($?) {
+               error_and_exit("Cannot execute global.");
+       }
 }
 local(%ctab) = ('&', '&amp;', '<', '&lt;', '>', '&gt;');
 $pattern =~ s/([&<>])/$ctab{$1}/ge;
diff -pur global-6.2.10/htags/htags.c global-6.2-10/htags/htags.c
--- global-6.2.10/htags/htags.c 2014-01-16 14:57:23 +1000
+++ global-6.2-10/htags/htags.c 2014-01-21 23:14:36 +1000
@@ -2109,7 +2109,7 @@ main(int argc, char **argv)
                char dist[MAXPATHLEN];
 #ifdef __DJGPP__
                const char *template = "";
-               snprintf(src, sizeof(com), "%s/gtags/style.css.tmpl", datadir);
+               snprintf(src, sizeof(src), "%s/gtags/style.css.tmpl", datadir);
                if (test("f", src))
                       template = ".tmpl";
                snprintf(src, sizeof(src), "%s/gtags/style.css%s", datadir, 
template);
diff -pur global-6.2.10/libutil/fileop.c global-6.2-10/libutil/fileop.c
--- global-6.2.10/libutil/fileop.c      2014-01-16 14:57:23 +1000
+++ global-6.2-10/libutil/fileop.c      2014-01-21 23:14:36 +1000
@@ -48,6 +48,10 @@
 #include "strlimcpy.h"
 #include "test.h"
 
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define mkdir(path,mode) mkdir(path)
+#endif
+
 /**
  @file
 
diff -pur global-6.2.10/libutil/gparam.h global-6.2-10/libutil/gparam.h
--- global-6.2.10/libutil/gparam.h      2014-01-16 14:57:23 +1000
+++ global-6.2-10/libutil/gparam.h      2014-01-21 23:14:36 +1000
@@ -44,7 +44,11 @@
 #define MAXPATHLEN     1024
 #endif
                /** max length of record key    */
+#if MAXPATHLEN < 1024
+#define MAXKEYLEN      1024
+#else
 #define MAXKEYLEN      MAXPATHLEN
+#endif
                /** max length of URL           */
 #define MAXURLLEN      1024
 /*
diff -pur global-6.2.10/libutil/gtagsop.c global-6.2-10/libutil/gtagsop.c
--- global-6.2.10/libutil/gtagsop.c     2014-01-16 14:57:23 +1000
+++ global-6.2-10/libutil/gtagsop.c     2014-01-21 23:14:36 +1000
@@ -899,6 +899,8 @@ again3:
                if (gtop->gtp_index >= gtop->gtp_count) {
                        if (gtop->prefix && gtags_restart(gtop)) {
                                gtop->gtp.tag = dbop_first(gtop->dbop, 
gtop->key, gtop->preg, gtop->dbflags);
+                               if (gtop->gtp.tag == NULL)
+                                       return NULL;
                                dbop_unread(gtop->dbop);
                                segment_read(gtop);
                        } else
diff -pur global-6.2.10/libutil/path.c global-6.2-10/libutil/path.c
--- global-6.2.10/libutil/path.c        2014-01-16 14:57:23 +1000
+++ global-6.2-10/libutil/path.c        2014-01-21 23:14:36 +1000
@@ -42,6 +42,10 @@
 #include "strlimcpy.h"
 #include "test.h"
 
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define mkdir(path,mode) mkdir(path)
+#endif
+
 
 /**
  * isabspath: whether absolute path or not
@@ -214,11 +218,7 @@ makedirectories(const char *base, const
                if (!test("d", p)) {
                        if (verbose)
                                fprintf(stderr, " Making directory '%s'.\n", p);
-#if defined(_WIN32) && !defined(__CYGWIN__)
-                       if (mkdir(p) < 0) {
-#else
                        if (mkdir(p, 0775) < 0) {
-#endif /* WIN32 */
                                strbuf_close(sb);
                                return -3;
                        }
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global

Reply via email to