2025-04-27 02:32:20 +02:00

59 lines
1.7 KiB
C
Executable File

/// __ _____ _ __
/// \ \/ / _ \| '_ \
/// > < (_) | |_) |
/// /_/\_\___/| .__/
/// |_|
///
/// Copyright (c) 1997 - Ognjen 'xolatile' Milan Robovic
///
/// xolatile@chud.cyou - xop - The evil within...
///
/// This program is free software, free as in freedom and as in free beer, you can redistribute it and/or modify it under the terms of the GNU
/// General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version if you wish...
///
/// This program is distributed in the hope that it will be useful, but it is probably not, and without any warranty, without even the implied
/// warranty of merchantability or fitness for a particular purpose, because it is pointless. Please see the GNU (Geenoo) General Public License
/// for more details, if you dare, it is a lot of text that nobody wants to read...
#include "xtandard.h"
static procedure echo_byte (natural_8 byte) {
output ("0123456789ABCDEF" + byte / 16, 1);
output ("0123456789ABCDEF" + byte % 16, 1);
output (" ", 1);
}
integer main (integer argc, character * * argv) {
integer file = 0;
natural_64 size = 0;
natural_8 * buffer = null;
if (argc != 2) {
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 (natural_64 offset = 0; offset < size; ++offset) {
conditional_print (buffer [offset] == 0x90, "\n/B/1");
echo_byte (buffer [offset]);
conditional_print (buffer [offset] == 0x90, "/-");
}
print ("\n");
buffer = deallocate (buffer);
return (log_success);
}