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[])
48 if(open(*argv, OREAD) < 0)
53 Binit(&bin, 0, OREAD);
54 Binit(&bout, 1, OWRITE);
57 while((c = Bgetc(&bin)) >= 0){
61 if((c1 = Bgetc(&bin)) < 0)
63 if((x1 = hexdigit(c1)) < 0){
68 if((c2 = Bgetc(&bin)) < 0)
70 if((x2 = hexdigit(c2)) < 0){
82 while((c = Bgetc(&bin)) >= 0){
83 if(c>0 && strchr("/$-_@.!*'(),", c)
92 Bputc(&bout, Hex[c>>4]);
93 Bputc(&bout, Hex[c&15]);