summaryrefslogtreecommitdiff
path: root/usr.bin/pkg-config
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2015-10-11 11:48:47 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2015-10-11 11:48:47 +0000
commitfb12b0dbd00dce5a86ebdba070d45bf3caa5e313 (patch)
tree118bcf279e5911d54d02c32043fd832b43d8bc78 /usr.bin/pkg-config
parent25fb96c7911f55108557771b66c54d7419bc3e5e (diff)
handle comma separated list of arguments, i.e. pkg-config --exists gcr-3,gcr-base-3
Diffstat (limited to 'usr.bin/pkg-config')
-rw-r--r--usr.bin/pkg-config/pkg-config20
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] =~ /^[<=>!]+$/ &&