From: jsancho Date: Wed, 27 Jul 2011 15:27:30 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=b625488bd51b74f62e17434e0ce50cb6f23ea9a1;p=gacela.git --- diff --git a/src/gacela.c b/src/gacela.c index 9503f41..c3864f8 100644 --- a/src/gacela.c +++ b/src/gacela.c @@ -154,14 +154,12 @@ gacela_client (SCM rec_channel, SCM send_channel) if (line && *line) { add_history (line); - //scm_write (scm_from_locale_string ("("), send_channel); scm_write (scm_from_locale_string (line), send_channel); - //scm_write (scm_from_locale_string (")"), send_channel); scm_force_output (send_channel); while (scm_char_ready_p (rec_channel) == SCM_BOOL_F) { if (ctrl_c) break; - sleep (1); + sleep (0.5); } if (ctrl_c) ctrl_c = 0; @@ -236,7 +234,7 @@ start_local_server (char *working_path, SCM pipes) scm_c_define ("pipes", pipes); scm_c_eval_string ("(start-server pipes)"); } -/* + void start_remote_client (char *hostname, int port) { @@ -259,7 +257,7 @@ start_remote_client (char *hostname, int port) close (sockfd); } } -*/ + int main (int argc, char *argv[]) { @@ -302,8 +300,7 @@ main (int argc, char *argv[]) else if (mode == 2 && port != 0) start_server (dirname (argv[0]), port); else if (mode == 3 && port != 0) - //start_remote_client (host, port); - return; + start_remote_client (host, port); else { fd1 = scm_pipe (); fd2 = scm_pipe (); diff --git a/src/gacela_server.scm b/src/gacela_server.scm index 5278cba..caaf6b5 100644 --- a/src/gacela_server.scm +++ b/src/gacela_server.scm @@ -79,14 +79,13 @@ (cond ((eof-object? exp) (close rec-channel)) (else - (format #t "Server1: ~a~%" exp) - (format #t "Server2: ~a~%" (primitive-eval exp)) - (format send-channel "~a" (primitive-eval exp)) - (force-output send-channel))))) + (write (format #f "~a" (eval-string exp)) send-channel))))) (lambda (key . args) - (format #t "ERROR") (let ((fmt (string-concatenate (list (cadr args) "~%"))) (params (caddr args))) - (if params - (apply format (cons send-channel (cons fmt params))) - (format send-channel fmt)))))))) + (write + (if params + (apply format (cons #f (cons fmt params))) + (format #f fmt)) + send-channel)))) + (force-output send-channel))))