summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h4
-rw-r--r--include/unicode.h22
2 files changed, 25 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 9e6ee84..73aea40 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -704,8 +704,10 @@ void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale) FAST_F
void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC;
/* If block_size == 0, display size without fractional part,
* else display (size * block_size) with one decimal digit.
- * If display_unit == 0, add suffix (K,M,G...),
+ * If display_unit == 0, show value no bigger than 1024 with suffix (K,M,G...),
* else divide by display_unit and do not use suffix. */
+#define HUMAN_READABLE_MAX_WIDTH 7 /* "1024.0G" */
+#define HUMAN_READABLE_MAX_WIDTH_STR "7"
//TODO: provide pointer to buf (avoid statics)?
const char *make_human_readable_str(unsigned long long size,
unsigned long block_size, unsigned long display_unit) FAST_FUNC;
diff --git a/include/unicode.h b/include/unicode.h
index 9f27657..e11f2f9 100644
--- a/include/unicode.h
+++ b/include/unicode.h
@@ -65,8 +65,30 @@ int iswspace(wint_t wc) FAST_FUNC;
int iswalnum(wint_t wc) FAST_FUNC;
int iswpunct(wint_t wc) FAST_FUNC;
+
# endif /* !LOCALE_SUPPORT */
+
+# if 0 /* TODO: better support for printfing Unicode fields: */
+
+/* equivalent to printf("%-20.20s", str) */
+char unicode_buffer[20 * MB_CUR_MAX];
+printf("%s", unicode_exact(20, str, unicode_buffer);
+/* no need to free() anything */
+
+/* equivalent to printf("%-20s", str) */
+char *malloced = unicode_minimum(20, str);
+printf("%s", malloced);
+free(malloced); /* ugh */
+
+/* equivalent to printf("%-20s", str), better one */
+printf("%s%*s", str, unicode_pad_to_width(str, 20), "");
+/* equivalent to printf("%20s", str) */
+printf("%*s%s", unicode_pad_to_width(str, 20), "", str);
+
+# endif
+
+
#endif /* FEATURE_ASSUME_UNICODE */
#endif