* genini (get): Only quote $val when specific keys. Change embedded quotes to
authorChristopher Faylor <me@cgf.cx>
Fri, 23 Feb 2007 16:24:17 +0000 (16:24 +0000)
committerChristopher Faylor <me@cgf.cx>
Fri, 23 Feb 2007 16:24:17 +0000 (16:24 +0000)
apostophes.

ChangeLog
genini

index 9319e78836c597b241539aaffdc502c2e6f976fc..048eccb4cb4111b1afddc0cfae8944319aacd519 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-23  Christopher Faylor  <me@cgf.cx>
+
+       * genini (get): Only quote $val when specific keys.  Change embedded
+       quotes to apostophes.
+
 2007-02-23  Christopher Faylor  <me@cgf.cx>
             Servaas Goossens  <SGoossens@ortec.nl>
 
diff --git a/genini b/genini
index fe0ad9be61cbd57bfa7d0ae45cdd832fac9955aa..ac366a7628a5387a7fac021a39e86860490863e7 100755 (executable)
--- a/genini
+++ b/genini
@@ -84,7 +84,9 @@ sub get {
     my $key = shift;
     my $val = shift;
 
-    if (substr($val, 0, 1) eq '"') {
+    if (substr($val, 0, 1) ne '"') {
+       $val = '"'. $val . '"' if $key eq 'ldesc' || $key eq 'sdesc';
+    } else {
        while (length($val) == 1 || $val !~ /"$/os) {
            $_ = <$FH>;
            length or last;
@@ -93,9 +95,7 @@ sub get {
            $val .= "\n" . $_;
        }
     } 
-    if (($key eq 'ldesc' || $key eq 'sdesc') and $val !~ /"/o) {
-       $pkg{$pname}{$what}{$key} = '"' . $val . '"';
-    }
+    $val =~ s/(.)"(.)/$1'$2/mog;
     return $val;
 }
 
@@ -105,7 +105,7 @@ sub parse {
     my $what;
     $main::curfile = $f;
     $. = 0;
-    open(F, '<', $f) or die "$0: couldn't open $f - $!\n";
+    open(\*F, '<', $f) or die "$0: couldn't open $f - $!\n";
     while (<F>) {
        chomp;
        s/#.*$//o;
This page took 0.024616 seconds and 5 git commands to generate.