diff options
| author | Juanma Barranquero | 2012-07-09 16:00:31 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2012-07-09 16:00:31 +0200 |
| commit | 794327722e006fb4bceadca844eb49000131fd8e (patch) | |
| tree | 6fac4af7c8b966451f122207fac73414bd23a1fe /lib-src | |
| parent | 5eabd6f00141c39b276616f86c198dbf5ba86125 (diff) | |
| download | emacs-794327722e006fb4bceadca844eb49000131fd8e.tar.gz emacs-794327722e006fb4bceadca844eb49000131fd8e.zip | |
lib-src/emacsclient.c: Adapt comments to GNU coding standards.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 94cfa85d3f1..46a4fdb26e7 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #ifdef WINDOWSNT | 22 | #ifdef WINDOWSNT |
| 23 | 23 | ||
| 24 | /* config.h defines these, which disables sockets altogether! */ | 24 | /* ms-w32.h defines these, which disables sockets altogether! */ |
| 25 | # undef _WINSOCKAPI_ | 25 | # undef _WINSOCKAPI_ |
| 26 | # undef _WINSOCK_H | 26 | # undef _WINSOCK_H |
| 27 | 27 | ||
| @@ -451,15 +451,14 @@ w32_window_app (void) | |||
| 451 | return window_app; | 451 | return window_app; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | /* | 454 | /* execvp wrapper for Windows. Quotes arguments with embedded spaces. |
| 455 | execvp wrapper for Windows. Quotes arguments with embedded spaces. | ||
| 456 | 455 | ||
| 457 | This is necessary due to the broken implementation of exec* routines in | 456 | This is necessary due to the broken implementation of exec* routines in |
| 458 | the Microsoft libraries: they concatenate the arguments together without | 457 | the Microsoft libraries: they concatenate the arguments together without |
| 459 | quoting special characters, and pass the result to CreateProcess, with | 458 | quoting special characters, and pass the result to CreateProcess, with |
| 460 | predictably bad results. By contrast, POSIX execvp passes the arguments | 459 | predictably bad results. By contrast, POSIX execvp passes the arguments |
| 461 | directly into the argv array of the child process. | 460 | directly into the argv array of the child process. */ |
| 462 | */ | 461 | |
| 463 | int | 462 | int |
| 464 | w32_execvp (const char *path, char **argv) | 463 | w32_execvp (const char *path, char **argv) |
| 465 | { | 464 | { |
| @@ -712,11 +711,10 @@ Report bugs with M-x report-emacs-bug.\n", progname); | |||
| 712 | exit (EXIT_SUCCESS); | 711 | exit (EXIT_SUCCESS); |
| 713 | } | 712 | } |
| 714 | 713 | ||
| 715 | /* | 714 | /* Try to run a different command, or --if no alternate editor is |
| 716 | Try to run a different command, or --if no alternate editor is | 715 | defined-- exit with an errorcode. |
| 717 | defined-- exit with an errorcode. | 716 | Uses argv, but gets it from the global variable main_argv. */ |
| 718 | Uses argv, but gets it from the global variable main_argv. | 717 | |
| 719 | */ | ||
| 720 | static _Noreturn void | 718 | static _Noreturn void |
| 721 | fail (void) | 719 | fail (void) |
| 722 | { | 720 | { |
| @@ -758,8 +756,9 @@ int sblen = 0; /* Fill pointer for the send buffer. */ | |||
| 758 | /* Socket used to communicate with the Emacs server process. */ | 756 | /* Socket used to communicate with the Emacs server process. */ |
| 759 | HSOCKET emacs_socket = 0; | 757 | HSOCKET emacs_socket = 0; |
| 760 | 758 | ||
| 761 | /* On Windows, the socket library was historically separate from the standard | 759 | /* On Windows, the socket library was historically separate from the |
| 762 | C library, so errors are handled differently. */ | 760 | standard C library, so errors are handled differently. */ |
| 761 | |||
| 763 | static void | 762 | static void |
| 764 | sock_err_message (const char *function_name) | 763 | sock_err_message (const char *function_name) |
| 765 | { | 764 | { |
| @@ -864,7 +863,7 @@ quote_argument (HSOCKET s, const char *str) | |||
| 864 | 863 | ||
| 865 | 864 | ||
| 866 | /* The inverse of quote_argument. Removes quoting in string STR by | 865 | /* The inverse of quote_argument. Removes quoting in string STR by |
| 867 | modifying the string in place. Returns STR. */ | 866 | modifying the string in place. Returns STR. */ |
| 868 | 867 | ||
| 869 | static char * | 868 | static char * |
| 870 | unquote_argument (char *str) | 869 | unquote_argument (char *str) |
| @@ -947,10 +946,9 @@ initialize_sockets (void) | |||
| 947 | #endif /* WINDOWSNT */ | 946 | #endif /* WINDOWSNT */ |
| 948 | 947 | ||
| 949 | 948 | ||
| 950 | /* | 949 | /* Read the information needed to set up a TCP comm channel with |
| 951 | * Read the information needed to set up a TCP comm channel with | 950 | the Emacs server: host, port, and authentication string. */ |
| 952 | * the Emacs server: host, port, and authentication string. | 951 | |
| 953 | */ | ||
| 954 | static int | 952 | static int |
| 955 | get_server_config (const char *config_file, struct sockaddr_in *server, | 953 | get_server_config (const char *config_file, struct sockaddr_in *server, |
| 956 | char *authentication) | 954 | char *authentication) |
| @@ -1031,18 +1029,14 @@ set_tcp_socket (const char *local_server_file) | |||
| 1031 | message (FALSE, "%s: connected to remote socket at %s\n", | 1029 | message (FALSE, "%s: connected to remote socket at %s\n", |
| 1032 | progname, inet_ntoa (server.sin_addr)); | 1030 | progname, inet_ntoa (server.sin_addr)); |
| 1033 | 1031 | ||
| 1034 | /* | 1032 | /* Open up an AF_INET socket. */ |
| 1035 | * Open up an AF_INET socket | ||
| 1036 | */ | ||
| 1037 | if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) | 1033 | if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) |
| 1038 | { | 1034 | { |
| 1039 | sock_err_message ("socket"); | 1035 | sock_err_message ("socket"); |
| 1040 | return INVALID_SOCKET; | 1036 | return INVALID_SOCKET; |
| 1041 | } | 1037 | } |
| 1042 | 1038 | ||
| 1043 | /* | 1039 | /* Set up the socket. */ |
| 1044 | * Set up the socket | ||
| 1045 | */ | ||
| 1046 | if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) | 1040 | if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) |
| 1047 | { | 1041 | { |
| 1048 | sock_err_message ("connect"); | 1042 | sock_err_message ("connect"); |
| @@ -1051,9 +1045,7 @@ set_tcp_socket (const char *local_server_file) | |||
| 1051 | 1045 | ||
| 1052 | setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg); | 1046 | setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg); |
| 1053 | 1047 | ||
| 1054 | /* | 1048 | /* Send the authentication. */ |
| 1055 | * Send the authentication | ||
| 1056 | */ | ||
| 1057 | auth_string[AUTH_KEY_LENGTH] = '\0'; | 1049 | auth_string[AUTH_KEY_LENGTH] = '\0'; |
| 1058 | 1050 | ||
| 1059 | send_to_emacs (s, "-auth "); | 1051 | send_to_emacs (s, "-auth "); |
| @@ -1187,7 +1179,7 @@ handle_sigcont (int signalnum) | |||
| 1187 | going to sleep. Normally the suspend is initiated by Emacs via | 1179 | going to sleep. Normally the suspend is initiated by Emacs via |
| 1188 | server-handle-suspend-tty, but if the server gets out of sync with | 1180 | server-handle-suspend-tty, but if the server gets out of sync with |
| 1189 | reality, we may get a SIGTSTP on C-z. Handling this signal and | 1181 | reality, we may get a SIGTSTP on C-z. Handling this signal and |
| 1190 | notifying Emacs about it should get things under control again. */ | 1182 | notifying Emacs about it should get things under control again. */ |
| 1191 | 1183 | ||
| 1192 | static void | 1184 | static void |
| 1193 | handle_sigtstp (int signalnum) | 1185 | handle_sigtstp (int signalnum) |
| @@ -1239,10 +1231,7 @@ set_local_socket (const char *local_socket_name) | |||
| 1239 | HSOCKET s; | 1231 | HSOCKET s; |
| 1240 | struct sockaddr_un server; | 1232 | struct sockaddr_un server; |
| 1241 | 1233 | ||
| 1242 | /* | 1234 | /* Open up an AF_UNIX socket in this person's home directory. */ |
| 1243 | * Open up an AF_UNIX socket in this person's home directory | ||
| 1244 | */ | ||
| 1245 | |||
| 1246 | if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) | 1235 | if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) |
| 1247 | { | 1236 | { |
| 1248 | message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); | 1237 | message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); |
| @@ -1476,10 +1465,9 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam) | |||
| 1476 | return FALSE; | 1465 | return FALSE; |
| 1477 | } | 1466 | } |
| 1478 | 1467 | ||
| 1479 | /* | 1468 | /* Search for a window of class "Emacs" and owned by a process with |
| 1480 | * Search for a window of class "Emacs" and owned by a process with | 1469 | process id = emacs_pid. If found, allow it to grab the focus. */ |
| 1481 | * process id = emacs_pid. If found, allow it to grab the focus. | 1470 | |
| 1482 | */ | ||
| 1483 | void | 1471 | void |
| 1484 | w32_give_focus (void) | 1472 | w32_give_focus (void) |
| 1485 | { | 1473 | { |