diff options
| author | Miles Bader | 2008-01-30 07:57:28 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-01-30 07:57:28 +0000 |
| commit | d235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch) | |
| tree | 96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /lib-src/emacsclient.c | |
| parent | 3709a060f679dba14df71ae64a0035fa2b5b3106 (diff) | |
| parent | 02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff) | |
| download | emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'lib-src/emacsclient.c')
| -rw-r--r-- | lib-src/emacsclient.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 9de812d1c73..707be43b5f7 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -170,7 +170,9 @@ struct option longopts[] = | |||
| 170 | { "socket-name", required_argument, NULL, 's' }, | 170 | { "socket-name", required_argument, NULL, 's' }, |
| 171 | #endif | 171 | #endif |
| 172 | { "server-file", required_argument, NULL, 'f' }, | 172 | { "server-file", required_argument, NULL, 'f' }, |
| 173 | #ifndef WINDOWSNT | ||
| 173 | { "display", required_argument, NULL, 'd' }, | 174 | { "display", required_argument, NULL, 'd' }, |
| 175 | #endif | ||
| 174 | { 0, 0, 0, 0 } | 176 | { 0, 0, 0, 0 } |
| 175 | }; | 177 | }; |
| 176 | 178 | ||
| @@ -227,7 +229,7 @@ xstrdup (const char *s) | |||
| 227 | 229 | ||
| 228 | 230 | ||
| 229 | /* Return the current working directory. Returns NULL on errors. | 231 | /* Return the current working directory. Returns NULL on errors. |
| 230 | Any other returned value must be freed with free. This is used | 232 | Any other returned value must be freed with free. This is used |
| 231 | only when get_current_dir_name is not defined on the system. */ | 233 | only when get_current_dir_name is not defined on the system. */ |
| 232 | char* | 234 | char* |
| 233 | get_current_dir_name () | 235 | get_current_dir_name () |
| @@ -477,9 +479,15 @@ decode_options (argc, argv) | |||
| 477 | char **argv; | 479 | char **argv; |
| 478 | { | 480 | { |
| 479 | alternate_editor = egetenv ("ALTERNATE_EDITOR"); | 481 | alternate_editor = egetenv ("ALTERNATE_EDITOR"); |
| 482 | |||
| 483 | /* We used to set `display' to $DISPLAY by default, but this changed the | ||
| 484 | default behavior and is sometimes inconvenient. So instead of forcing | ||
| 485 | users to say "--display ''" when they want to use Emacs's existing tty | ||
| 486 | or display connection, we force them to use "--display $DISPLAY" if | ||
| 487 | they want Emacs to connect to their current display. */ | ||
| 488 | #if 0 | ||
| 480 | display = egetenv ("DISPLAY"); | 489 | display = egetenv ("DISPLAY"); |
| 481 | if (display && strlen (display) == 0) | 490 | #endif |
| 482 | display = NULL; | ||
| 483 | 491 | ||
| 484 | while (1) | 492 | while (1) |
| 485 | { | 493 | { |
| @@ -515,9 +523,15 @@ decode_options (argc, argv) | |||
| 515 | server_file = optarg; | 523 | server_file = optarg; |
| 516 | break; | 524 | break; |
| 517 | 525 | ||
| 526 | /* We used to disallow this argument in w32, but it seems better | ||
| 527 | to allow it, for the occasional case where the user is | ||
| 528 | connecting with a w32 client to a server compiled with X11 | ||
| 529 | support. */ | ||
| 530 | #if 1 /* !defined WINDOWS */ | ||
| 518 | case 'd': | 531 | case 'd': |
| 519 | display = optarg; | 532 | display = optarg; |
| 520 | break; | 533 | break; |
| 534 | #endif | ||
| 521 | 535 | ||
| 522 | case 'n': | 536 | case 'n': |
| 523 | nowait = 1; | 537 | nowait = 1; |
| @@ -552,6 +566,9 @@ decode_options (argc, argv) | |||
| 552 | } | 566 | } |
| 553 | } | 567 | } |
| 554 | 568 | ||
| 569 | if (display && strlen (display) == 0) | ||
| 570 | display = NULL; | ||
| 571 | |||
| 555 | if (!tty && display) | 572 | if (!tty && display) |
| 556 | window_system = 1; | 573 | window_system = 1; |
| 557 | #if !defined (WINDOWSNT) && !defined (HAVE_CARBON) | 574 | #if !defined (WINDOWSNT) && !defined (HAVE_CARBON) |
| @@ -594,8 +611,10 @@ The following OPTIONS are accepted:\n\ | |||
| 594 | -c, --create-frame Create a new frame instead of trying to\n\ | 611 | -c, --create-frame Create a new frame instead of trying to\n\ |
| 595 | use the current Emacs frame\n\ | 612 | use the current Emacs frame\n\ |
| 596 | -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ | 613 | -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ |
| 597 | -n, --no-wait Don't wait for the server to return\n\ | 614 | -n, --no-wait Don't wait for the server to return\n" |
| 598 | -d, --display=DISPLAY Visit the file in the given display\n" | 615 | #ifndef WINDOWSNT |
| 616 | "-d, --display=DISPLAY Visit the file in the given display\n" | ||
| 617 | #endif | ||
| 599 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 618 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
| 600 | "-s, --socket-name=FILENAME\n\ | 619 | "-s, --socket-name=FILENAME\n\ |
| 601 | Set filename of the UNIX socket for communication\n" | 620 | Set filename of the UNIX socket for communication\n" |
| @@ -882,7 +901,7 @@ initialize_sockets () | |||
| 882 | 901 | ||
| 883 | if (WSAStartup (MAKEWORD (2, 0), &wsaData)) | 902 | if (WSAStartup (MAKEWORD (2, 0), &wsaData)) |
| 884 | { | 903 | { |
| 885 | message (TRUE, "%s: error initializing WinSock2", progname); | 904 | message (TRUE, "%s: error initializing WinSock2\n", progname); |
| 886 | exit (EXIT_FAILURE); | 905 | exit (EXIT_FAILURE); |
| 887 | } | 906 | } |
| 888 | 907 | ||
| @@ -939,7 +958,7 @@ get_server_config (server, authentication) | |||
| 939 | } | 958 | } |
| 940 | else | 959 | else |
| 941 | { | 960 | { |
| 942 | message (TRUE, "%s: invalid configuration info", progname); | 961 | message (TRUE, "%s: invalid configuration info\n", progname); |
| 943 | exit (EXIT_FAILURE); | 962 | exit (EXIT_FAILURE); |
| 944 | } | 963 | } |
| 945 | 964 | ||
| @@ -949,7 +968,7 @@ get_server_config (server, authentication) | |||
| 949 | 968 | ||
| 950 | if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) | 969 | if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) |
| 951 | { | 970 | { |
| 952 | message (TRUE, "%s: cannot read authentication info", progname); | 971 | message (TRUE, "%s: cannot read authentication info\n", progname); |
| 953 | exit (EXIT_FAILURE); | 972 | exit (EXIT_FAILURE); |
| 954 | } | 973 | } |
| 955 | 974 | ||
| @@ -1002,7 +1021,7 @@ set_tcp_socket () | |||
| 1002 | 1021 | ||
| 1003 | send_to_emacs (s, "-auth "); | 1022 | send_to_emacs (s, "-auth "); |
| 1004 | send_to_emacs (s, auth_string); | 1023 | send_to_emacs (s, auth_string); |
| 1005 | send_to_emacs (s, "\n"); | 1024 | send_to_emacs (s, " "); |
| 1006 | 1025 | ||
| 1007 | return s; | 1026 | return s; |
| 1008 | } | 1027 | } |
| @@ -1092,7 +1111,7 @@ handle_sigtstp (int signalnum) | |||
| 1092 | if (emacs_socket) | 1111 | if (emacs_socket) |
| 1093 | send_to_emacs (emacs_socket, "-suspend \n"); | 1112 | send_to_emacs (emacs_socket, "-suspend \n"); |
| 1094 | 1113 | ||
| 1095 | /* Unblock this signal and call the default handler by temprarily | 1114 | /* Unblock this signal and call the default handler by temporarily |
| 1096 | changing the handler and resignalling. */ | 1115 | changing the handler and resignalling. */ |
| 1097 | sigprocmask (SIG_BLOCK, NULL, &set); | 1116 | sigprocmask (SIG_BLOCK, NULL, &set); |
| 1098 | sigdelset (&set, signalnum); | 1117 | sigdelset (&set, signalnum); |
| @@ -1167,7 +1186,7 @@ set_local_socket () | |||
| 1167 | strcpy (server.sun_path, socket_name); | 1186 | strcpy (server.sun_path, socket_name); |
| 1168 | else | 1187 | else |
| 1169 | { | 1188 | { |
| 1170 | message (TRUE, "%s: socket-name %s too long", | 1189 | message (TRUE, "%s: socket-name %s too long\n", |
| 1171 | progname, socket_name); | 1190 | progname, socket_name); |
| 1172 | fail (); | 1191 | fail (); |
| 1173 | } | 1192 | } |
| @@ -1202,7 +1221,7 @@ set_local_socket () | |||
| 1202 | strcpy (server.sun_path, socket_name); | 1221 | strcpy (server.sun_path, socket_name); |
| 1203 | else | 1222 | else |
| 1204 | { | 1223 | { |
| 1205 | message (TRUE, "%s: socket-name %s too long", | 1224 | message (TRUE, "%s: socket-name %s too long\n", |
| 1206 | progname, socket_name); | 1225 | progname, socket_name); |
| 1207 | exit (EXIT_FAILURE); | 1226 | exit (EXIT_FAILURE); |
| 1208 | } | 1227 | } |
| @@ -1266,7 +1285,7 @@ set_socket () | |||
| 1266 | s = set_local_socket (); | 1285 | s = set_local_socket (); |
| 1267 | if ((s != INVALID_SOCKET) || alternate_editor) | 1286 | if ((s != INVALID_SOCKET) || alternate_editor) |
| 1268 | return s; | 1287 | return s; |
| 1269 | message (TRUE, "%s: error accessing socket \"%s\"", | 1288 | message (TRUE, "%s: error accessing socket \"%s\"\n", |
| 1270 | progname, socket_name); | 1289 | progname, socket_name); |
| 1271 | exit (EXIT_FAILURE); | 1290 | exit (EXIT_FAILURE); |
| 1272 | } | 1291 | } |
| @@ -1282,7 +1301,7 @@ set_socket () | |||
| 1282 | if ((s != INVALID_SOCKET) || alternate_editor) | 1301 | if ((s != INVALID_SOCKET) || alternate_editor) |
| 1283 | return s; | 1302 | return s; |
| 1284 | 1303 | ||
| 1285 | message (TRUE, "%s: error accessing server file \"%s\"", | 1304 | message (TRUE, "%s: error accessing server file \"%s\"\n", |
| 1286 | progname, server_file); | 1305 | progname, server_file); |
| 1287 | exit (EXIT_FAILURE); | 1306 | exit (EXIT_FAILURE); |
| 1288 | } | 1307 | } |