+/*
+ * Make "large" numbers a little easier to read by showing them in hexadecimal
+ * if they are "close" to a power of two.
+ */
+static const char *
+number_format(int value)
+{
+ const char *result = "%d";
+ if ((outform != F_TERMCAP) && (value > 255)) {
+ unsigned long lv = (unsigned long) value;
+ unsigned long mm;
+ int nn;
+ for (nn = 8; (mm = (1UL << nn)) != 0; ++nn) {
+ if ((mm - 16) <= lv && (mm + 16) > lv) {
+ result = "%#x";
+ break;
+ }
+ }
+ }
+ return result;
+}
+