summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-13 10:08:12 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-13 10:08:12 +0000
commit7e4f94da6b49e42d5429fab9b97e960c5627c075 (patch)
tree8e673d2e3c0ae789211e83389cd7ca0611a2e4db /usr.sbin
parent2d58cb6cadd79cec3ad79eb153218e0b0b306053 (diff)
normalize quoting in extra info.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm21
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index ff504eac1ac..aae57ff8000 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.105 2007/05/12 15:19:00 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.106 2007/05/13 10:08:11 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -618,14 +618,29 @@ sub category() { 'extrainfo' }
sub new
{
my ($class, $subdir, $cdrom, $ftp) = @_;
+
+ $cdrom =~ s/^\"(.*)\"$/$1/;
+ $cdrom =~ s/^\'(.*)\'$/$1/;
+ $ftp =~ s/^\"(.*)\"$/$1/;
+ $ftp =~ s/^\'(.*)\'$/$1/;
bless { subdir => $subdir, cdrom => $cdrom, ftp => $ftp}, $class;
}
+sub may_quote
+{
+ my $s = shift;
+ if ($s =~ m/\s/) {
+ return '"'.$s.'"';
+ } else {
+ return $s;
+ }
+}
+
sub stringize($)
{
my $self = $_[0];
- return "subdir=".$self->{subdir}." cdrom=".$self->{cdrom}.
- " ftp=".$self->{ftp};
+ return "subdir=".$self->{subdir}." cdrom=".may_quote($self->{cdrom}).
+ " ftp=".may_quote($self->{ftp});
}
package OpenBSD::PackingElement::Name;