Introduce TinyHttp server
[lcapit-junk-code.git] / emu8086 / src / dump.c
blobfbc6636eb8f70e36620b39e6223f2e7350a34357
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>
8 static void dump(const char *file)
10 int i, fd;
11 unsigned char byte;
13 fd = open(file, O_RDONLY);
15 for (i = 0; read(fd, &byte, 1) > 0; i++)
16 printf("[%d] 0x%x\n", i, byte);
18 close(fd);
21 int main(int argc, char *argv[])
23 if (argc != 2) {
24 fprintf(stderr, "dump < filename >\n");
25 exit(1);
28 dump(argv[1]);
29 return 0;