#include <u.h>
#include <libc.h>
#include <bio.h>
Biobuf bin;
Biobuf bout;
void
main(void)
{
int c, i, o, oo;
char s[7];
Binit(&bin, 0, OREAD);
Binit(&bout, 1, OWRITE);
Blethal(&bin, 0);
Blethal(&bout, 0);
o = oo = 0;
while((c = Bgetc(&bin)) != -1){
if(oo == '\\' && o == 'u'){
snprint(s, sizeof(s), "0x%c", c);
for(i=3; i<6; i++)
s[i] = Bgetc(&bin);
Bprint(&bout, "%C", atoi(s));
}else if(o != '\\' && c != '\\')
Bputc(&bout, c);
oo = o;
o = c;
}
exits(0);
}
|