From: Richard Genoud Date: Wed, 12 Sep 2012 14:38:33 +0000 (+0200) Subject: introduce PRIxoff_t and PRIdoff_t printf helpers X-Git-Tag: v1.5.1~43 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4f1b10827b81cd9acaa9e02b0da0dc447f1471ea;p=mtd-utils.git introduce PRIxoff_t and PRIdoff_t printf helpers They will be usefull when printing offsets. Signed-off-by: Richard Genoud Signed-off-by: Artem Bityutskiy --- 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 #include #include +#include +#include #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) \