repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Introduce TinyHttp server
[lcapit-junk-code.git]
/
emu8086
/
src
/
dump.c
blob
fbc6636eb8f70e36620b39e6223f2e7350a34357
1
#include <stdio.h>
2
#include <fcntl.h>
3
#include <stdlib.h>
4
#include <unistd.h>
5
#include <sys/stat.h>
6
#include <sys/types.h>
7
8
static void
dump
(
const char
*
file
)
9
{
10
int
i
,
fd
;
11
unsigned char
byte
;
12
13
fd
=
open
(
file
,
O_RDONLY
);
14
15
for
(
i
=
0
;
read
(
fd
, &
byte
,
1
) >
0
;
i
++)
16
printf
(
"[%d] 0x%x
\n
"
,
i
,
byte
);
17
18
close
(
fd
);
19
}
20
21
int
main
(
int
argc
,
char
*
argv
[])
22
{
23
if
(
argc
!=
2
) {
24
fprintf
(
stderr
,
"dump < filename >
\n
"
);
25
exit
(
1
);
26
}
27
28
dump
(
argv
[
1
]);
29
return
0
;
30
}