diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2018-10-07 14:13:20 +0200 |
---|---|---|
committer | Eugene Syromyatnikov <evgsyr@gmail.com> | 2022-09-02 17:55:13 +0200 |
commit | 90d339003e4dfe9d0c2e3c069248021d14856e5e (patch) | |
tree | e41dd38b8aaee3b9b9a51c3da21ea0786e0acfcc | |
parent | 7a7efa7eb3c4af6913a35f8c8be448276cf80975 (diff) | |
download | strace-90d339003e4dfe9d0c2e3c069248021d14856e5e.tar.gz |
xlat: add XLAT_STYLE_FMT_O for octal output
* xlat.h (enum xlat_style): Add XLAT_STYLE_FMT_O.
* xlat.c (sprint_xlat_val): Handle XLAT_STYLE_FMT_O, reorder switch
branches in accordance with enum constant order.
-rw-r--r-- | src/xlat.c | 12 | ||||
-rw-r--r-- | src/xlat.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/xlat.c b/src/xlat.c index fed9586b5..c45439917 100644 --- a/src/xlat.c +++ b/src/xlat.c @@ -28,16 +28,20 @@ sprint_xlat_val(uint64_t val, enum xlat_style style) static char buf[sizeof(val) * 3]; switch (xlat_format(style)) { - case XLAT_STYLE_FMT_D: - xsprintf(buf, "%" PRId64, val); + case XLAT_STYLE_FMT_X: + xsprintf(buf, "%#" PRIx64, val); break; case XLAT_STYLE_FMT_U: xsprintf(buf, "%" PRIu64, val); break; - case XLAT_STYLE_FMT_X: - xsprintf(buf, "%#" PRIx64, val); + case XLAT_STYLE_FMT_D: + xsprintf(buf, "%" PRId64, val); + break; + + case XLAT_STYLE_FMT_O: + xsprintf(buf, "%#" PRIo64, val); break; } diff --git a/src/xlat.h b/src/xlat.h index 8aa39b57b..be964e26e 100644 --- a/src/xlat.h +++ b/src/xlat.h @@ -41,6 +41,7 @@ enum xlat_style { XLAT_STYLE_FMT_X = 0 << XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FMT_U = 1 << XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FMT_D = 2 << XLAT_STYLE_FORMAT_SHIFT, + XLAT_STYLE_FMT_O = 3 << XLAT_STYLE_FORMAT_SHIFT, # define XLAT_STYLE_FORMAT_MASK (3 << XLAT_STYLE_FORMAT_SHIFT) |