6 static char line_buf[256];
7 static int line_col = 0;
8 static int esc_flag = 0;
10 static int line_min = 30;
11 static int line_max = 76;
12 static FILE *out_f = stdout;
14 void tty_init (FILE *out, int min, int max)
25 static void flush (void)
29 for (j = 0; j<line_col; j++)
30 putc (line_buf[j], out_f);
35 static void split (int ch)
40 if (line_buf[--i] == ' ')
47 if (j>1 && line_buf[j] >= 'A'&& line_buf[j] <= 'Z'
48 && line_buf[j-1] == ' '
49 && (line_buf[j-2] == '.' || line_buf[j-2] == ';')
50 && extra < line_max-i )
56 putc (line_buf[j], out_f);
62 line_buf[j++] = line_buf[i++];
66 else if (i < line_min)
70 static void escape (int ch)
75 if (line_col >= line_max)
82 line_buf[line_col++] = ' ';
86 line_buf[line_col++] = ' ';
89 line_buf[line_col++] = ch;
93 void tty_emit (int ch)
104 else if (line_col || ch != ' ')
106 line_buf[line_col++] = ch;
107 if (line_col >= line_max)