display the actual unknown option instead of '?'
authorThierry Vignaud <thierry.vignaud@gmail.com>
Mon, 17 Dec 2012 12:58:44 +0000 (13:58 +0100)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 18 Dec 2012 15:53:04 +0000 (17:53 +0200)
'?' is returned by getopt when option is unknown, making hard to
pinpoint the actual bogus option...

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit 8192e580a0a962b8eb7f9d8fc07bd3f99ccf0ffe)

rpmio/macro.c

index f7954b3..5362512 100644 (file)
@@ -823,7 +823,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
        char *name = NULL, *body = NULL;
        if (c == '?' || strchr(opts, c) == NULL) {
            rpmlog(RPMLOG_ERR, _("Unknown option %c in %s(%s)\n"),
-                       (char)c, me->name, opts);
+                       (char)optopt, me->name, opts);
            goto exit;
        }