#include <sys/types.h>
#include <stdio.h>
#include "tnfsm.h"externstruct fsm_trans sostab[];
externint sostate;
extern u_char sofsm[][NCHRS];
int
sowrite(FILE *sfp, FILE *tfp, u_char *buf, int cc)
{
struct fsm_trans *pt;
int i, ki;
for (i=0; i<cc; ++i) {
int c = buf[i];
ki = sofsm[sostate][c];
pt = &sostab[ki];
if ((pt->ft_action)(sfp, tfp, c) < 0)
sostate = KSREMOTE; /* an error occurred */else
sostate = pt->ft_next;
}
}