2008/6/18 Jeff Johnson <[EMAIL PROTECTED]>:
> "Patches cheerfully accepted."
Attached.
--
Marcin Kowalczyk
[EMAIL PROTECTED]
http://qrnik.knm.org.pl/~qrczak/
--- rpm-5.1.0.orig/rpmio/macro.c 2008-04-14 15:59:15.000000000 +0200
+++ rpm-5.1.0/rpmio/macro.c 2008-06-18 17:43:03.000000000 +0200
@@ -1001,6 +1001,7 @@
int argc = 0;
const char **argv;
int c;
+ unsigned int popt_flags;
/* Copy macro name as argv[0], save beginning of args. */
buf[0] = '\0';
@@ -1053,6 +1054,7 @@
be[-1] = ' '; /* assert((be - 1) == (b + strlen(b) == buf + strlen(buf))) */
be[0] = '\0';
b = buf;
+
for (c = 0; c < argc; c++) {
argv[c] = b;
b = strchr(b, ' ');
@@ -1061,12 +1063,21 @@
/* assert(b == be); */
argv[argc] = NULL;
+ /* '+' as the first character means that options are recognized
+ * only before positional arguments, as POSIX requires. */
+ popt_flags = POPT_CONTEXT_NO_EXEC;
+ if (me->opts[0] == '+') popt_flags |= POPT_CONTEXT_POSIXMEHARDER;
+
/* Count the number of short options. */
- for (c = 0, opts = me->opts; *opts != '\0'; opts++)
+ opts = me->opts;
+ if (*opts == '+') opts++;
+ for (c = 0; *opts != '\0'; opts++)
if (*opts != ':') c++;
/* Set up popt option table. */
optTbl = xcalloc(sizeof(*optTbl), (c + 1));
- for (c = 0, opts = me->opts; *opts != '\0'; opts++) {
+ opts = me->opts;
+ if (*opts == '+') opts++;
+ for (c = 0; *opts != '\0'; opts++) {
if (*opts == ':') continue;
optTbl[c].shortName = opts[0];
optTbl[c].val = (int) opts[0];
@@ -1077,7 +1088,7 @@
/* Parse the options, defining option macros. */
/[EMAIL PROTECTED]@*/
- optCon = poptGetContext(argv[0], argc, argv, optTbl, POPT_CONTEXT_NO_EXEC|POPT_CONTEXT_POSIXMEHARDER);
+ optCon = poptGetContext(argv[0], argc, argv, optTbl, popt_flags);
/[EMAIL PROTECTED]@*/
while ((c = poptGetNextOpt(optCon)) > 0) {
const char * optArg = poptGetOptArg(optCon);
_______________________________________________
pld-devel-en mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en