aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorKaroly Lorentey <[email protected]>2007-01-01 18:32:06 +0000
committerKaroly Lorentey <[email protected]>2007-01-01 18:32:06 +0000
commit382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0 (patch)
treedb97fc28e75e5d3b4db1f2c8b87b1bc65770b5ef /lib-src/emacsclient.c
parent65e86587ab836aaa86b12ce30b219bcb4fcbaa06 (diff)
Fix various suspend-related bugs in emacsclient. (Report & patch by Dan Nicolaescu.)
* lib-src/emacsclient.c (in, out): Remove. (s): New variable (moved out from main). (handle_sigcont, handle_sigtstp): Use SEND_STRING. (main): Fix typos. git-archimport-id: [email protected]/emacs--multi-tty--0--patch-591
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index f765f02b42..4486c94660 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -171,8 +171,8 @@ char *server_file = NULL;
/* PID of the Emacs server process. */
int emacs_pid = 0;
-/* File handles for communicating with Emacs. */
-FILE *out, *in;
+/* Socket used to communicate with the Emacs server process. */
+HSOCKET s;
void print_help_and_exit () NO_RETURN;
@@ -906,9 +906,7 @@ handle_sigcont (int signalnum)
if (tcgetpgrp (1) == getpgrp ())
{
/* We are in the foreground. */
- fprintf (out, "-resume \n");
- fflush (out);
- fsync (fileno (out));
+ SEND_STRING ("-resume \n");
}
else
{
@@ -932,12 +930,8 @@ handle_sigtstp (int signalnum)
int old_errno = errno;
sigset_t set;
- if (out)
- {
- fprintf (out, "-suspend \n");
- fflush (out);
- fsync (fileno (out));
- }
+ if (s)
+ SEND_STRING ("-suspend \n");
/* Unblock this signal and call the default handler by temprarily
changing the handler and resignalling. */
@@ -1240,7 +1234,6 @@ main (argc, argv)
int argc;
char **argv;
{
- HSOCKET s;
int i, rl, needlf = 0;
char *cwd, *str;
char string[BUFSIZ+1];
@@ -1410,7 +1403,7 @@ main (argc, argv)
SEND_STRING ("-eval ");
else
SEND_STRING ("-file ");
- SEND_QUOTED (out);
+ SEND_QUOTED (str);
}
SEND_STRING (" ");
}
@@ -1473,7 +1466,7 @@ main (argc, argv)
fprintf (stderr, "*ERROR*: %s", str);
needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
}
- else if (strprefix ("-suspend ", str))
+ else if (strprefix ("-suspend ", string))
{
/* -suspend: Suspend this terminal, i.e., stop the process. */
if (needlf)