6 static char *
rcsid=
"@(#)$Id$";
9 #pragma init (init_object_module)
16 #include <sys/types.h>
20 #define CHAR_SIZE 16384
24 static char us[4]={0x1b, 0x5b, 0x34, 0x6d},
25 ue[3]={0x1b, 0x5b, 0x6d},
26 so[4]={0x1b, 0x5b, 0x37, 0x6d},
27 se[3]={0x1b, 0x5b, 0x6d},
28 md[4]={0x1b, 0x5b, 0x31, 0x6d},
29 me[3]={0x1b, 0x5b, 0x6d};
55 if ((str[0] ==
't') && (str[1] ==
't'))
57 if ((str[0] ==
'e') && (str[1] ==
'm'))
59 if ((str[0] ==
'i') && (str[1] ==
't'))
61 if ((str[0] ==
'b') && (str[1] ==
'f'))
71 {
register int i,j, fd;
72 int brace=1, bslash=0, brace2=0, emphasis=0, kanji=0, mode;
80 offset=(off_t)ckintval(argv[1]);
84 lseek( fd, offset, 0);
88 for(sp=&str[0],j=0;brace != 0;){
93 for(i=0;i<2;i++){ c=
READ_CHAR(fd); *sp++=c;}
97 else if (bslash != 0){
99 case '>' :
for(i=0; i<3; i++) *sp++=
' ';
100 case '=' : bslash=0;
break;
106 case '#' : *sp++=c; bslash=0;
break;
107 case '\\': *sp++=0x0a; bslash=0;
break;
110 case 1 :
ch=
us;
break;
111 case 2 :
ch=
so;
break;
112 case 3 :
ch=
md;
break;
120 case '}' :
if (j == 0) *sp++=c;
122 case '[' : j=0;
break;
123 case '{' :
if (j == 0) {*sp++=
'{'; bslash=0;
break;}
125 case ']' :
for(i=0;i<4;i++) *sp++=
' ';
126 for(i=0;i<j;i++) *sp++=cmd[i];
130 default : cmd[j++]=c;
break;
136 case '\\': bslash=1; j=0;
break;
137 case '{' : brace++;
break;
138 case '}' :
if (emphasis != 0){
139 for(i=0;i<3;i++) *sp++=
ue[i];
143 case '%' :
while ((c=
READ_CHAR(fd)) != 10);
break;
144 case 10 :
if (brace2 == 1) *sp++=10;
else *sp++=
' ';
146 case 27 : kanji=1; *sp++=27;
break;
147 default : *sp++=c;
break;