9 char hex[] = "0123456789abcdef";
10 char Hex[] = "0123456789ABCDEF";
18 if((p = strchr(Hex, c)) != 0)
20 if((p = strchr(hex, c)) != 0)
29 fprint(2, "Usage: %s [ -d ] [ file ]\n", argv0);
34 main(int argc, char *argv[])
49 fd = open(*argv, OREAD);
52 if(fd != 0) dup(fd, 0);
56 Binit(&bin, 0, OREAD);
57 Binit(&bout, 1, OWRITE);
60 while((c = Bgetc(&bin)) >= 0){
64 if((c1 = Bgetc(&bin)) < 0)
66 if((x1 = hexdigit(c1)) < 0){
71 if((c2 = Bgetc(&bin)) < 0)
73 if((x2 = hexdigit(c2)) < 0){
85 while((c = Bgetc(&bin)) >= 0){
86 if(c>0 && strchr("/$-_@.!*'(),", c)
95 Bputc(&bout, Hex[c>>4]);
96 Bputc(&bout, Hex[c&15]);