diff lib-src/emacsclient.c @ 16074:25cfff7ffced

(quote_file_name): Quote with &, not \. Quote `-' only at start of file name. Terminate the value string.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Sep 1996 17:43:32 +0000
parents a1290c4159b5
children a649abfefbb1
line wrap: on
line diff
--- a/lib-src/emacsclient.c	Mon Sep 02 17:28:10 1996 +0000
+++ b/lib-src/emacsclient.c	Mon Sep 02 17:43:32 1996 +0000
@@ -104,8 +104,8 @@
   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 @@
     {
       if (*p == ' ')
 	{
-	  *q++ = '\\';
+	  *q++ = '&';
 	  *q++ = '_';
 	  p++;
 	}
       else
 	{
-	  if (*p == '\\' || *p == '-')
-	    *q++ = '\\';
+	  if (*p == '&' || (*p == '-' && p == name))
+	    *q++ = '&';
 	  *q++ = *p++;
 	}
     }
+  *q++ = 0;
 
   return copy;
 }