printf: fix printf "%u\n" +18446744073709551614
[oweals/busybox.git] / include / libbb.h
index d4ba031dfe129dcd6f877235a82ca185e0066547..140404ff5c40d34553669c01d5ebc71389543bf2 100644 (file)
@@ -410,6 +410,9 @@ enum {      /* cp.c, mv.c, install.c depend on these values. CAREFUL when changing th
        FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 15, /* -c */
 #endif
        FILEUTILS_RMDEST          = 1 << (16 - !ENABLE_SELINUX), /* --remove-destination */
+       /* bit 17 skipped for "cp --parents" */
+       FILEUTILS_REFLINK         = 1 << (18 - !ENABLE_SELINUX), /* cp --reflink=auto */
+       FILEUTILS_REFLINK_ALWAYS  = 1 << (19 - !ENABLE_SELINUX), /* cp --reflink[=always] */
        /*
         * Hole. cp may have some bits set here,
         * they should not affect remove_file()/copy_file()
@@ -830,7 +833,8 @@ typedef struct uni_stat_t {
 } uni_stat_t;
 /* Returns a string with unprintable chars replaced by '?' or
  * SUBST_WCHAR. This function is unicode-aware. */
-const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str);
+const char* FAST_FUNC printable_string(const char *str);
+const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str);
 /* Prints unprintable char ch as ^C or M-c to file
  * (M-c is used only if ch is ORed with PRINTABLE_META),
  * else it is printed as-is (except for ch = 0x9b) */
@@ -1015,6 +1019,14 @@ int xatoi_positive(const char *numstr) FAST_FUNC;
 /* Useful for reading port numbers */
 uint16_t xatou16(const char *numstr) FAST_FUNC;
 
+#if ENABLE_FLOAT_DURATION
+typedef double duration_t;
+void sleep_for_duration(duration_t duration) FAST_FUNC;
+#else
+typedef unsigned duration_t;
+#define sleep_for_duration(duration) sleep(duration)
+#endif
+duration_t parse_duration_str(char *str) FAST_FUNC;
 
 /* These parse entries in /etc/passwd and /etc/group.  This is desirable
  * for BusyBox since we want to avoid using the glibc NSS stuff, which
@@ -2116,6 +2128,23 @@ extern const char bb_default_login_shell[] ALIGN1;
 # define FB_0 "/dev/fb0"
 #endif
 
+// storage helpers for mk*fs utilities
+char BUG_wrong_field_size(void);
+#define STORE_LE(field, value) \
+do { \
+       if (sizeof(field) == 4) \
+               field = SWAP_LE32((uint32_t)(value)); \
+       else if (sizeof(field) == 2) \
+               field = SWAP_LE16((uint16_t)(value)); \
+       else if (sizeof(field) == 1) \
+               field = (uint8_t)(value); \
+       else \
+               BUG_wrong_field_size(); \
+} while (0)
+
+#define FETCH_LE32(field) \
+       (sizeof(field) == 4 ? SWAP_LE32(field) : BUG_wrong_field_size())
+
 
 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))