comparison lib-src/gnuclient.c @ 294:4b85ae5eabfb r21-0b45

Import from CVS: tag r21-0b45
author cvs
date Mon, 13 Aug 2007 10:38:01 +0200
parents 6cb5e14cd98e
children afd57c14dfc8
comparison
equal deleted inserted replaced
293:403535bfea94 294:4b85ae5eabfb
22 Boston, MA 02111-1307, USA. 22 Boston, MA 02111-1307, USA.
23 23
24 Author: Andy Norman (ange@hplb.hpl.hp.com), based on 24 Author: Andy Norman (ange@hplb.hpl.hp.com), based on
25 'etc/emacsclient.c' from the GNU Emacs 18.52 distribution. 25 'etc/emacsclient.c' from the GNU Emacs 18.52 distribution.
26 26
27 Please mail bugs and suggestions to the author at the above address. 27 Please mail bugs and suggestions to the XEmacs maintainer.
28 */ 28 */
29 29
30 /* 30 /*
31 * This file incorporates new features added by Bob Weiner <weiner@mot.com>, 31 * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
32 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>. 32 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
465 send_string (s, "("); 465 send_string (s, "(");
466 send_string (s, eval_function); 466 send_string (s, eval_function);
467 send_string (s, ")"); 467 send_string (s, ")");
468 } 468 }
469 send_string (s, "))"); 469 send_string (s, "))");
470 send_string (s, EOT_STR); 470 /* disconnect already sends EOT_STR */
471 if (read_line (s, result) == 0) 471 #ifdef SYSV_IPC
472 { 472 if (connect_type == (int) CONN_IPC)
473 fprintf (stderr, "%s: Could not read\n", progname); 473 disconnect_from_ipc_server (s, msgp, batch && !quick);
474 exit (1); 474 #else /* !SYSV_IPC */
475 } 475 if (connect_type != (int) CONN_IPC)
476 disconnect_from_server (s, batch && !quick);
477 #endif /* !SYSV_IPC */
476 } /* eval_function || eval_form || load_library */ 478 } /* eval_function || eval_form || load_library */
477 else if (batch) 479 else if (batch)
478 { 480 {
479 /* no sexp on the command line, so read it from stdin */ 481 /* no sexp on the command line, so read it from stdin */
480 int nb; 482 int nb;
491 { 493 {
492 buffer[nb] = '\0'; 494 buffer[nb] = '\0';
493 send_string(s, buffer); 495 send_string(s, buffer);
494 } 496 }
495 send_string(s,"))"); 497 send_string(s,"))");
496 send_string (s, EOT_STR); 498 /* disconnect already sends EOT_STR */
497 if (read_line (s, result) == 0) 499 #ifdef SYSV_IPC
498 { 500 if (connect_type == (int) CONN_IPC)
499 fprintf (stderr, "%s: Could not read\n", progname); 501 disconnect_from_ipc_server (s, msgp, batch && !quick);
500 exit (1); 502 #else /* !SYSV_IPC */
501 } 503 if (connect_type != (int) CONN_IPC)
504 disconnect_from_server (s, batch && !quick);
505 #endif /* !SYSV_IPC */
502 } 506 }
503 507
504 if (!batch) 508 if (!batch)
505 { 509 {
506 if (suppress_windows_system) 510 if (suppress_windows_system)
645 if (connect_type != (int) CONN_IPC) 649 if (connect_type != (int) CONN_IPC)
646 disconnect_from_server (s, FALSE); 650 disconnect_from_server (s, FALSE);
647 #endif /* !SYSV_IPC */ 651 #endif /* !SYSV_IPC */
648 } /* not batch */ 652 } /* not batch */
649 653
650 if (batch && !quick)
651 printf ("%s\n", result);
652 654
653 return 0; 655 return 0;
654 656
655 } /* main */ 657 } /* main */
656 658