aboutsummaryrefslogtreecommitdiff
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 9e6ee8434..73aea409e 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
704void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC; 704void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC;
705/* If block_size == 0, display size without fractional part, 705/* If block_size == 0, display size without fractional part,
706 * else display (size * block_size) with one decimal digit. 706 * else display (size * block_size) with one decimal digit.
707 * If display_unit == 0, add suffix (K,M,G...), 707 * If display_unit == 0, show value no bigger than 1024 with suffix (K,M,G...),
708 * else divide by display_unit and do not use suffix. */ 708 * else divide by display_unit and do not use suffix. */
709#define HUMAN_READABLE_MAX_WIDTH 7 /* "1024.0G" */
710#define HUMAN_READABLE_MAX_WIDTH_STR "7"
709//TODO: provide pointer to buf (avoid statics)? 711//TODO: provide pointer to buf (avoid statics)?
710const char *make_human_readable_str(unsigned long long size, 712const char *make_human_readable_str(unsigned long long size,
711 unsigned long block_size, unsigned long display_unit) FAST_FUNC; 713 unsigned long block_size, unsigned long display_unit) FAST_FUNC;
diff --git a/include/unicode.h b/include/unicode.h
index 9f27657df..e11f2f9da 100644
--- a/include/unicode.h
+++ b/include/unicode.h
@@ -65,8 +65,30 @@ int iswspace(wint_t wc) FAST_FUNC;
65int iswalnum(wint_t wc) FAST_FUNC; 65int iswalnum(wint_t wc) FAST_FUNC;
66int iswpunct(wint_t wc) FAST_FUNC; 66int iswpunct(wint_t wc) FAST_FUNC;
67 67
68
68# endif /* !LOCALE_SUPPORT */ 69# endif /* !LOCALE_SUPPORT */
69 70
71
72# if 0 /* TODO: better support for printfing Unicode fields: */
73
74/* equivalent to printf("%-20.20s", str) */
75char unicode_buffer[20 * MB_CUR_MAX];
76printf("%s", unicode_exact(20, str, unicode_buffer);
77/* no need to free() anything */
78
79/* equivalent to printf("%-20s", str) */
80char *malloced = unicode_minimum(20, str);
81printf("%s", malloced);
82free(malloced); /* ugh */
83
84/* equivalent to printf("%-20s", str), better one */
85printf("%s%*s", str, unicode_pad_to_width(str, 20), "");
86/* equivalent to printf("%20s", str) */
87printf("%*s%s", unicode_pad_to_width(str, 20), "", str);
88
89# endif
90
91
70#endif /* FEATURE_ASSUME_UNICODE */ 92#endif /* FEATURE_ASSUME_UNICODE */
71 93
72#endif 94#endif