/[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.60 by miles, Mon Sep 1 15:45:03 2003 UTC revision 1.61 by rms, Fri Sep 12 00:48:03 2003 UTC
# Line 67  char *display = NULL; Line 67  char *display = NULL;
67     is not running.  --alternate-editor.   */     is not running.  --alternate-editor.   */
68  const char * alternate_editor = NULL;  const char * alternate_editor = NULL;
69    
70    /* If non-NULL, thefilename of the UNIX socket */
71    char *socket_name = NULL;
72    
73  void print_help_and_exit ();  void print_help_and_exit ();
74    
75  struct option longopts[] =  struct option longopts[] =
# Line 76  struct option longopts[] = Line 79  struct option longopts[] =
79    { "help",     no_argument,       NULL, 'H' },    { "help",     no_argument,       NULL, 'H' },
80    { "version",  no_argument,       NULL, 'V' },    { "version",  no_argument,       NULL, 'V' },
81    { "alternate-editor", required_argument, NULL, 'a' },    { "alternate-editor", required_argument, NULL, 'a' },
82      { "socket-name",      required_argument, NULL, 's' },
83    { "display",  required_argument, NULL, 'd' },    { "display",  required_argument, NULL, 'd' },
84    { 0, 0, 0, 0 }    { 0, 0, 0, 0 }
85  };  };
# Line 91  decode_options (argc, argv) Line 95  decode_options (argc, argv)
95    while (1)    while (1)
96      {      {
97        int opt = getopt_long (argc, argv,        int opt = getopt_long (argc, argv,
98                               "VHnea:d:", longopts, 0);                               "VHnea:s:d:", longopts, 0);
99    
100        if (opt == EOF)        if (opt == EOF)
101          break;          break;
# Line 109  decode_options (argc, argv) Line 113  decode_options (argc, argv)
113            alternate_editor = optarg;            alternate_editor = optarg;
114            break;            break;
115    
116            case 's':
117              socket_name = optarg;
118              break;
119    
120          case 'd':          case 'd':
121            display = optarg;            display = optarg;
122            break;            break;
# Line 152  The following OPTIONS are accepted:\n\ Line 160  The following OPTIONS are accepted:\n\
160  -n, --no-wait           Don't wait for the server to return\n\  -n, --no-wait           Don't wait for the server to return\n\
161  -e, --eval              Evaluate the FILE arguments as ELisp expressions\n\  -e, --eval              Evaluate the FILE arguments as ELisp expressions\n\
162  -d, --display=DISPLAY   Visit the file in the given display\n\  -d, --display=DISPLAY   Visit the file in the given display\n\
163    -s, --socket-name=FILENAME\n\
164                            Set the filename of the UNIX socket for communication\n\
165  -a, --alternate-editor=EDITOR\n\  -a, --alternate-editor=EDITOR\n\
166                          Editor to fallback to if the server is not running\n\                          Editor to fallback to if the server is not running\n\
167  \n\  \n\
# Line 347  main (argc, argv) Line 357  main (argc, argv)
357    {    {
358      int sock_status = 0;      int sock_status = 0;
359    
360      sprintf (server.sun_path, "/tmp/emacs%d-%s/server", (int) geteuid (), system_name);      if (! socket_name)
361          {
362            socket_name = alloca (system_name_length + 100);
363            sprintf (socket_name, "/tmp/emacs%d-%s/server",
364                     (int) geteuid (), system_name);
365          }
366    
367        if (strlen (socket_name) < sizeof (server.sun_path))
368          strcpy (server.sun_path, socket_name);
369        else
370          fprintf (stderr, "%s: socket-name %s too long",
371                   argv[0], socket_name);
372    
373      /* See if the socket exists, and if it's owned by us. */      /* See if the socket exists, and if it's owned by us. */
374      sock_status = socket_status (server.sun_path);      sock_status = socket_status (server.sun_path);

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

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