DOS/Win Patch for 5.7.6

View: New views
2 Messages — Rating Filter:   Alert me  

DOS/Win Patch for 5.7.6

by Jason Hood :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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);

_______________________________________________
Bug-global mailing list
Bug-global@...
http://lists.gnu.org/mailman/listinfo/bug-global

Re: DOS/Win Patch for 5.7.6

by Shigio YAMAGUCHI-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jason,
I have committed the patch.
Thank you!

> 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.
>
> --------------030807090304020305040609
> Content-Type: text/plain;
>  name="diff.txt"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline;
>  filename="diff.txt"
>
> 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
...
--
Shigio YAMAGUCHI <shigio@...>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3


_______________________________________________
Bug-global mailing list
Bug-global@...
http://lists.gnu.org/mailman/listinfo/bug-global