aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-17 16:43:20 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-17 16:46:23 +0300
commit49953500edc32e949b5f567fca67ed5430a68540 (patch)
tree4b2ba0eca5febffeea6c8d046d78f8eb02a9b71f /ubi-utils
parent7280a34fc4dc7a40e6fc0b3317fb09ec90413af7 (diff)
ubi-utils: use common.h in libubi
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/new-utils/src/common.h5
-rw-r--r--ubi-utils/new-utils/src/libubi.c8
-rw-r--r--ubi-utils/new-utils/src/libubi_int.h14
-rw-r--r--ubi-utils/new-utils/src/ubinfo.c2
-rw-r--r--ubi-utils/new-utils/src/ubinize.c5
5 files changed, 12 insertions, 22 deletions
diff --git a/ubi-utils/new-utils/src/common.h b/ubi-utils/new-utils/src/common.h
index a3fc51f..bd99341 100644
--- a/ubi-utils/new-utils/src/common.h
+++ b/ubi-utils/new-utils/src/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Artem Bityutskiy, 2007
+ * Copyright (c) Artem Bityutskiy, 2007, 2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,6 +40,9 @@ extern "C" {
#define normsg(fmt, ...) do { \
printf(PROGRAM_NAME ": " fmt "\n", ##__VA_ARGS__); \
} while(0)
+#define normsg_cont(fmt, ...) do { \
+ printf(PROGRAM_NAME ": " fmt, ##__VA_ARGS__); \
+} while(0)
/* Error messages */
#define errmsg(fmt, ...) ({ \
diff --git a/ubi-utils/new-utils/src/libubi.c b/ubi-utils/new-utils/src/libubi.c
index f0cbc9e..5e6f9b1 100644
--- a/ubi-utils/new-utils/src/libubi.c
+++ b/ubi-utils/new-utils/src/libubi.c
@@ -32,6 +32,9 @@
#include <limits.h>
#include "libubi.h"
#include "libubi_int.h"
+#include "common.h"
+
+#define PROGRAM_NAME "libubi"
/**
* mkpath - compose full path from 2 given components.
@@ -628,9 +631,8 @@ libubi_t libubi_open(int required)
if (read_positive_int(lib->ubi_version, &version))
goto out_error;
if (version != LIBUBI_UBI_VERSION) {
- fprintf(stderr, "LIBUBI: this library was made for UBI version "
- "%d, but UBI version %d is detected\n",
- LIBUBI_UBI_VERSION, version);
+ errmsg("this library was made for UBI version %d, but UBI "
+ "version %d is detected\n", LIBUBI_UBI_VERSION, version);
goto out_error;
}
diff --git a/ubi-utils/new-utils/src/libubi_int.h b/ubi-utils/new-utils/src/libubi_int.h
index f52797a..2e664b8 100644
--- a/ubi-utils/new-utils/src/libubi_int.h
+++ b/ubi-utils/new-utils/src/libubi_int.h
@@ -30,20 +30,6 @@
extern "C" {
#endif
-/* Error messages */
-#define errmsg(fmt, ...) ({ \
- fprintf(stderr, "libubi error: " fmt "\n", ##__VA_ARGS__); \
- -1; \
-})
-
-/* System error messages */
-#define sys_errmsg(fmt, ...) ({ \
- int _err = errno; \
- fprintf(stderr, "libubi error: " fmt "\n", ##__VA_ARGS__); \
- fprintf(stderr, "error %d (%s)\n", _err, strerror(_err)); \
- -1; \
-})
-
/*
* The below are pre-define UBI file and directory names.
*
diff --git a/ubi-utils/new-utils/src/ubinfo.c b/ubi-utils/new-utils/src/ubinfo.c
index a71f087..fdf169a 100644
--- a/ubi-utils/new-utils/src/ubinfo.c
+++ b/ubi-utils/new-utils/src/ubinfo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Nokia Corporation.
+ * Copyright (C) 2007, 2008 Nokia Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
diff --git a/ubi-utils/new-utils/src/ubinize.c b/ubi-utils/new-utils/src/ubinize.c
index a78199e..bd1b07b 100644
--- a/ubi-utils/new-utils/src/ubinize.c
+++ b/ubi-utils/new-utils/src/ubinize.c
@@ -322,8 +322,7 @@ int read_section(const char *sname, struct ubigen_vol_info *vi,
if (vi->bytes == 0)
return errmsg("file \"%s\" referred from section \"%s\" is empty", *img, sname);
- printf(PROGRAM_NAME ": volume size was not specified in"
- "section \"%s\", assume ", sname);
+ normsg_cont("volume size was not specified in section \"%s\", assume ", sname);
ubiutils_print_bytes(vi->bytes, 1);
printf("\n");
}
@@ -332,7 +331,7 @@ int read_section(const char *sname, struct ubigen_vol_info *vi,
sprintf(buf, "%s:vol_type", sname);
p = iniparser_getstring(args.dict, buf, NULL);
if (!p) {
- normsg(": volume type was not specified in "
+ normsg("volume type was not specified in "
"section \"%s\", assume \"dynamic\"\n", sname);
vi->type = UBI_VID_DYNAMIC;
} else {