# define STRTOOFF strtol
# define SAFE_STRTOOFF safe_strtol
# define XSTRTOUOFF xstrtoul
-# define OFF_FMT "ld"
+/* usage: printf("size: %"OFF_FMT"d (%"OFF_FMT"x)\n", sz, sz); */
+# define OFF_FMT "l"
# else
/* "long" is too short, need "long long" */
# define STRTOOFF strtoll
# define SAFE_STRTOOFF safe_strtoll
# define XSTRTOUOFF xstrtoull
-# define OFF_FMT "lld"
+# define OFF_FMT "ll"
# endif
#else
# if 0 /* #if UINT_MAX == 0xffffffff */
# define STRTOOFF strtol
# define SAFE_STRTOOFF safe_strtoi
# define XSTRTOUOFF xstrtou
-# define OFF_FMT "d"
+# define OFF_FMT ""
# else
# define STRTOOFF strtol
# define SAFE_STRTOOFF safe_strtol
# define XSTRTOUOFF xstrtoul
-# define OFF_FMT "ld"
+# define OFF_FMT "l"
# endif
#endif
/* scary. better ideas? (but do *test* them first!) */
extern ssize_t safe_write(int fd, const void *buf, size_t count);
extern ssize_t full_write(int fd, const void *buf, size_t count);
-extern void xwrite(int fd, void *buf, size_t count);
+extern void xwrite(int fd, const void *buf, size_t count);
/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
extern void xprint_and_close_file(FILE *file);
const char *suffix;
unsigned mult;
};
-unsigned long long xstrtoull(const char *numstr, int base);
-unsigned long long xatoull(const char *numstr);
-unsigned long xstrtoul_range_sfx(const char *numstr, int base,
- unsigned long lower,
- unsigned long upper,
- const struct suffix_mult *suffixes);
-unsigned long xstrtoul_range(const char *numstr, int base,
- unsigned long lower,
- unsigned long upper);
-unsigned long xstrtoul_sfx(const char *numstr, int base,
- const struct suffix_mult *suffixes);
-unsigned long xstrtoul(const char *numstr, int base);
-unsigned long xatoul_range_sfx(const char *numstr,
- unsigned long lower,
- unsigned long upper,
- const struct suffix_mult *suffixes);
-unsigned long xatoul_sfx(const char *numstr,
- const struct suffix_mult *suffixes);
-unsigned long xatoul_range(const char *numstr,
- unsigned long lower,
- unsigned long upper);
-unsigned long xatoul(const char *numstr);
-long xstrtol_range_sfx(const char *numstr, int base,
- long lower,
- long upper,
- const struct suffix_mult *suffixes);
-long xstrtol_range(const char *numstr, int base, long lower, long upper);
-long xatol_range_sfx(const char *numstr,
- long lower,
- long upper,
- const struct suffix_mult *suffixes);
-long xatol_range(const char *numstr, long lower, long upper);
-long xatol_sfx(const char *numstr, const struct suffix_mult *suffixes);
-long xatol(const char *numstr);
+#include "xatonum.h"
/* Specialized: */
-unsigned xatou_range(const char *numstr, unsigned lower, unsigned upper);
-unsigned xatou_sfx(const char *numstr, const struct suffix_mult *suffixes);
-unsigned xatou(const char *numstr);
-int xatoi_range(const char *numstr, int lower, int upper);
-int xatoi(const char *numstr);
/* Using xatoi() instead of naive atoi() is not always convenient -
* in many places people want *non-negative* values, but store them
* in signed int. Therefore we need this one:
* dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */
int xatoi_u(const char *numstr);
-uint32_t xatou32(const char *numstr);
/* Useful for reading port numbers */
uint16_t xatou16(const char *numstr);
extern void renew_current_security_context(void);
extern void set_current_security_context(security_context_t sid);
#endif
-extern int run_parts(char **args, const unsigned char test_mode, char **env);
extern int restricted_shell(const char *shell);
extern void setup_environment(const char *shell, int loginshell, int changeenv, const struct passwd *pw);
extern int correct_password(const struct passwd *pw);
int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
void reset_ino_dev_hashtable(void);
+#ifdef __GLIBC__
+/* At least glibc has horrendously large inline for this, so wrap it */
+extern unsigned long long bb_makedev(unsigned int major, unsigned int minor);
+#undef makedev
+#define makedev(a,b) bb_makedev(a,b)
+#endif
#ifndef COMM_LEN
pid_t *pidlist_reverse(pid_t *pidList);
void clear_username_cache(void);
const char* get_cached_username(uid_t uid);
+const char* get_cached_groupname(gid_t gid);
extern const char bb_uuenc_tbl_base64[];
#define RB_POWER_OFF 0x4321fedc
#endif
-// Make sure we call functions instead of macros.
+/* Make sure we call functions instead of macros. */
#undef isalnum
#undef isalpha
#undef isascii