emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lib-src/etags.c,v


From: Francesco Potortì
Subject: [Emacs-diffs] Changes to emacs/lib-src/etags.c,v
Date: Sat, 16 Aug 2008 23:57:41 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Francesco Potortì <pot>        08/08/16 23:57:41

Index: etags.c
===================================================================
RCS file: /sources/emacs/emacs/lib-src/etags.c,v
retrieving revision 3.88
retrieving revision 3.89
diff -u -b -r3.88 -r3.89
--- etags.c     31 Jul 2008 05:33:39 -0000      3.88
+++ etags.c     16 Aug 2008 23:57:41 -0000      3.89
@@ -75,11 +75,11 @@
 
 /*
  * If you want to add support for a new language, start by looking at the LUA
- * language, which is the simplest.  Alternatively, consider shipping a
- * configuration file containing regexp definitions for etags.
+ * language, which is the simplest.  Alternatively, consider distributing etags
+ * together with a configuration file containing regexp definitions for etags.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 17.38";
+char pot_etags_version[] = "@(#) pot revision number is 17.38.1.3";
 
 #define        TRUE    1
 #define        FALSE   0
@@ -892,7 +892,7 @@
 # define EMACS_NAME "standalone"
 #endif
 #ifndef VERSION
-# define VERSION "17.38"
+# define VERSION "17.38.1.3"
 #endif
 static void
 print_version ()
@@ -1264,7 +1264,10 @@
       || strneq (tagfile, "/dev/", 5))
     tagfiledir = cwd;
   else
+    {
+      canonicalize_filename (tagfile);
     tagfiledir = absolute_dirname (tagfile, cwd);
+    }
 
   init ();                     /* set up boolean "functions" */
 
@@ -1420,7 +1423,7 @@
   compressor *compr;
   char *slash, *suffix;
 
-  /* This relies on FN to be after canonicalize_filename,
+  /* File has been processed by canonicalize_filename,
      so we don't need to consider backslashes on DOS_NT.  */
   slash = etags_strrchr (file, '/');
   suffix = etags_strrchr (file, '.');
@@ -6221,7 +6224,7 @@
                  discard_until_line_directive = FALSE; /* found it */
                  name = lbp->buffer + start;
                  *endp = '\0';
-                 canonicalize_filename (name); /* for DOS */
+                 canonicalize_filename (name);
                  taggedabsname = absolute_filename (name, tagfiledir);
                  if (filename_is_absolute (name)
                      || filename_is_absolute (curfdp->infname))
@@ -6636,14 +6639,8 @@
 
   /* Build a sequence of "../" strings for the resulting relative file name. */
   i = 0;
-  while (*dp == '/')
-    ++dp;
   while ((dp = etags_strchr (dp + 1, '/')) != NULL)
-    {
       i += 1;
-      while (*dp == '/')
-       ++dp;
-    }
   res = xnew (3*i + strlen (fp + 1) + 1, char);
   res[0] = '\0';
   while (i-- > 0)
@@ -6730,7 +6727,6 @@
   char *slashp, *res;
   char save;
 
-  canonicalize_filename (file);
   slashp = etags_strrchr (file, '/');
   if (slashp == NULL)
     return savestr (dir);
@@ -6755,27 +6751,38 @@
          );
 }
 
-/* Translate backslashes into slashes.  Works in place. */
+/* Upcase DOS drive letter and collapse separators into single slashes.
+   Works in place. */
 static void
 canonicalize_filename (fn)
      register char *fn;
 {
+  register char* cp;
+  char sep = '/';
+
 #ifdef DOS_NT
   /* Canonicalize drive letter case.  */
   if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0]))
     fn[0] = upcase (fn[0]);
-  /* Convert backslashes to slashes.  */
-  for (; *fn != '\0'; fn++)
-    if (*fn == '\\')
-      *fn = '/';
-#else
-  /* No action. */
-  fn = NULL;                   /* shut up the compiler */
+
+  sep = '\\';
 #endif
+
+  /* Collapse multiple separators into a single slash. */
+  for (cp = fn; *cp != '\0'; cp++, fn++)
+    if (*cp == sep)
+      {
+       *fn = '/';
+       while (cp[1] == sep)
+         cp++;
+      }
+    else
+      *fn = *cp;
+  *fn = '\0';
 }
 
 
-/* Initialize a linebuffer for use */
+/* Initialize a linebuffer for use. */
 static void
 linebuffer_init (lbp)
      linebuffer *lbp;




reply via email to

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