summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2011-01-10 21:14:52 (GMT)
committerWaldemar Brodkorb <wbx@openadk.org>2011-01-12 10:18:42 (GMT)
commit846440bfa59b9a04a68247720edc6d81dcabfec2 (patch)
tree995a84fd9ad12dfd13ecb6a091881542968c8605
parent3b5884bfdfc56e66d9ac6028272b805451a62113 (diff)
pkgmaker: improve error message on missing package category
This patch bores up fatal_error(), so that it now takes arguments in printf-style, but without changing the basic semantics (i.e., messages prefixed by "Fatal error. " and trailing newline automatically appended). Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--tools/adk/pkgmaker.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/adk/pkgmaker.c b/tools/adk/pkgmaker.c
index e2b6e6e..dd4b90f 100644
--- a/tools/adk/pkgmaker.c
+++ b/tools/adk/pkgmaker.c
@@ -37,10 +37,11 @@
static int nobinpkgs;
-static void fatal_error(const char *message) {
-
- fprintf(stderr, "Fatal error. %s\n", message);
- exit(1);
+#define fatal_error(...) { \
+ fprintf(stderr, "Fatal error. "); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, "\n"); \
+ exit(1); \
}
static int parse_var_hash(char *buf, const char *varname, StrMap *strmap) {
@@ -304,7 +305,8 @@ int main() {
fclose(section);
}
} else
- fatal_error("Can not find section description for package.");
+ fatal_error("Can not find section description for package %s.",
+ pkgdirp->d_name);
fclose(pkg);
continue;
@@ -501,7 +503,7 @@ int main() {
fclose(section);
}
} else
- fatal_error("Can not find section description for package");
+ fatal_error("Can not find section description for package %s.", pkgdirp->d_name);
unlink(path);
cfg = fopen(path, "w");