Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Grrr.... getopt_long permutes the arg list, making eg. 'pkg lock -l foo' equivalent to 'pkg -l lock foo' with hilarious results.
Matthew Seaman committed 11 years ago
commit 171a40984aa2cd45560465b1f3f1b5eacac82f0b
parent c1af7cf
1 file changed +9 -0
modified src/main.c
@@ -673,6 +673,15 @@ main(int argc, char **argv)
	if (argc < 2)
		usage(NULL, NULL, stderr, PKG_USAGE_INVALID_ARGUMENTS, "not enough arguments");

+
	/* getopt_long() will permute the arg-list unless
+
	 * POSIXLY_CORRECT is set in the environment.  This is a
+
	 * difference to the original getopt() we were using, and
+
	 * screws up our 'pkg {pkg-opts} verb {verb-opts}' command
+
	 * line concept. */
+

+
	if (setenv("POSIXLY_CORRECT", "1",  1) == -1)
+
		err(EX_SOFTWARE, "setenv() failed");
+

#ifdef HAVE_LIBJAIL
	while ((ch = getopt_long(argc, argv, "dj:c:C:R:lNvo:", longopts, NULL)) != -1) {
#else