aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-04-01 20:38:35 +0000
committerRichard M. Stallman1996-04-01 20:38:35 +0000
commitce7f6d62bc26f6149e34cb6053cda9de9b1b3727 (patch)
tree653c04cbcb29911d289accd7cf2dd5fbc888ece6 /lib-src
parent707893ee83c68e76ec9758c094ba7a1886000eac (diff)
downloademacs-ce7f6d62bc26f6149e34cb6053cda9de9b1b3727.tar.gz
emacs-ce7f6d62bc26f6149e34cb6053cda9de9b1b3727.zip
(absolutefn) [DOS_NT]: Support Novell drives whose drive
letter isn't an alphabetic character. (main) [DOS_NT]: Use binary mode on redirected `stdout'. (process_file) [DOS_NT]: Convert all slashes to forward style. (absolute_filename) [DOS_NT]: Emit error message for relative paths with a drive letter. (absolute_filename) [DOS_NT]: Handle absolute pathnames with DOS/NT drive letters which try to reference the parent of the root. (absolute_dirname) [DOS_NT]: Convert all slashes to forward style. info, and don't record undo info for the conversion.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c57
1 files changed, 51 insertions, 6 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 5e6b7990d1c..77975c625aa 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -41,6 +41,7 @@ char pot_etags_version[] = "@(#) pot revision number is 11.59";
41#endif 41#endif
42 42
43#ifdef MSDOS 43#ifdef MSDOS
44# include <string.h>
44# include <fcntl.h> 45# include <fcntl.h>
45# include <sys/param.h> 46# include <sys/param.h>
46#endif /* MSDOS */ 47#endif /* MSDOS */
@@ -114,7 +115,7 @@ extern int errno;
114 115
115#ifdef DOS_NT 116#ifdef DOS_NT
116# define absolutefn(fn) (fn[0] == '/' \ 117# define absolutefn(fn) (fn[0] == '/' \
117 || (isalpha (fn[0]) && fn[1] == ':' && fn[2] == '/')) 118 || (fn[1] == ':' && fn[2] == '/'))
118#else 119#else
119# define absolutefn(fn) (fn[0] == '/') 120# define absolutefn(fn) (fn[0] == '/')
120#endif 121#endif
@@ -874,7 +875,15 @@ main (argc, argv)
874 if (!CTAGS) 875 if (!CTAGS)
875 { 876 {
876 if (streq (tagfile, "-")) 877 if (streq (tagfile, "-"))
877 tagf = stdout; 878 {
879 tagf = stdout;
880#ifdef DOS_NT
881 /* Switch redirected `stdout' to binary mode (setting `_fmode'
882 doesn't take effect until after `stdout' is already open), */
883 if (!isatty (fileno (stdout)))
884 setmode (fileno (stdout), O_BINARY);
885#endif /* DOS_NT */
886 }
878 else 887 else
879 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); 888 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
880 if (tagf == NULL) 889 if (tagf == NULL)
@@ -1060,6 +1069,17 @@ process_file (file)
1060{ 1069{
1061 struct stat stat_buf; 1070 struct stat stat_buf;
1062 FILE *inf; 1071 FILE *inf;
1072#ifdef DOS_NT
1073 /* The rest of the program can't grok `\\'-style slashes. */
1074 char *p = file;
1075
1076 while (*p)
1077 {
1078 if (*p == '\\')
1079 *p = '/';
1080 ++p;
1081 }
1082#endif
1063 1083
1064 if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode)) 1084 if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode))
1065 { 1085 {
@@ -4299,10 +4319,12 @@ etags_getcwd ()
4299 getwd (path); 4319 getwd (path);
4300 p = path; 4320 p = path;
4301 while (*p) 4321 while (*p)
4302 if (*p == '\\') 4322 {
4303 *p++ = '/'; 4323 if (*p == '\\')
4304 else 4324 *p++ = '/';
4305 *p++ = lowcase (*p); 4325 else
4326 *p++ = lowcase (*p);
4327 }
4306 4328
4307 return strdup (path); 4329 return strdup (path);
4308#else /* not DOS_NT */ 4330#else /* not DOS_NT */
@@ -4382,6 +4404,12 @@ absolute_filename (file, cwd)
4382 4404
4383 if (absolutefn (file)) 4405 if (absolutefn (file))
4384 res = concat (file, "", ""); 4406 res = concat (file, "", "");
4407#ifdef DOS_NT
4408 /* We don't support non-absolute filenames with a drive
4409 letter, like `d:NAME' (it's too much hassle). */
4410 else if (file[1] == ':')
4411 fatal ("%s: relative filenames with drive letters not supported", file);
4412#endif
4385 else 4413 else
4386 res = concat (cwd, file, ""); 4414 res = concat (cwd, file, "");
4387 4415
@@ -4402,6 +4430,13 @@ absolute_filename (file, cwd)
4402 { 4430 {
4403 strcpy (cp, slashp + 3); 4431 strcpy (cp, slashp + 3);
4404 } 4432 }
4433#ifdef DOS_NT
4434 /* Under MSDOS and NT we get `d:/NAME' as absolute
4435 filename, so the luser could say `d:/../NAME'.
4436 We silently treat this as `d:/NAME'. */
4437 else if (cp[1] == ':')
4438 strcpy (cp + 3, slashp + 4);
4439#endif
4405 else /* else (cp == res) */ 4440 else /* else (cp == res) */
4406 { 4441 {
4407 if (slashp[3] != '\0') 4442 if (slashp[3] != '\0')
@@ -4434,6 +4469,16 @@ absolute_dirname (file, cwd)
4434{ 4469{
4435 char *slashp, *res; 4470 char *slashp, *res;
4436 char save; 4471 char save;
4472#ifdef DOS_NT
4473 char *p = file;
4474
4475 while (*p)
4476 {
4477 if (*p == '\\')
4478 *p = '/';
4479 ++p;
4480 }
4481#endif
4437 4482
4438 slashp = etags_strrchr (file, '/'); 4483 slashp = etags_strrchr (file, '/');
4439 if (slashp == NULL) 4484 if (slashp == NULL)