aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c32
2 files changed, 27 insertions, 10 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 10dfa8163ac..c11b4295a53 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
12002-09-17 Stefan Monnier <monnier@cs.yale.edu>
2
3 * emacsclient.c (quote_file_name): Quote \n.
4 (main): Print a final \n when needed.
5
12002-09-03 Francesco Potorti` <pot@gnu.org> 62002-09-03 Francesco Potorti` <pot@gnu.org>
2 7
3 * etags.c (regex_tag_multiline, readline): Never pass pfnote a 8 * etags.c (regex_tag_multiline, readline): Never pass pfnote a
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 27bce2d0b1d..d63ab3c5d10 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -64,7 +64,7 @@ struct option longopts[] =
64 { "no-wait", no_argument, NULL, 'n' }, 64 { "no-wait", no_argument, NULL, 'n' },
65 { "help", no_argument, NULL, 'H' }, 65 { "help", no_argument, NULL, 'H' },
66 { "version", no_argument, NULL, 'V' }, 66 { "version", no_argument, NULL, 'V' },
67 { "alternate-editor",required_argument, NULL, 'a' }, 67 { "alternate-editor", required_argument, NULL, 'a' },
68 { 0 } 68 { 0 }
69}; 69};
70 70
@@ -131,7 +131,7 @@ print_help_and_exit ()
131} 131}
132 132
133/* Return a copy of NAME, inserting a & 133/* Return a copy of NAME, inserting a &
134 before each &, each space, and any initial -. 134 before each &, each space, each newline, and any initial -.
135 Change spaces to underscores, too, so that the 135 Change spaces to underscores, too, so that the
136 return value never contains a space. */ 136 return value never contains a space. */
137 137
@@ -152,6 +152,12 @@ quote_file_name (name)
152 *q++ = '_'; 152 *q++ = '_';
153 p++; 153 p++;
154 } 154 }
155 else if (*p == '\n')
156 {
157 *q++ = '&';
158 *q++ = 'n';
159 p++;
160 }
155 else 161 else
156 { 162 {
157 if (*p == '&' || (*p == '-' && p == name)) 163 if (*p == '&' || (*p == '-' && p == name))
@@ -190,7 +196,7 @@ fail (argc, argv)
190{ 196{
191 if (alternate_editor) 197 if (alternate_editor)
192 { 198 {
193 int i = optind -1 ; 199 int i = optind - 1;
194 execvp (alternate_editor, argv + i); 200 execvp (alternate_editor, argv + i);
195 return; 201 return;
196 } 202 }
@@ -257,7 +263,7 @@ main (argc, argv)
257{ 263{
258 char *system_name; 264 char *system_name;
259 int system_name_length; 265 int system_name_length;
260 int s, i; 266 int s, i, needlf = 0;
261 FILE *out, *in; 267 FILE *out, *in;
262 struct sockaddr_un server; 268 struct sockaddr_un server;
263#ifdef SERVER_HOME_DIR 269#ifdef SERVER_HOME_DIR
@@ -444,15 +450,21 @@ main (argc, argv)
444 return 0; 450 return 0;
445 451
446 printf ("Waiting for Emacs..."); 452 printf ("Waiting for Emacs...");
453 needlf = 2;
447 fflush (stdout); 454 fflush (stdout);
448 455
449 /* Now, wait for an answer and print any messages. On some systems, 456 /* Now, wait for an answer and print any messages. */
450 the first line we read will actually be the output we just sent.
451 We can't predict whether that will happen, so if it does, we
452 detect it by recognizing `Client: ' at the beginning. */
453
454 while ((str = fgets (string, BUFSIZ, in))) 457 while ((str = fgets (string, BUFSIZ, in)))
455 printf ("%s", str); 458 {
459 if (needlf == 2)
460 printf ("\n");
461 printf ("%s", str);
462 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
463 }
464
465 if (needlf)
466 printf ("\n");
467 fflush (stdout);
456 468
457 return 0; 469 return 0;
458} 470}