summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-02-24 13:22:04 -0500
committerJakob Kaivo <jkk@ung.org>2020-02-24 13:22:04 -0500
commit60819a90d1771ab147d4641befc956a36b8084b8 (patch)
tree8b3c29266f80a01ab0941766103aad462f4d3eda
parent082b6df1c36509e3708464dde99c698d35484d0f (diff)
better printable character printingHEADmaster
-rw-r--r--leet.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/leet.c b/leet.c
index 0c5bb03..b166f80 100644
--- a/leet.c
+++ b/leet.c
@@ -17,21 +17,26 @@ void hexdump(uintmax_t address, size_t n, unsigned char buf[static n])
n = BUFSIZE;
}
- printf("\033[1m\r%015jx ", address);
- for (size_t i = 0; i < n; i++) {
- printf("\033[%hhdm%02hhx\033[0m ", COLOR(buf[i]), buf[i]);
- usleep(100 * buf[i]);
- }
- for (size_t i = n; i < BUFSIZE; i++) {
- printf("-- ");
- }
+ unsigned char ch = buf[n - 1];
+ for (int c = 0; c < ch; c++) {
+ buf[n - 1] = c;
+
+ printf("\033[1m\r%015jx ", address);
+ for (size_t i = 0; i < n; i++) {
+ printf("\033[%hhdm%02hhx\033[0m ", COLOR(buf[i]), buf[i]);
+ //usleep(100 * buf[i]);
+ }
+ for (size_t i = n; i < BUFSIZE; i++) {
+ printf("-- ");
+ }
- for (size_t i = 0; i < n; i++) {
- printf("\033[%hhdm%c\033[0m", COLOR(buf[i]), isprint(buf[i]) ? buf[i] : '.');
- usleep(100 * buf[i]);
- }
- for (size_t i = n; i < 16; i++) {
- printf(".");
+ for (size_t i = 0; i < n; i++) {
+ printf("\033[%hhdm%c\033[0m", COLOR(buf[i]), isprint(buf[i]) ? buf[i] : '.');
+ usleep(100 * buf[i]);
+ }
+ for (size_t i = n; i < 16; i++) {
+ printf(".");
+ }
}
}