summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-09-02 17:43:32 +0000
committerRichard M. Stallman <rms@gnu.org>1996-09-02 17:43:32 +0000
commit8e11a8b789b711997544a05c3c214b0497fceb54 (patch)
tree99c943550f5bc5dc151e1799ce289bbc248bbdb8 /lib-src
parenta3de2a89c4bd6947892088c9d985c67c9d38f96d (diff)
downloademacs-8e11a8b789b711997544a05c3c214b0497fceb54.tar.gz
(quote_file_name): Quote with &, not \.
Quote `-' only at start of file name. Terminate the value string.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 12c6b66040c..4d8037dea67 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -104,8 +104,8 @@ print_help_and_exit ()
exit (1);
}
-/* Return a copy of NAME, inserting a \
- before each \, each -, and each space.
+/* Return a copy of NAME, inserting a &
+ before each &, each space, and any initial -.
Change spaces to underscores, too, so that the
return value never contains a space. */
@@ -122,17 +122,18 @@ quote_file_name (name)
{
if (*p == ' ')
{
- *q++ = '\\';
+ *q++ = '&';
*q++ = '_';
p++;
}
else
{
- if (*p == '\\' || *p == '-')
- *q++ = '\\';
+ if (*p == '&' || (*p == '-' && p == name))
+ *q++ = '&';
*q++ = *p++;
}
}
+ *q++ = 0;
return copy;
}