diff options
| author | Francesco Potortì | 2008-08-16 23:57:41 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2008-08-16 23:57:41 +0000 |
| commit | 9817cf3f9ef1ee5a13765e22edb6db9d24bb7844 (patch) | |
| tree | 8d558ec2769851809574eb328bb099e6c27f5b5c /lib-src | |
| parent | 228a8cfd45584c62e006e56457dec275a66866c9 (diff) | |
| download | emacs-9817cf3f9ef1ee5a13765e22edb6db9d24bb7844.tar.gz emacs-9817cf3f9ef1ee5a13765e22edb6db9d24bb7844.zip | |
(main): Use canonicalize_filename on tags file name.
(relative_filename): Revert 3.85: do not collapse slashes here.
(absolute_dirname): Remove useless call to canonicalize_filename.
(canonicalize_filename): Collapse multiple slashes here.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 56a84d6e0de..46e3b6e26e3 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -59,14 +59,14 @@ University of California, as described above. */ | |||
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * Authors: | 61 | * Authors: |
| 62 | * 1983 Ctags originally by Ken Arnold. | 62 | * 1983 Ctags originally by Ken Arnold. |
| 63 | * 1984 Fortran added by Jim Kleckner. | 63 | * 1984 Fortran added by Jim Kleckner. |
| 64 | * 1984 Ed Pelegri-Llopart added C typedefs. | 64 | * 1984 Ed Pelegri-Llopart added C typedefs. |
| 65 | * 1985 Emacs TAGS format by Richard Stallman. | 65 | * 1985 Emacs TAGS format by Richard Stallman. |
| 66 | * 1989 Sam Kendall added C++. | 66 | * 1989 Sam Kendall added C++. |
| 67 | * 1992 Joseph B. Wells improved C and C++ parsing. | 67 | * 1992 Joseph B. Wells improved C and C++ parsing. |
| 68 | * 1993 Francesco Potortì reorganized C and C++. | 68 | * 1993 Francesco Potortì reorganized C and C++. |
| 69 | * 1994 Line-by-line regexp tags by Tom Tromey. | 69 | * 1994 Line-by-line regexp tags by Tom Tromey. |
| 70 | * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba). | 70 | * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba). |
| 71 | * 2002 #line directives by Francesco Potortì. | 71 | * 2002 #line directives by Francesco Potortì. |
| 72 | * | 72 | * |
| @@ -75,11 +75,11 @@ University of California, as described above. */ | |||
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | * If you want to add support for a new language, start by looking at the LUA | 77 | * If you want to add support for a new language, start by looking at the LUA |
| 78 | * language, which is the simplest. Alternatively, consider shipping a | 78 | * language, which is the simplest. Alternatively, consider distributing etags |
| 79 | * configuration file containing regexp definitions for etags. | 79 | * together with a configuration file containing regexp definitions for etags. |
| 80 | */ | 80 | */ |
| 81 | 81 | ||
| 82 | char pot_etags_version[] = "@(#) pot revision number is 17.38"; | 82 | char pot_etags_version[] = "@(#) pot revision number is 17.38.1.3"; |
| 83 | 83 | ||
| 84 | #define TRUE 1 | 84 | #define TRUE 1 |
| 85 | #define FALSE 0 | 85 | #define FALSE 0 |
| @@ -892,7 +892,7 @@ etags --help --lang=ada."); | |||
| 892 | # define EMACS_NAME "standalone" | 892 | # define EMACS_NAME "standalone" |
| 893 | #endif | 893 | #endif |
| 894 | #ifndef VERSION | 894 | #ifndef VERSION |
| 895 | # define VERSION "17.38" | 895 | # define VERSION "17.38.1.3" |
| 896 | #endif | 896 | #endif |
| 897 | static void | 897 | static void |
| 898 | print_version () | 898 | print_version () |
| @@ -1264,7 +1264,10 @@ main (argc, argv) | |||
| 1264 | || strneq (tagfile, "/dev/", 5)) | 1264 | || strneq (tagfile, "/dev/", 5)) |
| 1265 | tagfiledir = cwd; | 1265 | tagfiledir = cwd; |
| 1266 | else | 1266 | else |
| 1267 | tagfiledir = absolute_dirname (tagfile, cwd); | 1267 | { |
| 1268 | canonicalize_filename (tagfile); | ||
| 1269 | tagfiledir = absolute_dirname (tagfile, cwd); | ||
| 1270 | } | ||
| 1268 | 1271 | ||
| 1269 | init (); /* set up boolean "functions" */ | 1272 | init (); /* set up boolean "functions" */ |
| 1270 | 1273 | ||
| @@ -1420,7 +1423,7 @@ get_compressor_from_suffix (file, extptr) | |||
| 1420 | compressor *compr; | 1423 | compressor *compr; |
| 1421 | char *slash, *suffix; | 1424 | char *slash, *suffix; |
| 1422 | 1425 | ||
| 1423 | /* This relies on FN to be after canonicalize_filename, | 1426 | /* File has been processed by canonicalize_filename, |
| 1424 | so we don't need to consider backslashes on DOS_NT. */ | 1427 | so we don't need to consider backslashes on DOS_NT. */ |
| 1425 | slash = etags_strrchr (file, '/'); | 1428 | slash = etags_strrchr (file, '/'); |
| 1426 | suffix = etags_strrchr (file, '.'); | 1429 | suffix = etags_strrchr (file, '.'); |
| @@ -6221,7 +6224,7 @@ readline (lbp, stream) | |||
| 6221 | discard_until_line_directive = FALSE; /* found it */ | 6224 | discard_until_line_directive = FALSE; /* found it */ |
| 6222 | name = lbp->buffer + start; | 6225 | name = lbp->buffer + start; |
| 6223 | *endp = '\0'; | 6226 | *endp = '\0'; |
| 6224 | canonicalize_filename (name); /* for DOS */ | 6227 | canonicalize_filename (name); |
| 6225 | taggedabsname = absolute_filename (name, tagfiledir); | 6228 | taggedabsname = absolute_filename (name, tagfiledir); |
| 6226 | if (filename_is_absolute (name) | 6229 | if (filename_is_absolute (name) |
| 6227 | || filename_is_absolute (curfdp->infname)) | 6230 | || filename_is_absolute (curfdp->infname)) |
| @@ -6636,14 +6639,8 @@ relative_filename (file, dir) | |||
| 6636 | 6639 | ||
| 6637 | /* Build a sequence of "../" strings for the resulting relative file name. */ | 6640 | /* Build a sequence of "../" strings for the resulting relative file name. */ |
| 6638 | i = 0; | 6641 | i = 0; |
| 6639 | while (*dp == '/') | ||
| 6640 | ++dp; | ||
| 6641 | while ((dp = etags_strchr (dp + 1, '/')) != NULL) | 6642 | while ((dp = etags_strchr (dp + 1, '/')) != NULL) |
| 6642 | { | 6643 | i += 1; |
| 6643 | i += 1; | ||
| 6644 | while (*dp == '/') | ||
| 6645 | ++dp; | ||
| 6646 | } | ||
| 6647 | res = xnew (3*i + strlen (fp + 1) + 1, char); | 6644 | res = xnew (3*i + strlen (fp + 1) + 1, char); |
| 6648 | res[0] = '\0'; | 6645 | res[0] = '\0'; |
| 6649 | while (i-- > 0) | 6646 | while (i-- > 0) |
| @@ -6730,7 +6727,6 @@ absolute_dirname (file, dir) | |||
| 6730 | char *slashp, *res; | 6727 | char *slashp, *res; |
| 6731 | char save; | 6728 | char save; |
| 6732 | 6729 | ||
| 6733 | canonicalize_filename (file); | ||
| 6734 | slashp = etags_strrchr (file, '/'); | 6730 | slashp = etags_strrchr (file, '/'); |
| 6735 | if (slashp == NULL) | 6731 | if (slashp == NULL) |
| 6736 | return savestr (dir); | 6732 | return savestr (dir); |
| @@ -6755,27 +6751,38 @@ filename_is_absolute (fn) | |||
| 6755 | ); | 6751 | ); |
| 6756 | } | 6752 | } |
| 6757 | 6753 | ||
| 6758 | /* Translate backslashes into slashes. Works in place. */ | 6754 | /* Upcase DOS drive letter and collapse separators into single slashes. |
| 6755 | Works in place. */ | ||
| 6759 | static void | 6756 | static void |
| 6760 | canonicalize_filename (fn) | 6757 | canonicalize_filename (fn) |
| 6761 | register char *fn; | 6758 | register char *fn; |
| 6762 | { | 6759 | { |
| 6760 | register char* cp; | ||
| 6761 | char sep = '/'; | ||
| 6762 | |||
| 6763 | #ifdef DOS_NT | 6763 | #ifdef DOS_NT |
| 6764 | /* Canonicalize drive letter case. */ | 6764 | /* Canonicalize drive letter case. */ |
| 6765 | if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0])) | 6765 | if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0])) |
| 6766 | fn[0] = upcase (fn[0]); | 6766 | fn[0] = upcase (fn[0]); |
| 6767 | /* Convert backslashes to slashes. */ | 6767 | |
| 6768 | for (; *fn != '\0'; fn++) | 6768 | sep = '\\'; |
| 6769 | if (*fn == '\\') | ||
| 6770 | *fn = '/'; | ||
| 6771 | #else | ||
| 6772 | /* No action. */ | ||
| 6773 | fn = NULL; /* shut up the compiler */ | ||
| 6774 | #endif | 6769 | #endif |
| 6770 | |||
| 6771 | /* Collapse multiple separators into a single slash. */ | ||
| 6772 | for (cp = fn; *cp != '\0'; cp++, fn++) | ||
| 6773 | if (*cp == sep) | ||
| 6774 | { | ||
| 6775 | *fn = '/'; | ||
| 6776 | while (cp[1] == sep) | ||
| 6777 | cp++; | ||
| 6778 | } | ||
| 6779 | else | ||
| 6780 | *fn = *cp; | ||
| 6781 | *fn = '\0'; | ||
| 6775 | } | 6782 | } |
| 6776 | 6783 | ||
| 6777 | 6784 | ||
| 6778 | /* Initialize a linebuffer for use */ | 6785 | /* Initialize a linebuffer for use. */ |
| 6779 | static void | 6786 | static void |
| 6780 | linebuffer_init (lbp) | 6787 | linebuffer_init (lbp) |
| 6781 | linebuffer *lbp; | 6788 | linebuffer *lbp; |