sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 3cf51d4c3aeee30ac3ac4f625a56252f12082aa3
parent 4b4ffac872b870db6445f07e736c357e2e55b9e7
Author: FRIGN <dev@frign.de>
Date:   Mon Oct 26 12:52:14 +0100

Properly parse numbers in od(1)

Previously, it'd drop right through in the number case and return
crazy-long numbers (like 28 for L), resulting in unexpected behaviour.

Diffstat:
od.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/od.c b/od.c @@ -224,11 +224,10 @@ main(int argc, char *argv[]) case 'x': t->format = *s; /* todo: allow multiple digits */ - if (*(s+1) > '0' || *(s+1) <= '9') { - t->len = *(s+1) - '0'; - s++; + if (*(s+1) > '0' && *(s+1) <= '9') { + t->len = *(++s) - '0'; } else { - switch (*(s + 1)) { + switch (*(++s)) { case 'C': t->len = sizeof(char); break;