lib-src/emacsclient.c: Adapt comments to GNU coding standards.
This commit is contained in:
parent
5eabd6f001
commit
794327722e
1 changed files with 23 additions and 35 deletions
|
@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#ifdef WINDOWSNT
|
||||
|
||||
/* config.h defines these, which disables sockets altogether! */
|
||||
/* ms-w32.h defines these, which disables sockets altogether! */
|
||||
# undef _WINSOCKAPI_
|
||||
# undef _WINSOCK_H
|
||||
|
||||
|
@ -451,15 +451,14 @@ w32_window_app (void)
|
|||
return window_app;
|
||||
}
|
||||
|
||||
/*
|
||||
execvp wrapper for Windows. Quotes arguments with embedded spaces.
|
||||
/* execvp wrapper for Windows. Quotes arguments with embedded spaces.
|
||||
|
||||
This is necessary due to the broken implementation of exec* routines in
|
||||
the Microsoft libraries: they concatenate the arguments together without
|
||||
quoting special characters, and pass the result to CreateProcess, with
|
||||
predictably bad results. By contrast, POSIX execvp passes the arguments
|
||||
directly into the argv array of the child process.
|
||||
*/
|
||||
directly into the argv array of the child process. */
|
||||
|
||||
int
|
||||
w32_execvp (const char *path, char **argv)
|
||||
{
|
||||
|
@ -712,11 +711,10 @@ Report bugs with M-x report-emacs-bug.\n", progname);
|
|||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
Try to run a different command, or --if no alternate editor is
|
||||
defined-- exit with an errorcode.
|
||||
Uses argv, but gets it from the global variable main_argv.
|
||||
*/
|
||||
/* Try to run a different command, or --if no alternate editor is
|
||||
defined-- exit with an errorcode.
|
||||
Uses argv, but gets it from the global variable main_argv. */
|
||||
|
||||
static _Noreturn void
|
||||
fail (void)
|
||||
{
|
||||
|
@ -758,8 +756,9 @@ int sblen = 0; /* Fill pointer for the send buffer. */
|
|||
/* Socket used to communicate with the Emacs server process. */
|
||||
HSOCKET emacs_socket = 0;
|
||||
|
||||
/* On Windows, the socket library was historically separate from the standard
|
||||
C library, so errors are handled differently. */
|
||||
/* On Windows, the socket library was historically separate from the
|
||||
standard C library, so errors are handled differently. */
|
||||
|
||||
static void
|
||||
sock_err_message (const char *function_name)
|
||||
{
|
||||
|
@ -864,7 +863,7 @@ quote_argument (HSOCKET s, const char *str)
|
|||
|
||||
|
||||
/* The inverse of quote_argument. Removes quoting in string STR by
|
||||
modifying the string in place. Returns STR. */
|
||||
modifying the string in place. Returns STR. */
|
||||
|
||||
static char *
|
||||
unquote_argument (char *str)
|
||||
|
@ -947,10 +946,9 @@ initialize_sockets (void)
|
|||
#endif /* WINDOWSNT */
|
||||
|
||||
|
||||
/*
|
||||
* Read the information needed to set up a TCP comm channel with
|
||||
* the Emacs server: host, port, and authentication string.
|
||||
*/
|
||||
/* Read the information needed to set up a TCP comm channel with
|
||||
the Emacs server: host, port, and authentication string. */
|
||||
|
||||
static int
|
||||
get_server_config (const char *config_file, struct sockaddr_in *server,
|
||||
char *authentication)
|
||||
|
@ -1031,18 +1029,14 @@ set_tcp_socket (const char *local_server_file)
|
|||
message (FALSE, "%s: connected to remote socket at %s\n",
|
||||
progname, inet_ntoa (server.sin_addr));
|
||||
|
||||
/*
|
||||
* Open up an AF_INET socket
|
||||
*/
|
||||
/* Open up an AF_INET socket. */
|
||||
if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||
{
|
||||
sock_err_message ("socket");
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the socket
|
||||
*/
|
||||
/* Set up the socket. */
|
||||
if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
|
||||
{
|
||||
sock_err_message ("connect");
|
||||
|
@ -1051,9 +1045,7 @@ set_tcp_socket (const char *local_server_file)
|
|||
|
||||
setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg);
|
||||
|
||||
/*
|
||||
* Send the authentication
|
||||
*/
|
||||
/* Send the authentication. */
|
||||
auth_string[AUTH_KEY_LENGTH] = '\0';
|
||||
|
||||
send_to_emacs (s, "-auth ");
|
||||
|
@ -1187,7 +1179,7 @@ handle_sigcont (int signalnum)
|
|||
going to sleep. Normally the suspend is initiated by Emacs via
|
||||
server-handle-suspend-tty, but if the server gets out of sync with
|
||||
reality, we may get a SIGTSTP on C-z. Handling this signal and
|
||||
notifying Emacs about it should get things under control again. */
|
||||
notifying Emacs about it should get things under control again. */
|
||||
|
||||
static void
|
||||
handle_sigtstp (int signalnum)
|
||||
|
@ -1239,10 +1231,7 @@ set_local_socket (const char *local_socket_name)
|
|||
HSOCKET s;
|
||||
struct sockaddr_un server;
|
||||
|
||||
/*
|
||||
* Open up an AF_UNIX socket in this person's home directory
|
||||
*/
|
||||
|
||||
/* Open up an AF_UNIX socket in this person's home directory. */
|
||||
if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
|
||||
|
@ -1476,10 +1465,9 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for a window of class "Emacs" and owned by a process with
|
||||
* process id = emacs_pid. If found, allow it to grab the focus.
|
||||
*/
|
||||
/* Search for a window of class "Emacs" and owned by a process with
|
||||
process id = emacs_pid. If found, allow it to grab the focus. */
|
||||
|
||||
void
|
||||
w32_give_focus (void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue