From 846440bfa59b9a04a68247720edc6d81dcabfec2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 10 Jan 2011 22:14:52 +0100 Subject: 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 --- tools/adk/pkgmaker.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tools/adk') diff --git a/tools/adk/pkgmaker.c b/tools/adk/pkgmaker.c index e2b6e6e99..dd4b90f46 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"); -- cgit v1.2.3