Mercurial > emacs
comparison lib-src/emacsclient.c @ 83624:3b1222f7b28a
(print_help_and_exit): Restore and adapt trunk change from 2006-11-23 which was
lost in the merge.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 21 May 2007 12:15:52 +0000 |
parents | ce4352d8bee9 |
children | 7a881fda2c3a |
comparison
equal
deleted
inserted
replaced
83623:85ebbe91c285 | 83624:3b1222f7b28a |
---|---|
460 window_system = 1; | 460 window_system = 1; |
461 #if !defined (WINDOWSNT) && !defined (HAVE_CARBON) | 461 #if !defined (WINDOWSNT) && !defined (HAVE_CARBON) |
462 else | 462 else |
463 tty = 1; | 463 tty = 1; |
464 #endif | 464 #endif |
465 | 465 |
466 /* --no-wait implies --current-frame on ttys when there are file | 466 /* --no-wait implies --current-frame on ttys when there are file |
467 arguments or expressions given. */ | 467 arguments or expressions given. */ |
468 if (nowait && tty && argc - optind > 0) | 468 if (nowait && tty && argc - optind > 0) |
469 current_frame = 1; | 469 current_frame = 1; |
470 | 470 |
480 | 480 |
481 | 481 |
482 void | 482 void |
483 print_help_and_exit () | 483 print_help_and_exit () |
484 { | 484 { |
485 /* Spaces and tabs are significant in this message; they're chosen so the | |
486 message aligns properly both in a tty and in a Windows message box. | |
487 Please try to preserve them; otherwise the output is very hard to read | |
488 when using emacsclientw. */ | |
485 message (FALSE, | 489 message (FALSE, |
486 "Usage: %s [OPTIONS] FILE...\n\ | 490 "Usage: %s [OPTIONS] FILE...\n\ |
487 Tell the Emacs server to visit the specified files.\n\ | 491 Tell the Emacs server to visit the specified files.\n\ |
488 Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ | 492 Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ |
489 \n\ | 493 \n\ |
490 The following OPTIONS are accepted:\n\ | 494 The following OPTIONS are accepted:\n\ |
491 -V, --version Just print version info and return\n\ | 495 -V, --version Just print version info and return\n\ |
492 -H, --help Print this usage information message\n\ | 496 -H, --help Print this usage information message\n\ |
493 -t, --tty Open a new Emacs frame on the current terminal\n\ | 497 -t, --tty Open a new Emacs frame on the current terminal\n\ |
494 -c, --current-frame Do not create a new frame; use the current Emacs frame\n\ | 498 -c, --current-frame Do not create a new frame;\n\ |
495 -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ | 499 use the current Emacs frame\n\ |
496 -n, --no-wait Don't wait for the server to return\n\ | 500 -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ |
497 -d, --display=DISPLAY Visit the file in the given display\n" | 501 -n, --no-wait Don't wait for the server to return\n\ |
502 -d, --display=DISPLAY Visit the file in the given display\n" | |
498 #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 503 #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
499 "-s, --socket-name=FILENAME\n\ | 504 "-s, --socket-name=FILENAME\n\ |
500 Set filename of the UNIX socket for communication\n" | 505 Set filename of the UNIX socket for communication\n" |
501 #endif | 506 #endif |
502 "-f, --server-file=FILENAME\n\ | 507 "-f, --server-file=FILENAME\n\ |
503 Set filename of the TCP authentication file\n\ | 508 Set filename of the TCP authentication file\n\ |
504 -a, --alternate-editor=EDITOR\n\ | 509 -a, --alternate-editor=EDITOR\n\ |
505 Editor to fallback to if the server is not running\n\ | 510 Editor to fallback to if the server is not running\n\ |
506 \n\ | 511 \n\ |
507 Report bugs to bug-gnu-emacs@gnu.org.\n", progname); | 512 Report bugs to bug-gnu-emacs@gnu.org.\n", progname); |
508 exit (EXIT_SUCCESS); | 513 exit (EXIT_SUCCESS); |
509 } | 514 } |
510 | 515 |
536 { | 541 { |
537 main_argc = argc; | 542 main_argc = argc; |
538 main_argv = argv; | 543 main_argv = argv; |
539 progname = argv[0]; | 544 progname = argv[0]; |
540 message (TRUE, "%s: Sorry, the Emacs server is supported only\n" | 545 message (TRUE, "%s: Sorry, the Emacs server is supported only\n" |
541 "on systems with Berkeley sockets.\n", | 546 "on systems with Berkeley sockets.\n", |
542 argv[0]); | 547 argv[0]); |
543 fail (); | 548 fail (); |
544 } | 549 } |
545 | 550 |
546 #else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ | 551 #else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ |
974 SIGTYPE | 979 SIGTYPE |
975 handle_sigtstp (int signalnum) | 980 handle_sigtstp (int signalnum) |
976 { | 981 { |
977 int old_errno = errno; | 982 int old_errno = errno; |
978 sigset_t set; | 983 sigset_t set; |
979 | 984 |
980 if (emacs_socket) | 985 if (emacs_socket) |
981 send_to_emacs (emacs_socket, "-suspend \n"); | 986 send_to_emacs (emacs_socket, "-suspend \n"); |
982 | 987 |
983 /* Unblock this signal and call the default handler by temprarily | 988 /* Unblock this signal and call the default handler by temprarily |
984 changing the handler and resignalling. */ | 989 changing the handler and resignalling. */ |
1143 | 1148 |
1144 HSOCKET | 1149 HSOCKET |
1145 set_socket () | 1150 set_socket () |
1146 { | 1151 { |
1147 HSOCKET s; | 1152 HSOCKET s; |
1148 | 1153 |
1149 INITIALIZE (); | 1154 INITIALIZE (); |
1150 | 1155 |
1151 #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 1156 #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
1152 /* Explicit --socket-name argument. */ | 1157 /* Explicit --socket-name argument. */ |
1153 if (socket_name) | 1158 if (socket_name) |
1154 { | 1159 { |
1155 s = set_local_socket (); | 1160 s = set_local_socket (); |
1168 if (server_file) | 1173 if (server_file) |
1169 { | 1174 { |
1170 s = set_tcp_socket (); | 1175 s = set_tcp_socket (); |
1171 if ((s != INVALID_SOCKET) || alternate_editor) | 1176 if ((s != INVALID_SOCKET) || alternate_editor) |
1172 return s; | 1177 return s; |
1173 | 1178 |
1174 message (TRUE, "%s: error accessing server file \"%s\"", | 1179 message (TRUE, "%s: error accessing server file \"%s\"", |
1175 progname, server_file); | 1180 progname, server_file); |
1176 exit (EXIT_FAILURE); | 1181 exit (EXIT_FAILURE); |
1177 } | 1182 } |
1178 | 1183 |
1179 #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 1184 #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
1180 /* Implicit local socket. */ | 1185 /* Implicit local socket. */ |
1181 s = set_local_socket (); | 1186 s = set_local_socket (); |
1182 if (s != INVALID_SOCKET) | 1187 if (s != INVALID_SOCKET) |
1183 return s; | 1188 return s; |
1330 if (nowait) | 1335 if (nowait) |
1331 send_to_emacs (emacs_socket, "-nowait "); | 1336 send_to_emacs (emacs_socket, "-nowait "); |
1332 | 1337 |
1333 if (current_frame) | 1338 if (current_frame) |
1334 send_to_emacs (emacs_socket, "-current-frame "); | 1339 send_to_emacs (emacs_socket, "-current-frame "); |
1335 | 1340 |
1336 if (display) | 1341 if (display) |
1337 { | 1342 { |
1338 send_to_emacs (emacs_socket, "-display "); | 1343 send_to_emacs (emacs_socket, "-display "); |
1339 quote_argument (emacs_socket, display); | 1344 quote_argument (emacs_socket, display); |
1340 send_to_emacs (emacs_socket, " "); | 1345 send_to_emacs (emacs_socket, " "); |