/[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.48 by gerd, Tue Oct 9 10:18:30 2001 UTC revision 1.49 by pj, Wed Dec 19 07:21:00 2001 UTC
# Line 21  Boston, MA 02111-1307, USA.  */ Line 21  Boston, MA 02111-1307, USA.  */
21    
22    
23  #define NO_SHORTNAMES  #define NO_SHORTNAMES
24  #include <../src/config.h>  
25    #ifdef HAVE_CONFIG_H
26    #include "config.h"
27    #endif
28    
29  #undef signal  #undef signal
30    
31  #include <ctype.h>  #include <ctype.h>
32  #include <stdio.h>  #include <stdio.h>
33  #include <getopt.h>  #include <getopt.h>
34  #ifdef HAVE_UNISTD_H  #ifdef HAVE_UNISTD_H
# Line 84  decode_options (argc, argv) Line 88  decode_options (argc, argv)
88          break;          break;
89    
90        alternate_editor = getenv ("ALTERNATE_EDITOR");        alternate_editor = getenv ("ALTERNATE_EDITOR");
91          
92        switch (opt)        switch (opt)
93          {          {
94          case 0:          case 0:
95            /* If getopt returns 0, then it has already processed a            /* If getopt returns 0, then it has already processed a
96               long-named option.  We should do nothing.  */               long-named option.  We should do nothing.  */
97            break;            break;
98              
99          case 'a':          case 'a':
100            alternate_editor = optarg;            alternate_editor = optarg;
101            break;            break;
102              
103          case 'n':          case 'n':
104            nowait = 1;            nowait = 1;
105            break;            break;
# Line 157  quote_file_name (name) Line 161  quote_file_name (name)
161      }      }
162    *q++ = 0;    *q++ = 0;
163    
     
164    return copy;    return copy;
165  }  }
166    
# Line 198  fail (argc, argv) Line 201  fail (argc, argv)
201  }  }
202    
203    
         
204    
205  #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)  #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
206    
# Line 272  main (argc, argv) Line 274  main (argc, argv)
274    if (argc - optind < 1)    if (argc - optind < 1)
275      print_help_and_exit ();      print_help_and_exit ();
276    
277    /*    /*
278     * Open up an AF_UNIX socket in this person's home directory     * Open up an AF_UNIX socket in this person's home directory
279     */     */
280    
# Line 282  main (argc, argv) Line 284  main (argc, argv)
284        perror ("socket");        perror ("socket");
285        fail (argc, argv);        fail (argc, argv);
286      }      }
287      
288    server.sun_family = AF_UNIX;    server.sun_family = AF_UNIX;
289    
290    {    {
# Line 317  main (argc, argv) Line 319  main (argc, argv)
319             our euid.  If so, look for a socket based on the UID             our euid.  If so, look for a socket based on the UID
320             associated with the name.  This is reminiscent of the logic             associated with the name.  This is reminiscent of the logic
321             that init_editfns uses to set the global Vuser_full_name.  */             that init_editfns uses to set the global Vuser_full_name.  */
322    
323          char *user_name = (char *) getenv ("LOGNAME");          char *user_name = (char *) getenv ("LOGNAME");
324          if (!user_name)          if (!user_name)
325            user_name = (char *) getenv ("USER");            user_name = (char *) getenv ("USER");
326          
327          if (user_name)          if (user_name)
328            {            {
329              struct passwd *pw = getpwnam (user_name);              struct passwd *pw = getpwnam (user_name);
# Line 334  main (argc, argv) Line 336  main (argc, argv)
336                }                }
337            }            }
338        }        }
339    
340       switch (sock_status)       switch (sock_status)
341         {         {
342         case 1:         case 1:
# Line 346  main (argc, argv) Line 348  main (argc, argv)
348               fail (argc, argv);               fail (argc, argv);
349             }             }
350           break;           break;
351            
352         case 2:         case 2:
353           /* `stat' failed */           /* `stat' failed */
354           if (errno == ENOENT)           if (errno == ENOENT)
# Line 448  main (argc, argv) Line 450  main (argc, argv)
450       the first line we read will actually be the output we just sent.       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       We can't predict whether that will happen, so if it does, we
452       detect it by recognizing `Client: ' at the beginning.  */       detect it by recognizing `Client: ' at the beginning.  */
453      
454    while (str = fgets (string, BUFSIZ, in))    while ((str = fgets (string, BUFSIZ, in)))
455      printf ("%s", str);      printf ("%s", str);
456    
457    return 0;    return 0;

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

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