summaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/src/common.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-20 18:14:37 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-20 18:14:37 +0300
commit1e9b0691a9c52f8b56abc10a214a8aaa228b361b (patch)
tree0a6c23bcbcca951b69a664e1367817aeda59ca0f /ubi-utils/new-utils/src/common.h
parent49953500edc32e949b5f567fca67ed5430a68540 (diff)
ubi-utils: various clean-ups and preparations
This patch introduces many clean-ups, nicifications and preparations to the following ubiformat utility. There are also fixes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils/src/common.h')
-rw-r--r--ubi-utils/new-utils/src/common.h25
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);