diff options
| author | Ron Yorston <rmy@pobox.com> | 2018-10-08 08:31:11 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2018-10-08 08:31:11 +0100 |
| commit | eee3722fd32c8c0929cfbacdbe0b6524e1fd645c (patch) | |
| tree | c9026160e56f204c42029c705d1d16cecd515244 /include | |
| parent | 25a1bcec7637e0f0c75d3ae6c09eb78fdb6f0a75 (diff) | |
| parent | 349d72c19ced4fae64e8fdd5792b37e78ac2f616 (diff) | |
| download | busybox-w32-eee3722fd32c8c0929cfbacdbe0b6524e1fd645c.tar.gz busybox-w32-eee3722fd32c8c0929cfbacdbe0b6524e1fd645c.tar.bz2 busybox-w32-eee3722fd32c8c0929cfbacdbe0b6524e1fd645c.zip | |
Merge branch 'busybox' into merge
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h index 0d09fef66..0a333dca8 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -874,7 +874,8 @@ typedef struct uni_stat_t { | |||
| 874 | } uni_stat_t; | 874 | } uni_stat_t; |
| 875 | /* Returns a string with unprintable chars replaced by '?' or | 875 | /* Returns a string with unprintable chars replaced by '?' or |
| 876 | * SUBST_WCHAR. This function is unicode-aware. */ | 876 | * SUBST_WCHAR. This function is unicode-aware. */ |
| 877 | const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str); | 877 | const char* FAST_FUNC printable_string(const char *str); |
| 878 | const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str); | ||
| 878 | /* Prints unprintable char ch as ^C or M-c to file | 879 | /* Prints unprintable char ch as ^C or M-c to file |
| 879 | * (M-c is used only if ch is ORed with PRINTABLE_META), | 880 | * (M-c is used only if ch is ORed with PRINTABLE_META), |
| 880 | * else it is printed as-is (except for ch = 0x9b) */ | 881 | * else it is printed as-is (except for ch = 0x9b) */ |
| @@ -2194,6 +2195,23 @@ extern const char bb_default_login_shell[] ALIGN1; | |||
| 2194 | # define FB_0 "/dev/fb0" | 2195 | # define FB_0 "/dev/fb0" |
| 2195 | #endif | 2196 | #endif |
| 2196 | 2197 | ||
| 2198 | // storage helpers for mk*fs utilities | ||
| 2199 | char BUG_wrong_field_size(void); | ||
| 2200 | #define STORE_LE(field, value) \ | ||
| 2201 | do { \ | ||
| 2202 | if (sizeof(field) == 4) \ | ||
| 2203 | field = SWAP_LE32((uint32_t)(value)); \ | ||
| 2204 | else if (sizeof(field) == 2) \ | ||
| 2205 | field = SWAP_LE16((uint16_t)(value)); \ | ||
| 2206 | else if (sizeof(field) == 1) \ | ||
| 2207 | field = (uint8_t)(value); \ | ||
| 2208 | else \ | ||
| 2209 | BUG_wrong_field_size(); \ | ||
| 2210 | } while (0) | ||
| 2211 | |||
| 2212 | #define FETCH_LE32(field) \ | ||
| 2213 | (sizeof(field) == 4 ? SWAP_LE32(field) : BUG_wrong_field_size()) | ||
| 2214 | |||
| 2197 | 2215 | ||
| 2198 | #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0]))) | 2216 | #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0]))) |
| 2199 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 2217 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
