/[emacs]/emacs/lib-src/emacsclient.c
ViewVC logotype

Diff of /emacs/lib-src/emacsclient.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.50 by pj, Sat Dec 29 22:20:06 2001 UTC revision 1.51 by monnier, Wed Sep 18 01:44:05 2002 UTC
# Line 64  struct option longopts[] = Line 64  struct option longopts[] =
64    { "no-wait",  no_argument,       NULL, 'n' },    { "no-wait",  no_argument,       NULL, 'n' },
65    { "help",     no_argument,       NULL, 'H' },    { "help",     no_argument,       NULL, 'H' },
66    { "version",  no_argument,       NULL, 'V' },    { "version",  no_argument,       NULL, 'V' },
67    { "alternate-editor",required_argument, NULL, 'a' },    { "alternate-editor", required_argument, NULL, 'a' },
68    { 0 }    { 0 }
69  };  };
70    
# Line 131  print_help_and_exit () Line 131  print_help_and_exit ()
131  }  }
132    
133  /* Return a copy of NAME, inserting a &  /* Return a copy of NAME, inserting a &
134     before each &, each space, and any initial -.     before each &, each space, each newline, and any initial -.
135     Change spaces to underscores, too, so that the     Change spaces to underscores, too, so that the
136     return value never contains a space.  */     return value never contains a space.  */
137    
# Line 152  quote_file_name (name) Line 152  quote_file_name (name)
152            *q++ = '_';            *q++ = '_';
153            p++;            p++;
154          }          }
155          else if (*p == '\n')
156            {
157              *q++ = '&';
158              *q++ = 'n';
159              p++;
160            }
161        else        else
162          {          {
163            if (*p == '&' || (*p == '-' && p == name))            if (*p == '&' || (*p == '-' && p == name))
# Line 190  fail (argc, argv) Line 196  fail (argc, argv)
196  {  {
197    if (alternate_editor)    if (alternate_editor)
198      {      {
199        int i = optind -1 ;        int i = optind - 1;
200        execvp (alternate_editor, argv + i);        execvp (alternate_editor, argv + i);
201        return;        return;
202      }      }
# Line 257  main (argc, argv) Line 263  main (argc, argv)
263  {  {
264    char *system_name;    char *system_name;
265    int system_name_length;    int system_name_length;
266    int s, i;    int s, i, needlf = 0;
267    FILE *out, *in;    FILE *out, *in;
268    struct sockaddr_un server;    struct sockaddr_un server;
269  #ifdef SERVER_HOME_DIR  #ifdef SERVER_HOME_DIR
# Line 444  main (argc, argv) Line 450  main (argc, argv)
450      return 0;      return 0;
451    
452    printf ("Waiting for Emacs...");    printf ("Waiting for Emacs...");
453      needlf = 2;
454    fflush (stdout);    fflush (stdout);
455    
456    /* Now, wait for an answer and print any messages.  On some systems,    /* Now, wait for an answer and print any messages.  */
      the first line we read will actually be the output we just sent.  
      We can't predict whether that will happen, so if it does, we  
      detect it by recognizing `Client: ' at the beginning.  */  
   
457    while ((str = fgets (string, BUFSIZ, in)))    while ((str = fgets (string, BUFSIZ, in)))
458      printf ("%s", str);      {
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);
468    
469    return 0;    return 0;
470  }  }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26