# include "refer.h"
static gate = 0;
static char buff[LLINE];
void output(char *s)
{
if (gate)
fputs(buff, ftemp);
else
gate = 1;
strcpy(buff, s);
if (strlen(buff) > LLINE)
err("one buff too big (%d)!", LLINE);
}
void append(char *s)
{
char *p, *r;
int lch;
trimnl(buff);
for (p = buff; *p; p++)
;
lch = *--p;
switch (lch) {
case '.':
case ',':
case ';':
case ':':
*p = 0;
r = "\\*(<";
while (*r)
*p++ = *r++;
*p++ = lch;
*p = 0;
}
strcat(buff, s);
switch (lch) {
case '.':
case ',':
case ';':
case ':':
for (p = buff; *p; p++)
;
if (*--p == '\n')
*p = 0;
r = "\\*(>";
while (*r)
*p++ = *r++;
*p++ = lch;
*p++ = '\n';
*p = 0;
}
if (strlen(buff) > LLINE)
err("output buff too long (%d)", LLINE);
}
void flout(void)
{
if (gate)
fputs(buff, ftemp);
gate = 0;
}
|