diff options
Diffstat (limited to 'ubi-utils/new-utils/src/common.h')
-rw-r--r-- | ubi-utils/new-utils/src/common.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ubi-utils/new-utils/src/common.h b/ubi-utils/new-utils/src/common.h index bd99341..720dec1 100644 --- a/ubi-utils/new-utils/src/common.h +++ b/ubi-utils/new-utils/src/common.h @@ -43,24 +43,29 @@ extern "C" { #define normsg_cont(fmt, ...) do { \ printf(PROGRAM_NAME ": " fmt, ##__VA_ARGS__); \ } while(0) +#define normsg_cont(fmt, ...) do { \ + printf(PROGRAM_NAME ": " fmt, ##__VA_ARGS__); \ +} while(0) /* Error messages */ -#define errmsg(fmt, ...) ({ \ - fprintf(stderr, PROGRAM_NAME " error: " fmt "\n", ##__VA_ARGS__); \ - -1; \ +#define errmsg(fmt, ...) ({ \ + fprintf(stderr, PROGRAM_NAME ": error!: " fmt "\n", ##__VA_ARGS__); \ + -1; \ }) /* System error messages */ -#define sys_errmsg(fmt, ...) ({ \ - int _err = errno; \ - fprintf(stderr, PROGRAM_NAME " error: " fmt "\n", ##__VA_ARGS__); \ - fprintf(stderr, "error %d (%s)\n", _err, strerror(_err)); \ - -1; \ +#define sys_errmsg(fmt, ...) ({ \ + int _err = errno, _i; \ + fprintf(stderr, PROGRAM_NAME ": error!: " fmt "\n", ##__VA_ARGS__); \ + for (_i = 0; _i < sizeof(PROGRAM_NAME) + 1; _i++) \ + fprintf(stderr, " "); \ + fprintf(stderr, "error %d (%s)\n", _err, strerror(_err)); \ + -1; \ }) /* Warnings */ -#define warnmsg(fmt, ...) do { \ - fprintf(stderr, PROGRAM_NAME " warning: " fmt "\n", ##__VA_ARGS__); \ +#define warnmsg(fmt, ...) do { \ + fprintf(stderr, PROGRAM_NAME ": warning!: " fmt "\n", ##__VA_ARGS__); \ } while(0) long long ubiutils_get_bytes(const char *str); |