comparison lib-src/emacsclient.c @ 89943:4c90ffeb71c5

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221 Restore deleted tagline in etc/TUTORIAL.ru * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229 Remove TeX output files from the archive * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248 src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264 Update from CVS: lispref/display.texi: emacs -> Emacs. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275 Update from CVS: man/makefile.w32-in: Revert last change * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296 Allow restarting an existing debugger session that's exited * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328 Update from CVS: src/.gdbinit (xsymbol): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345 Tweak source regexps so that building in place won't cause problems * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352 Update from CVS: lisp/flymake.el: New file. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362 Support " [...]" style defaults in minibuffer-electric-default-mode * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363 (read-number): Use canonical format for default in prompt. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368 Improve display-supports-face-attributes-p on non-ttys * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369 Rewrite face-differs-from-default-p * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370 Move `display-supports-face-attributes-p' entirely into C code * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372 Simplify face-differs-from-default-p; don't consider :stipple. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374 (tty_supports_face_attributes_p): Ensure attributes differ from default * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377 (Fdisplay_supports_face_attributes_p): Work around bootstrapping problem * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381 Face merging cleanups * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385 src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396 Tweak arch tagging to make build/install-in-place less annoying * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397 Work around vc-arch problems when building eshell * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399 Tweak directory permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401 More build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403 Yet more build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410 Make sure image types are initialized for lookup too * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416 Update from CVS
author Miles Bader <miles@gnu.org>
date Mon, 28 Jun 2004 07:56:49 +0000
parents 68c22ea6027c a47704955f8d
children b9eee0a7bef5
comparison
equal deleted inserted replaced
89942:9cb747ae49af 89943:4c90ffeb71c5
41 # include <pwd.h> 41 # include <pwd.h>
42 #endif /* not VMS */ 42 #endif /* not VMS */
43 43
44 char *getenv (), *getwd (); 44 char *getenv (), *getwd ();
45 char *getcwd (); 45 char *getcwd ();
46
47 /* This is defined with -D from the compilation command,
48 which extracts it from ../lisp/version.el. */
49 46
50 #ifndef VERSION 47 #ifndef VERSION
51 #define VERSION "unspecified" 48 #define VERSION "unspecified"
52 #endif 49 #endif
53 50
129 eval = 1; 126 eval = 1;
130 break; 127 break;
131 128
132 case 'V': 129 case 'V':
133 printf ("emacsclient %s\n", VERSION); 130 printf ("emacsclient %s\n", VERSION);
134 exit (0); 131 exit (EXIT_SUCCESS);
135 break; 132 break;
136 133
137 case 'H': 134 case 'H':
138 print_help_and_exit (); 135 print_help_and_exit ();
139 break; 136 break;
140 137
141 default: 138 default:
142 fprintf (stderr, "Try `%s --help' for more information\n", progname); 139 fprintf (stderr, "Try `%s --help' for more information\n", progname);
143 exit (1); 140 exit (EXIT_FAILURE);
144 break; 141 break;
145 } 142 }
146 } 143 }
147 } 144 }
148 145
164 Set the filename of the UNIX socket for communication\n\ 161 Set the filename of the UNIX socket for communication\n\
165 -a, --alternate-editor=EDITOR\n\ 162 -a, --alternate-editor=EDITOR\n\
166 Editor to fallback to if the server is not running\n\ 163 Editor to fallback to if the server is not running\n\
167 \n\ 164 \n\
168 Report bugs to bug-gnu-emacs@gnu.org.\n", progname); 165 Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
169 exit (0); 166 exit (EXIT_SUCCESS);
170 } 167 }
171 168
172 /* In NAME, insert a & before each &, each space, each newline, and 169 /* In NAME, insert a & before each &, each space, each newline, and
173 any initial -. Change spaces to underscores, too, so that the 170 any initial -. Change spaces to underscores, too, so that the
174 return value never contains a space. */ 171 return value never contains a space. */
219 { 216 {
220 long *result = (long *) malloc (size); 217 long *result = (long *) malloc (size);
221 if (result == NULL) 218 if (result == NULL)
222 { 219 {
223 perror ("malloc"); 220 perror ("malloc");
224 exit (1); 221 exit (EXIT_FAILURE);
225 } 222 }
226 return result; 223 return result;
227 } 224 }
228 225
229 /* 226 /*
241 execvp (alternate_editor, argv + i); 238 execvp (alternate_editor, argv + i);
242 return; 239 return;
243 } 240 }
244 else 241 else
245 { 242 {
246 exit (1); 243 exit (EXIT_FAILURE);
247 } 244 }
248 } 245 }
249 246
250 247
251 248
312 309
313 if ((argc - optind < 1) && !eval) 310 if ((argc - optind < 1) && !eval)
314 { 311 {
315 fprintf (stderr, "%s: file name or argument required\n", progname); 312 fprintf (stderr, "%s: file name or argument required\n", progname);
316 fprintf (stderr, "Try `%s --help' for more information\n", progname); 313 fprintf (stderr, "Try `%s --help' for more information\n", progname);
317 exit (1); 314 exit (EXIT_FAILURE);
318 } 315 }
319 316
320 /* 317 /*
321 * Open up an AF_UNIX socket in this person's home directory 318 * Open up an AF_UNIX socket in this person's home directory
322 */ 319 */
354 strcpy (server.sun_path, socket_name); 351 strcpy (server.sun_path, socket_name);
355 else 352 else
356 { 353 {
357 fprintf (stderr, "%s: socket-name %s too long", 354 fprintf (stderr, "%s: socket-name %s too long",
358 argv[0], socket_name); 355 argv[0], socket_name);
359 exit (1); 356 exit (EXIT_FAILURE);
360 } 357 }
361 358
362 /* See if the socket exists, and if it's owned by us. */ 359 /* See if the socket exists, and if it's owned by us. */
363 sock_status = socket_status (server.sun_path); 360 sock_status = socket_status (server.sun_path);
364 saved_errno = errno; 361 saved_errno = errno;
389 strcpy (server.sun_path, socket_name); 386 strcpy (server.sun_path, socket_name);
390 else 387 else
391 { 388 {
392 fprintf (stderr, "%s: socket-name %s too long", 389 fprintf (stderr, "%s: socket-name %s too long",
393 argv[0], socket_name); 390 argv[0], socket_name);
394 exit (1); 391 exit (EXIT_FAILURE);
395 } 392 }
396 393
397 sock_status = socket_status (server.sun_path); 394 sock_status = socket_status (server.sun_path);
398 saved_errno = errno; 395 saved_errno = errno;
399 } 396 }
520 { 517 {
521 quote_file_name (str, out); 518 quote_file_name (str, out);
522 } 519 }
523 fprintf (out, " "); 520 fprintf (out, " ");
524 } 521 }
525 522
526 fprintf (out, "\n"); 523 fprintf (out, "\n");
527 fflush (out); 524 fflush (out);
528 525
529 /* Maybe wait for an answer. */ 526 /* Maybe wait for an answer. */
530 if (nowait) 527 if (nowait)
531 return 0; 528 return EXIT_SUCCESS;
532 529
533 if (!eval) 530 if (!eval)
534 { 531 {
535 printf ("Waiting for Emacs..."); 532 printf ("Waiting for Emacs...");
536 needlf = 2; 533 needlf = 2;
548 545
549 if (needlf) 546 if (needlf)
550 printf ("\n"); 547 printf ("\n");
551 fflush (stdout); 548 fflush (stdout);
552 549
553 return 0; 550 return EXIT_SUCCESS;
554 } 551 }
555 552
556 #endif /* HAVE_SOCKETS */ 553 #endif /* HAVE_SOCKETS */
557 554
558 #ifndef HAVE_STRERROR 555 #ifndef HAVE_STRERROR
570 567
571 #endif /* ! HAVE_STRERROR */ 568 #endif /* ! HAVE_STRERROR */
572 569
573 /* arch-tag: f39bb9c4-73eb-477e-896d-50832e2ca9a7 570 /* arch-tag: f39bb9c4-73eb-477e-896d-50832e2ca9a7
574 (do not change this comment) */ 571 (do not change this comment) */
572
573 /* emacsclient.c ends here */