[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8a098f6517: Fix quoting of file names in 'ctags'
From: |
Eli Zaretskii |
Subject: |
master 8a098f6517: Fix quoting of file names in 'ctags' |
Date: |
Fri, 1 Jul 2022 09:18:16 -0400 (EDT) |
branch: master
commit 8a098f6517157ebe2364f08008b44ab49c2d1115
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix quoting of file names in 'ctags'
* lib-src/etags.c (main) [WINDOWSNT || MSDOS]: Quote file names
according to the rules of the system shells.
---
lib-src/etags.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 9a60714eca..ef11257926 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1431,6 +1431,16 @@ main (int argc, char **argv)
setenv ("LC_COLLATE", "C", 1);
setenv ("LC_ALL", "C", 1); */
char *cmd = xmalloc (8 * strlen (tagfile) + sizeof "sort -u -o '' ''");
+#if defined WINDOWSNT || defined MSDOS
+ /* Quote "like this". No need to escape the quotes in the file name,
+ since it is not allowed in file names on these systems. */
+ char *z = stpcpy (cmd, "sort -u -o \"");
+ z = stpcpy (z, tagfile);
+ z = stpcpy (z, "\" \"");
+ z = stpcpy (z, tagfile);
+ stpcpy (z, "\"");
+#else
+ /* Quote 'like this', and escape the apostrophe in the file name. */
char *z = stpcpy (cmd, "sort -u -o '");
char *escaped_tagfile = z;
for (; *tagfile; *z++ = *tagfile++)
@@ -1440,6 +1450,7 @@ main (int argc, char **argv)
z = stpcpy (z, "' '");
z = mempcpy (z, escaped_tagfile, escaped_tagfile_len);
strcpy (z, "'");
+#endif
return system (cmd);
}
return EXIT_SUCCESS;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8a098f6517: Fix quoting of file names in 'ctags',
Eli Zaretskii <=