1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
--- console/vbi-tty.c.orig Tue Feb 10 22:41:06 2004
+++ console/vbi-tty.c Tue Feb 10 22:42:03 2004
@@ -19,7 +19,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <linux/fb.h>
+/*#include <linux/fb.h>*/
#include "vbi-data.h"
#include "vbi-tty.h"
@@ -65,7 +65,7 @@
}
/* --------------------------------------------------------------------- */
-
+#ifdef WITH_LINUX_FB_H
static int have_fb = 0;
static int fb_fmt = VBI_PIXFMT_RGBA32_LE;
static int switch_last;
@@ -74,7 +74,7 @@
{
fb_memset(fb_mem+fb_mem_offset,0,fb_fix.smem_len);
}
-
+#endif
/* --------------------------------------------------------------------- */
struct vbi_tty {
@@ -133,6 +133,7 @@
vbi_fetch_vt_page(tty->vbi->dec,&tty->pg,tty->pgno,tty->subno,
VBI_WST_LEVEL_1p5,25,1);
vbi_fix_head(tty,tty->pg.text);
+#ifdef WITH_LINUX_FB_H
if (have_fb) {
vbi_draw_vt_page_region(&tty->pg, fb_fmt,
fb_mem + fb_mem_offset,
@@ -142,13 +143,16 @@
0,1);
} else {
+#endif
len = vbi_export_txt(data,nl_langinfo(CODESET),25*41*8,
&tty->pg,&vbi_fullrect,VBI_ANSICOLOR);
tty_goto(0,0);
fwrite(data,len,1,stderr);
tty_goto(42,0);
free(data);
+#ifdef WITH_LINUX_FB_H
}
+#endif
}
static void
@@ -166,6 +170,7 @@
vbi_fetch_vt_page(tty->vbi->dec,&pg,pgno,subno,
VBI_WST_LEVEL_1p5,1,1);
vbi_fix_head(tty,pg.text);
+#ifdef WITH_LINUX_FB_H
if (have_fb) {
vbi_draw_vt_page_region(&pg, fb_fmt,
fb_mem + fb_mem_offset,
@@ -175,13 +180,16 @@
0,1);
} else {
+#endif
len = vbi_export_txt(data,nl_langinfo(CODESET),41*8,
&pg,&head,VBI_ANSICOLOR);
tty_goto(0,0);
fwrite(data,len,1,stderr);
tty_goto(42,0);
free(data);
+#ifdef WITH_LINUX_FB_H
}
+#endif
}
static void
@@ -232,7 +240,7 @@
vbi = vbi_open(device,debug,sim);
if (NULL == vbi)
exit(1);
-
+#ifdef WITH_LINUX_FB_H
if (0 /* 0 == fb_probe() */ ) {
have_fb = 1;
fb_init(NULL,NULL,0);
@@ -240,14 +248,21 @@
fb_switch_init();
switch_last = fb_switch_state;
} else {
+#endif
if (-1 != ioctl(0,TIOCGWINSZ,&win) && win.ws_row < 26) {
fprintf(stderr,"Terminal too small (need 26 rows, have %d)\n",
win.ws_row);
exit(1);
}
+#ifdef WITH_LINUX_FB_H
}
+#endif
tty_raw();
+#ifdef WITH_LINUX_FB_H
have_fb ? fb_clear() : tty_clear();
+#else
+ tty_clear();
+#endif
tty = malloc(sizeof(*tty));
memset(tty,0,sizeof(*tty));
@@ -264,14 +279,18 @@
rc = select(vbi->fd+1,&set,NULL,NULL,&tv);
if (-1 == rc) {
tty_restore();
+#ifdef WITH_LINUX_FB_H
if (have_fb)
fb_cleanup();
+#endif
perror("select");
exit(1);
}
if (0 == rc) {
+#ifdef WITH_LINUX_FB_H
if (have_fb)
fb_cleanup();
+#endif
tty_restore();
fprintf(stderr,"oops: timeout\n");
exit(1);
@@ -289,7 +308,11 @@
break;
case 'L' & 0x1f:
/* refresh */
+#ifdef WITH_LINUX_FB_H
have_fb ? fb_clear() : tty_clear();
+#else
+ tty_clear();
+#endif
vbi_render_page(tty);
break;
case 'i':
@@ -339,8 +362,10 @@
vbi_hasdata(vbi);
}
}
+#ifdef WITH_LINUX_FB_H
if (have_fb)
fb_cleanup();
+#endif
tty_goto(0,0);
tty_restore();
}
|