Index: popt.c
--- popt.c.orig	2009-04-12 20:14:38 +0200
+++ popt.c	2009-04-12 21:32:27 +0200
@@ -520,6 +520,11 @@
     }
 
     if (con->leftovers != NULL && con->numLeftovers > 0) {
+#if defined(OPENPKG)
+	/* Revert back to the old behaviour of passing to "exec" programs an
+	   extra "--" argument to clearly separate options and arguments. */
+	argv[argc++] = "--";
+#endif
 	memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
 	argc += con->numLeftovers;
     }
@@ -697,10 +702,19 @@
 	    /*@switchbreak@*/ break;
 #endif
 	case '!':
+#if defined(OPENPKG)
+	    /* allow standard "!#:+" (first argument is expanded multiple times)
+               and non-standard "!#:*" (all arguments are expanded in sequence) */
+	    if (!(s[0] == '#' && s[1] == ':' && (s[2] == '+' || s[2] == '*')))
+#else
 	    if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
+#endif
 		/*@switchbreak@*/ break;
-	    /* XXX Make sure that findNextArg deletes only next arg. */
+#if defined(OPENPKG)
+	    if (a == NULL || s[2] == '*') {
+#else
 	    if (a == NULL) {
+#endif
 		if ((a = findNextArg(con, 1U, 1)) == NULL)
 		    /*@switchbreak@*/ break;
 	    }
Index: popthelp.c
--- popthelp.c.orig	2009-04-12 20:14:38 +0200
+++ popthelp.c	2009-04-12 21:32:27 +0200
@@ -15,7 +15,9 @@
 #include <sys/ioctl.h>
 #endif
 
+#if !defined(OPENPKG)
 #define	POPT_WCHAR_HACK
+#endif
 #ifdef 	POPT_WCHAR_HACK
 #include <wchar.h>			/* for mbsrtowcs */
 /*@access mbstate_t @*/
