summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2006-12-01 16:36:38 +0000
committerMarc Espie <espie@cvs.openbsd.org>2006-12-01 16:36:38 +0000
commit34fb7bf6d3d0d6b9aca4dda01dfa5df5e2e0ac3f (patch)
tree9b6fe2e0d44b83365e905cb598f538bc0c14b991
parentcc3275586fa747dea8554f15810e367f8f6a7056 (diff)
handles continuation lines and comments.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgConfig.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
index 7bbafd55b66..c4a0b705d4a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgConfig.pm,v 1.7 2006/12/01 16:17:03 espie Exp $
+# $OpenBSD: PkgConfig.pm,v 1.8 2006/12/01 16:36:37 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@@ -90,8 +90,16 @@ sub read_fh
$name = '' if !defined $name;
while (<$fh>) {
chomp;
+ # continuation lines
+ while (m/(?<!\\)\\$/) {
+ s/\\$//;
+ $_.=<$fh>;
+ chomp;
+ }
next if m/^\s*$/;
next if m/^\#/;
+ # zap comments
+ s/(?<!\\)\#.*//;
if (m/^([\w.]*)\=\s*(.*)$/) {
$cfg->add_variable($1, $2);
} elsif (m/^([\w.]*)\:\s+(.*)$/) {