dump_file.anubis
902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Dumping the content of a file.
define One
dump
(
RStream file,
Word32 n // current offset in file
) =
if *file is
{
failure then print("\n\n"),
success(c) then
(if (n&15) = 0
then print("\n"+to_hexa(n)+" ")
else unique);
(if (n&3) = 0
then print(" ")
else unique);
print(to_hexa(c)+" ");
dump(file,n+1)
}.
define One
dump
(
String filename
) =
if file(filename,read) is
{
failure then print("'"+filename+"' not found.\n"),
success(fp) then dump(fp,0)
}.
global define One
dump_file
(
List(String) args
) =
if args is
{
[ ] then print("Usage: dump_file <file name>\n"),
[h . _] then dump(h)
}.