diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2012-09-12 16:38:33 +0200 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-09-25 18:06:46 +0300 |
commit | 4f1b10827b81cd9acaa9e02b0da0dc447f1471ea (patch) | |
tree | b975f29a12a5ef809ea4da8ec8f03ee97d79fc45 /include/common.h | |
parent | c009e12a7c87ed8dc591d7c67fd71b53b6ebf538 (diff) |
introduce PRIxoff_t and PRIdoff_t printf helpers
They will be usefull when printing offsets.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 88b67e5..d0c4146 100644 --- a/include/common.h +++ b/include/common.h @@ -25,6 +25,8 @@ #include <string.h> #include <fcntl.h> #include <errno.h> +#include <features.h> +#include <inttypes.h> #include "version.h" #ifndef PROGRAM_NAME @@ -48,6 +50,15 @@ extern "C" { #define O_CLOEXEC 0 #endif +/* define a print format specifier for off_t */ +#ifdef __USE_FILE_OFFSET64 +#define PRIxoff_t PRIx64 +#define PRIdoff_t PRId64 +#else +#define PRIxoff_t "l"PRIx32 +#define PRIdoff_t "l"PRId32 +#endif + /* Verbose messages */ #define bareverbose(verbose, fmt, ...) do { \ if (verbose) \ |