[hackers] [sbase] Properly handle namedict in od(1) || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 30 Sep 2015 20:44:17 +0200 (CEST)

commit 365f392d3c1e2e204bbb466469a5e56cf7a10ec5
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Tue Sep 29 23:40:20 2015 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Sep 30 19:44:10 2015 +0100

    Properly handle namedict in od(1)
    
    I added the [127]-index but forgot that this increases the length,
    breaking a later check.

diff --git a/od.c b/od.c
index 407f550..8e71b60 100644
--- a/od.c
+++ b/od.c
_AT_@ -36,7 +36,6 @@ printchar(FILE *f, unsigned char c)
                 "so", "si", "dle", "dc1", "dc2", "dc3", "dc4",
                 "nak", "syn", "etb", "can", "em", "sub", "esc",
                 "fs", "gs", "rs", "us", "sp",
- [127] = "del"
         };
         const char *escdict[] = {
                 ['\0'] = "\\0", ['\a'] = "\\a",
_AT_@ -56,7 +55,7 @@ printchar(FILE *f, unsigned char c)
                 case 'a':
                         c &= ~128; /* clear high bit as required by standard */
                         if (c < LEN(namedict) || c == 127) {
- fprintf(f, "%3s ", namedict[c]);
+ fprintf(f, "%3s ", (c == 127) ? "del" : namedict[c]);
                                 return;
                         }
                         break;
Received on Wed Sep 30 2015 - 20:44:17 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 30 2015 - 20:48:25 CEST