bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DOS/Win Patch for 5.7.6


From: Jason Hood
Subject: DOS/Win Patch for 5.7.6
Date: Tue, 06 Oct 2009 23:52:49 +1000
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Find attached a small patch to fix some minor issues
with the DOS and Windows ports of 5.7.6.  It just
fixes tests for root directory and case sensitivity.

Jason.
diff -ur global-5.7.6/gtags/gtags.c global-5.7.6.1/gtags/gtags.c
--- global-5.7.6/gtags/gtags.c  2009-10-06 09:48:46 +1000
+++ global-5.7.6.1/gtags/gtags.c        2009-10-06 17:05:25 +1000
@@ -347,7 +347,7 @@
                
                if (!test("f", p))
                        die("'%s' not found.", p);
-               if (p[0] == '/')
+               if (isabspath(p))
                        die("--single-update requires relative path name.");
                if (!(p[0] == '.' && p[1] == '/')) {
                        snprintf(regular_path_name, MAXPATHLEN, "./%s", p);
@@ -364,7 +364,7 @@
         * Gtags create tag files at current directory by default.
         * If dbpath is specified as an argument then use it.
         * If the -i option specified and both GTAGS and GRTAGS exists
-        * at one of the candedite directories then gtags use existing
+        * at one of the candidate directories then gtags use existing
         * tag files.
         */
        if (iflag) {
diff -ur global-5.7.6/libutil/find.c global-5.7.6.1/libutil/find.c
--- global-5.7.6/libutil/find.c 2009-10-06 09:48:46 +1000
+++ global-5.7.6.1/libutil/find.c       2009-10-06 17:23:25 +1000
@@ -63,6 +63,19 @@
 #include "varray.h"
 
 /*
+ * use an appropriate string comparison for the file system; define the 
position of the root slash.
+ */
+#if defined(_WIN32) || defined(__DJGPP__)
+#define STRCMP stricmp
+#define STRNCMP strnicmp
+#define ROOT 2
+#else
+#define STRCMP strcmp
+#define STRNCMP strncmp
+#define ROOT 0
+#endif
+
+/*
  * usage of find_xxx()
  *
  *     find_open(NULL);
@@ -200,7 +213,7 @@
        flags |= REG_ICASE;
 #endif
        /*
-        * initinalize common data.
+        * initialize common data.
         */
        if (!list)
                list = strbuf_open(0);
@@ -298,7 +311,7 @@
  * skipthisfile: check whether or not we accept this file.
  *
  *     i)      path    path name (must start with ./)
- *     r)              1: skip, 0: dont skip
+ *     r)              1: skip, 0: don't skip
  *
  * Specification of required path name.
  * o Path must start with "./".
@@ -333,7 +346,7 @@
                 * the path must start with "./".
                 */
                if (*(last - 1) == '/') {       /* it's a directory */
-                       if (!strncmp(path + 1, first, last - first)) {
+                       if (!STRNCMP(path + 1, first, last - first)) {
 #ifdef DEBUG
                                if (debug)
                                        fprintf(stderr, "skipthisfile(2): 
%s\n", path);
@@ -341,7 +354,7 @@
                                return 1;
                        }
                } else {
-                       if (!strcmp(path + 1, first)) {
+                       if (!STRCMP(path + 1, first)) {
 #ifdef DEBUG
                                if (debug)
                                        fprintf(stderr, "skipthisfile(3): 
%s\n", path);
@@ -475,7 +488,7 @@
        /*
         * rootdir always ends with '/'.
         */
-       if (!strcmp(root, "/"))
+       if (!strcmp(root+ROOT, "/"))
                strlimcpy(rootdir, root, sizeof(rootdir));
        else
                snprintf(rootdir, sizeof(rootdir), "%s/", root);
diff -ur global-5.7.6/libutil/getdbpath.c global-5.7.6.1/libutil/getdbpath.c
--- global-5.7.6/libutil/getdbpath.c    2009-10-06 09:48:46 +1000
+++ global-5.7.6.1/libutil/getdbpath.c  2009-10-06 17:22:55 +1000
@@ -44,6 +44,15 @@
 #include "strlimcpy.h"
 #include "test.h"
 
+/*
+ * define the position of the root slash.
+ */
+#if defined(_WIN32) || defined(__DJGPP__)
+#define ROOT 2
+#else
+#define ROOT 0
+#endif
+
 static const char *makeobjdirprefix;   /* obj partition                */
 static const char *makeobjdir;         /* obj directory                */
 
@@ -294,7 +303,7 @@
                        } else {
                                if (verbose)
                                        fprintf(stderr, "GTAGSROOT found at 
'%s'.\n", path);
-                               if (*s != '/') {
+                               if (!isabspath(s)) {
                                        char buf[MAXPATHLEN+1];
                                        s = realpath(makepath(root, s, NULL), 
buf);
                                }
@@ -305,7 +314,7 @@
                        break;
                } while (0);
        }
-       if (!strcmp(root, "/"))
+       if (!strcmp(root+ROOT, "/"))
                strlimcpy(root_with_slash, root, sizeof(root_with_slash));
        else
                snprintf(root_with_slash, sizeof(root_with_slash), "%s/", root);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]