12#include "EST_io_aux.h"
16int siod_server_socket = -1;
21 if (siod_server_socket == -1)
23 err(
"siod: not in server mode",
x);
32 cerr <<
"siod: can't open temporary file \"" <<
37 fwrite((
const char *)
m,
sizeof(
char),
m.length(),fd);
41 send(siod_server_socket,
"LP\n",3,0);
43 write(siod_server_socket,
"LP\n",3);
45 socket_send_file(siod_server_socket,
tmpfile);
52void sock_acknowledge_error()
57 if (siod_server_socket != -1)
59 send(siod_server_socket,
"ER\n",3,0);
61 write(siod_server_socket,
"ER\n",3);
66static void acknowledge_sock_print(
LISP x)
69 siod_send_lisp_to_client(
x);
71 send(siod_server_socket,
"OK\n",3,0);
73 write(siod_server_socket,
"OK\n",3);
77static void ignore_puts(
char *
x)
82long repl_from_socket(
int fd)
91 cerr <<
"repl_from_socket: couldn't set stdin to socket\n";
97 hd.repl_puts = ignore_puts;
98 hd.repl_print = acknowledge_sock_print;
105 siod_interactive = FALSE;
106 siod_server_socket = fd;
108 return repl_driver(1,0,&
hd);
111void init_subrs_srv(
void)
113 init_subr_1(
"send_client",siod_send_lisp_to_client,
114 "(send_client EXPR)\n\
115 Send EXPR to client. In server mode this will send a printed form of\n\
116 ESPR to the client. It is the client's job to expect it.");