static char sccsid
[] = "@(#)imsg.c 5.2 (Berkeley) %G%";
/* to talk to both eunice and x.25 without also screwing up tcp/ip
* we must adaptively choose what character to end the msg with
* The idea is that initially we send ....\000\n
* Then, after they have sent us a message, we use the first character
* this is the initial read message routine -
* used before a protocol is agreed upon.
DEBUG(5, "imsg %s<", "sync");
while ((ret
= read(fn
, msg
, 1)) == 1) {
DEBUG(5, (*msg
>037 && *msg
<0177) ? "%c" : "\\%03o", *msg
& 0377);
DEBUG(5, ">got %s\n", ret
== 1 ? "it" : "EOF");
DEBUG(5, "imsg %s<", "input");
while (read(fn
, msg
, 1) == 1) {
DEBUG(5, (*msg
>037 && *msg
<0177) ? "%c" : "\\%03o", *msg
& 0377);
DEBUG(5, "%s\n", ">found sync");
if (*msg
== '\n' || *msg
== '\0') {
DEBUG(6,"\nUsing \\%o as End of message char\n", Mend
);
DEBUG(5, ">got %d\n", strlen(amsg
));
* this is the initial write message routine -
* used before a protocol is agreed upon.
*c
= '\0'; /* avoid pdp 11/23,40 auto-incr stack trap bug */
DEBUG(5, "omsg <%s>\n", buf
);
write(fn
, buf
, (int)(c
- buf
));