diff options
author | 2015-10-11 11:48:46 +0000 | |
---|---|---|
committer | 2015-10-11 11:48:46 +0000 | |
commit | 5692d608dc427b21dd9ca24a49d2532532e709fb (patch) | |
tree | 820119991e9f46d2bc9bb8c2deb03f2fd4f0cee6 | |
parent | add variation on existing --exists tests; separated by spaces (diff) | |
download | wireguard-openbsd-5692d608dc427b21dd9ca24a49d2532532e709fb.tar.xz wireguard-openbsd-5692d608dc427b21dd9ca24a49d2532532e709fb.zip |
handle comma separated list of arguments, i.e. pkg-config --exists gcr-3,gcr-base-3
-rw-r--r-- | usr.bin/pkg-config/pkg-config | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config index fae2ce9a8ae..e19d6347c2c 100644 --- a/usr.bin/pkg-config/pkg-config +++ b/usr.bin/pkg-config/pkg-config @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: pkg-config,v 1.85 2014/11/17 22:16:23 jca Exp $ +# $OpenBSD: pkg-config,v 1.86 2015/10/11 11:48:46 jasper Exp $ # $CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $ # Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org> @@ -161,8 +161,24 @@ if (!@ARGV){ exit 1; } +# Return the next module from @ARGV, if it turns out to be a comma separated +# module list, take the first one and put the rest back to the front. +sub get_next_module { + my $module = shift @ARGV; + my $m; + if ($module =~ m/,/) { + my @ms = split(/,/, $module); + $m = shift @ms; + unshift(@ARGV, @ms) if (scalar(@ms) > 0); + } else { + return $module; + } + + return $m; +} + while (@ARGV){ - my $p = shift @ARGV; + my $p = get_next_module(); my $op = undef; my $v = undef; if (@ARGV >= 2 && $ARGV[0] =~ /^[<=>!]+$/ && |