| git.druid.rocks | index | druid520 | ports | ports/ | coreutils/ | sbase/ | patches/ | 0002-od-fix-t-suffix-parsing.patch |
ports/coreutils/sbase/patches/0002-od-fix-t-suffix-parsing.patch
# sbase's own od -t parsing peeks at the digit/C/S/I/L width suffix
# character after a type letter (e.g. the "1" in "-t x1") but never
# actually advances past it -- confirmed for real, the outer parsing
# loop's own increment then reprocesses that suffix character on the
# NEXT iteration as if it were its own independent type letter,
# falling through to usage() ("-t x1" failing outright). fixed by
# advancing past the suffix once it's actually been consumed, only in
# the cases that genuinely consumed one (an unrecognized suffix
# correctly falls through to the int-sized default without consuming
# anything, exactly as before).
--- a/od.c 2026-09-11 21:58:22.312114335 +0000
+++ b/od.c 2026-09-11 21:58:22.313114326 +0000
@@ -259,30 +259,37 @@
case 'd':
case 'o':
case 'u':
- case 'x':
+ case 'x': {
/* todo: allow multiple digits */
+ char type = *s;
if (*(s+1) > '0' && *(s+1) <= '9') {
len = *(s+1) - '0';
+ s++;
} else {
switch (*(s+1)) {
case 'C':
len = sizeof(char);
+ s++;
break;
case 'S':
len = sizeof(short);
+ s++;
break;
case 'I':
len = sizeof(int);
+ s++;
break;
case 'L':
len = sizeof(long);
+ s++;
break;
default:
len = sizeof(int);
}
}
- addtype(*s, len);
+ addtype(type, len);
break;
+ }
default:
usage();
}