--- rxvt-unicode/src/rxvtc.C 2004/02/13 12:16:21 1.7 +++ rxvt-unicode/src/rxvtc.C 2004/04/02 20:41:01 1.9 @@ -1,5 +1,8 @@ +#include "../config.h" #include "rxvtdaemon.h" +#include "rxvt.h" + #include #include @@ -60,5 +63,29 @@ c.send ("ARG"), c.send (argv[i]); c.send ("END"); + + auto_str tok; + + for (;;) + if (!c.recv (tok)) + { + fprintf (stderr, "protocol error: unexpected eof from server.\n"); + break; + } + else if (!strcmp (tok, "MSG") && c.recv (tok)) + fprintf (stderr, "%s", (const char *)tok); + else if (!strcmp (tok, "END")) + { + int success; + if (c.recv (success)) + exit (success ? EXIT_SUCCESS : EXIT_FAILURE); + } + else + { + fprintf (stderr, "protocol error: received illegal token '%s'.\n", (const char *)tok); + break; + } + + return EXIT_FAILURE; }