44 lines
763 B
C
Executable File
44 lines
763 B
C
Executable File
#include <xolatile/xtandard.h>
|
|
|
|
static void echo_byte (uchar byte) {
|
|
output ("0123456789ABCDEF" + byte / 16, 1);
|
|
output ("0123456789ABCDEF" + byte % 16, 1);
|
|
|
|
output (" ", 1);
|
|
}
|
|
|
|
int main (int argc, char * * argv) {
|
|
int file = 0;
|
|
ulong size = 0;
|
|
uchar * buffer = null;
|
|
|
|
if (argc != 2) {
|
|
print ("> xop input_file\n");
|
|
|
|
return (log_failure);
|
|
}
|
|
|
|
file = file_open (argv [1], file_flag_read);
|
|
size = file_size (argv [1]);
|
|
|
|
buffer = allocate (size * sizeof (* buffer));
|
|
|
|
file_read (file, buffer, size);
|
|
|
|
file = file_close (file);
|
|
|
|
for (ulong offset = 0; offset < size; ++offset) {
|
|
if (buffer [offset] == 0x90) {
|
|
echo ("\n");
|
|
}
|
|
|
|
echo_byte (buffer [offset]);
|
|
}
|
|
|
|
echo ("\n");
|
|
|
|
buffer = deallocate (buffer);
|
|
|
|
return (log_success);
|
|
}
|