sel_t *sp; /* my select fcb address */
struct termios t; /* any termios associated with this cnum */
char echo; /* echo characters back to this cnum */
sel_t *sp; /* my select fcb address */
struct termios t; /* any termios associated with this cnum */
char echo; /* echo characters back to this cnum */
int fcb_handler(sel_t *sp, int in, int out, int err)
{
fcb_t *f = sp->fcb;
int fcb_handler(sel_t *sp, int in, int out, int err)
{
fcb_t *f = sp->fcb;
if (mp->inp == mp->data)
*mp->inp++ = ' ';
*mp->inp = 0; /* zero terminate it, but don't include it in the length */
dbgdump(DMSG, "QUEUE TEXT", mp->data, mp->inp-mp->data);
cmsg_send(f->inq, mp, 0);
if (mp->inp == mp->data)
*mp->inp++ = ' ';
*mp->inp = 0; /* zero terminate it, but don't include it in the length */
dbgdump(DMSG, "QUEUE TEXT", mp->data, mp->inp-mp->data);
cmsg_send(f->inq, mp, 0);
/* kick it upstairs */
dbgdump(DMSG, "QUEUE MSG", mp->data, mp->inp - mp->data);
cmsg_send(f->inq, mp, 0);
/* kick it upstairs */
dbgdump(DMSG, "QUEUE MSG", mp->data, mp->inp - mp->data);
cmsg_send(f->inq, mp, 0);
signal(SIGINT, terminate);
signal(SIGQUIT, terminate);
signal(SIGTERM, terminate);
signal(SIGINT, terminate);
signal(SIGQUIT, terminate);
signal(SIGTERM, terminate);
/* connect up stdin, stdout and message system */
in = fcb_new(0, TEXT);
in->sp = sel_open(0, in, "STDIN", fcb_handler, TEXT, SEL_INPUT);
if (tcgetattr(0, &in->t) < 0) {
/* connect up stdin, stdout and message system */
in = fcb_new(0, TEXT);
in->sp = sel_open(0, in, "STDIN", fcb_handler, TEXT, SEL_INPUT);
if (tcgetattr(0, &in->t) < 0) {
} else {
struct termios t = in->t;
t.c_lflag &= ~(ECHO|ECHONL|ICANON);
if (tcsetattr(0, TCSANOW, &t) < 0)
die("tcsetattr (%d)", errno);
in->echo = echo;
} else {
struct termios t = in->t;
t.c_lflag &= ~(ECHO|ECHONL|ICANON);
if (tcsetattr(0, TCSANOW, &t) < 0)
die("tcsetattr (%d)", errno);
in->echo = echo;