1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

deal with spaces in name and value tags a lot better!

This commit is contained in:
Daniel Stenberg 2002-12-05 12:54:08 +00:00
parent 2ad2a4bd9f
commit 081e5a82ff

View File

@ -28,7 +28,17 @@ sub namevalue {
my ($tag)=@_; my ($tag)=@_;
my $name=$tag; my $name=$tag;
if($name =~ /name *=/i) { if($name =~ /name *=/i) {
$name=~ s/.*name *= *(\"|)([^ \">]*).*/$2/gi; if($name =~ /name *= *([^\"]([^ \">]*))/) {
$name = $1;
}
elsif($name =~ /name *= *\"([^\"]*)\"/) {
$name=$1;
}
else {
# there is a tag but we didn't find the contents
$name="[weird]";
}
} }
else { else {
# no name given # no name given
@ -37,7 +47,16 @@ sub namevalue {
# get value tag # get value tag
my $value= $tag; my $value= $tag;
if($value =~ /value *=/i) { if($value =~ /value *=/i) {
$value=~ s/.*value *= *(\"|)([^ \">]*).*/$2/gi; if($value =~ /value *= *([^\"]([^ \">]*))/) {
$value = $1;
}
elsif($value =~ /value *= *\"([^\"]*)\"/) {
$value=$1;
}
else {
# there is a tag but we didn't find the contents
$value="[weird]";
}
} }
else { else {
$value=""; $value="";
@ -142,11 +161,11 @@ while($in =~ /[^<]*(<[^>]+>)/g ) {
push @alts, "$value"; push @alts, "$value";
} }
else { else {
$info=""; print "Input: NAME=\"$name\"";
if($value ne "") { if($value ne "") {
$info="=$value"; print " VALUE=\"$value\"";
} }
print "Input: $name$info ($type)\n"; print " ($type)\n";
push @vars, "$name"; push @vars, "$name";
# store default value: # store default value:
$value{$name}=$value; $value{$name}=$value;