diff options
author | Guillem Jover <guillem@debian.org> | 2010-11-29 11:41:06 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2011-01-08 17:17:39 +0100 |
commit | ec97f0a8ff3bf88418dc452e5df8425b86957f9a (patch) | |
tree | 77e553767336716469e8b98e3029115c4e282082 /lib | |
parent | f428f6f616de9ff659730dc646aada51b7bd1f8c (diff) | |
download | dpkg-ec97f0a8ff3bf88418dc452e5df8425b86957f9a.tar.gz |
libdpkg: Use warningv() in parse_warn() instead of open coding it
Generalize and unify parse_error_msg() error message and stop passing
the type of error to it. Now that ohshit() will print "error" we don't
need to print it again here.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpkg/parsehelp.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/dpkg/parsehelp.c b/lib/dpkg/parsehelp.c index 6ef9123bc..756f90efc 100644 --- a/lib/dpkg/parsehelp.c +++ b/lib/dpkg/parsehelp.c @@ -34,14 +34,14 @@ static void parse_error_msg(struct parsedb_state *ps, const struct pkginfo *pigp, - const char *type, char *buf) + char *buf) { if (pigp && pigp->name) - sprintf(buf, _("%s, in file '%.255s' near line %d package '%.255s':\n "), - type, ps->filename, ps->lno, pigp->name); + sprintf(buf, _("parsing file '%.255s' near line %d package '%.255s':\n "), + ps->filename, ps->lno, pigp->name); else - sprintf(buf, _("%s, in file '%.255s' near line %d:\n "), - type, ps->filename, ps->lno); + sprintf(buf, _("parsing file '%.255s' near line %d:\n "), + ps->filename, ps->lno); } void @@ -51,7 +51,7 @@ parse_error(struct parsedb_state *ps, va_list args; char buf1[768], buf2[1000], *q; - parse_error_msg(ps, pigp, _("parse error"), buf1); + parse_error_msg(ps, pigp, buf1); q = str_escape_fmt(buf2, buf1, sizeof(buf2)); strcat(q,fmt); @@ -66,15 +66,13 @@ parse_warn(struct parsedb_state *ps, va_list args; char buf1[768], buf2[1000], *q; - parse_error_msg(ps, pigp, _("warning"), buf1); + parse_error_msg(ps, pigp, buf1); q = str_escape_fmt(buf2, buf1, sizeof(buf2)); strcat(q, fmt); va_start(args, fmt); ps->warncount++; - strcat(q, "\n"); - if (vfprintf(stderr, buf2, args) == EOF) - ohshite(_("failed to write parsing warning")); + warningv(buf2, args); va_end(args); } |