diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
commit | 5481848e27fdd4fc859def9841a0283665531a46 (patch) | |
tree | 990a8df008214d85141a3bd10bd96898e64b0c37 /src/user/dumphex | |
parent | 1e4a254674f668839e5de273916024c16814b045 (diff) | |
download | portland-os-5481848e27fdd4fc859def9841a0283665531a46.tar.gz |
fixed some paging bugs, added fault handlers and new programs
Diffstat (limited to 'src/user/dumphex')
-rw-r--r-- | src/user/dumphex/dumphex.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/user/dumphex/dumphex.c b/src/user/dumphex/dumphex.c new file mode 100644 index 0000000..4c63a06 --- /dev/null +++ b/src/user/dumphex/dumphex.c @@ -0,0 +1,29 @@ +#include <knob/file.h> +#include <knob/user.h> +#include <knob/format.h> + +void main(const char *path) { + struct file *f = open_file(path); + if (!f) { + tell_user_sz("Couldn't open file.\n"); + return; + } + char buf[] = { ' ', '\0', '\0', '\0' }; + uint8_t v; + uint32_t a = 0; + while (read_from_file(f, 1, &v)) { + if (!(a & 0xf)) { + char buf2[] = {'0', 'x', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0' }; + itosz_h32(a, buf2 + 2); + tell_user_sz(buf2); + tell_user_sz(" |"); + } + itosz_h8(v, buf + 1); + tell_user_sz(buf); + if (!(++a & 0xf)) + tell_user_sz("\n"); + } + tell_user_sz("\n"); + close_file(f); +}
\ No newline at end of file |