The following commit has been merged in the master branch:
commit 5e29cc4c725c26754e0e88917c7a0a18a58238b9
Author: Guillem Jover <[email protected]>
Date: Fri Sep 4 20:34:00 2009 +0200
libdpkg: Refactor config error printing into a new function
diff --git a/lib/dpkg/myopt.c b/lib/dpkg/myopt.c
index c4b8080..e828da8 100644
--- a/lib/dpkg/myopt.c
+++ b/lib/dpkg/myopt.c
@@ -4,6 +4,7 @@
*
* Copyright © 1994,1995 Ian Jackson <[email protected]>
* Copyright © 2000,2002 Wichert Akkerman <[email protected]>
+ * Copyright © 2008,2009 Guillem Jover <[email protected]>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -47,6 +48,19 @@ badusage(const char *fmt, ...)
ohshit("%s\n\n%s", buf, gettext(printforhelp));
}
+static void
+config_error(const char *fmt, ...)
+{
+ char buf[1024];
+ va_list al;
+
+ va_start(al, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, al);
+ va_end(al);
+
+ ohshit(_("configuration error: %s"), buf);
+}
+
void myfileopt(const char* fn, const struct cmdinfo* cmdinfos) {
FILE* file;
char linebuf[MAX_CONFIG_LINE];
@@ -92,17 +106,17 @@ void myfileopt(const char* fn, const struct cmdinfo*
cmdinfos) {
}
if (!cip->olong)
- ohshit(_("configuration error: unknown option %s"), linebuf);
+ config_error(_("unknown option '%s'"), linebuf);
if (cip->takesvalue) {
if (!opt)
- ohshit(_("configuration error: %s needs a value"), linebuf);
+ config_error(_("'%s' needs a value"), linebuf);
if (cip->call) cip->call(cip,opt);
else
*cip->sassignto = m_strdup(opt);
} else {
if (opt)
- ohshit(_("configuration error: %s does not take a value"), linebuf);
+ config_error(_("'%s' does not take a value"), linebuf);
if (cip->call) cip->call(cip,NULL);
else *cip->iassignto= cip->arg;
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]