Debian Codegraph @

bin/asciify

raw
1 #!/bin/csh
2
3 # convert binary files to ascii, so they can be viewed or diffed
4
5 set dosconvert = 0
6 set macconvert = 0
7 if ("q$1" == "q-m") then
8 set macconvert = 1
9 shift
10 endif
11 if ("q$1" == "q-d") then
12 set dosconvert = 1
13 shift
14 endif
15
16 while ($#argv > 0)
17 if ($dosconvert == 1) then
18 perl -pe's/\r\n/\n/gs;s/\r/\n/gs' "$1" | cat -v >! "$1.ascii"
19 else
20 if ($macconvert == 1) then
21 perl -pe's/\r/\n/gs' "$1" | cat -v >! "$1.ascii"
22 else
23 cat -v "$1" >! "$1.ascii"
24 endif
25 endif
26 shift
27 end