pf-tools commit: r856 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Compat/ lib/PFTools/Compat/Parser.pm lib/PFTools/Compat/Translation.pm lib/PFTools/Parser.pm lib/PFTools/Translation.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Aug 27 14:31:49 UTC 2010


Author: ccaillet-guest
Date: Fri Aug 27 14:31:45 2010
New Revision: 856

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=856
Log:
* lib/PFTools/Compat/Parser.pm
  - extracting from PFTools::Parser functions for parsing old syntax format
* lib/PFTools/Compat/Translation.pm
  - library for translating old configuration (pf-tools 0.X) to new syntax

Added:
    branches/next-gen/lib/PFTools/Compat/
    branches/next-gen/lib/PFTools/Compat/Parser.pm   (with props)
    branches/next-gen/lib/PFTools/Compat/Translation.pm
      - copied, changed from r851, branches/next-gen/lib/PFTools/Translation.pm
Removed:
    branches/next-gen/lib/PFTools/Translation.pm
Modified:
    branches/next-gen/debian/changelog
    branches/next-gen/lib/PFTools/Parser.pm

Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=856&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Fri Aug 27 14:31:45 2010
@@ -58,8 +58,6 @@
     - extrating apt-get functions (action and depends) from Update.pm
   * lib/PFTools/Update/Removedir.pm
     - extrating apt-get functions (action and depends) from Update.pm
-  * lib/PFTools/Translation.pm
-    - library for translating old configuration (pf-tools 0.X) to new syntax
   * lib/PFTools/Structqueries.pm
     - library for getting informations from global structure
   * debian/control
@@ -68,8 +66,12 @@
     - basic documentation about update file
   * TODO
     - adding more TODOs :)
-
- -- Christophe Caillet <quadchris at free.fr>  Fri, 27 Aug 2010 16:19:45 +0200
+  * lib/PFTools/Compat/Parser.pm
+    - extracting from PFTools::Parser functions for parsing old syntax format
+  * lib/PFTools/Compat/Translation.pm
+    - library for translating old configuration (pf-tools 0.X) to new syntax
+
+ -- Christophe Caillet <quadchris at free.fr>  Fri, 27 Aug 2010 16:28:06 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Added: branches/next-gen/lib/PFTools/Compat/Parser.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Compat/Parser.pm?rev=856&op=file
==============================================================================
--- branches/next-gen/lib/PFTools/Compat/Parser.pm (added)
+++ branches/next-gen/lib/PFTools/Compat/Parser.pm Fri Aug 27 14:31:45 2010
@@ -1,0 +1,344 @@
+package PFTools::Compat::Parser;
+##
+##  $Id$
+##
+##  Copyright (C) 2010 Christophe Caillet <quadchris at free.fr>
+##
+##  This program is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU General Public License
+##  as published by the Free Software Foundation; either version 2
+##  of the License, or (at your option) any later version.
+##
+##  This program is distributed in the hope that it will be useful,
+##  but WITHOUT ANY WARRANTY; without even the implied warranty of
+##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+##  GNU General Public License for more details.
+##
+##  You should have received a copy of the GNU General Public License
+##  along with this program; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+##
+
+use strict;
+use warnings;
+
+use Exporter;
+
+our @ISA = ('Exporter');
+
+our @EXPORT = qw(
+	Subst_vars
+	Parser_pftools
+);
+
+our @EXPORT_OK = qw();
+
+use PFTools::Logger;
+use PFTools::Parser;
+
+###################################################
+########
+######## WARNING Obsolete code
+######## Use for compatibility ONLY
+######## This code WILL NOT be maintained anymore
+########
+###################################################
+
+######################
+### Prototypes
+sub __Add_var ($$$);
+
+########################
+# Internal variables
+my $DEBUG = 0;
+
+sub __Add_var ($$$) {
+    my ( $V, $var, $val ) = @_;
+
+    if ( $var =~ /^((\\\.|[^.])*[^\\])\./ ) {
+	my $esc1  = $1;
+	my $quote = $';
+	$esc1 =~ s/\\\././g;
+	if ( !defined( $V->{$esc1} ) ) {
+	    $V->{$esc1} = {};
+	}
+	if ( !ref( $V->{$esc1} ) ) {
+	    return ($CODE->{'SYNTAX'});
+	}
+	__Add_var( $V->{$esc1}, $quote, $val );
+    }
+    else {
+	$var =~ s/\\\././g;
+	if ( defined( $V->{$var} ) ) {
+#		print "Syntax error\n" ;
+	    return ($CODE->{'SYNTAX'});
+	}
+	$V->{$var} = $val;
+	return (0);
+    }
+}
+
+my $PFTOOLS_VARS = {};
+
+sub Parser_pftools ($$) {
+    my ( $fic_conf, $substdestvars ) = @_;
+
+    my $CONF     = {};
+    my $LOCATION	= {} ;
+    my $current  = ']';
+    my @FIC_CONF = ();
+    my @ALL_CONF = ();
+    my @FH	= () ;
+    my @line     = ();
+    my @cond     = ();
+
+    unshift @FIC_CONF, $fic_conf;
+    unshift @ALL_CONF, $fic_conf;
+    unshift @line,     0;
+    print "Opening $FIC_CONF[0]\n" if ( $DEBUG );
+    open( $FH[0], $FIC_CONF[0] )
+	|| Abort( $$CODE->{'OPEN'}, "Impossible d'ouvrir " . $FIC_CONF[0] );
+    print "Filehandles --> @FH\n"  if ( $DEBUG );
+    while ( $#FH >= 0 ) {
+	my $fh = $FH[0];    # Perl gruik, ne pas simplifier!!!
+    LOADCONFLINE: while (<$fh>) {
+# 		print "Using fh --> $fh\n" ;
+	    # Compter les lignes
+	    $line[0]++;
+
+	    # Eliminer les commentaires et les espaces inutiles
+	    chomp;
+	    s/^\s*//;
+	    s/\s*$//;
+	    s/\s*#.*$//;
+
+	    # Ne pas traiter les lignes vides
+	    next if (/^$/);
+
+	    # Traitement des directives IF (0 param)
+	    if (/^\@([^\s]+)$/) {
+		if ( $1 eq "else" ) {
+		    if ( $#cond < 0 ) {
+			Abort ( $CODE->{'SYNTAX'},
+			          $FIC_CONF[0] . ":"
+				. $line[0]
+				. ": else sans if" );
+		    }
+		    $cond[0] = ( $#cond > 0 && !$cond[1] ) ? 0 : !$cond[0];
+		    next;
+		}
+		elsif ( $1 eq "endif" ) {
+		    if ( $#cond < 0 ) {
+			Abort( $CODE->{'SYNTAX'},
+			          $FIC_CONF[0] . ":"
+				. $line[0]
+				. ": endif sans if" );
+		    }
+		    shift @cond;
+		    next;
+		}
+	    }
+
+	    # Traitement des directives IF (1 param)
+	    if (/^\@([^\s]+)\s+([^\s]+)$/) {
+		if ( $1 eq "ifdef" ) {
+		    if ( defined $PFTOOLS_VARS->{$2} ) {
+			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
+		    }
+		    else {
+			unshift @cond, 0;
+		    }
+		    next;
+		}
+		elsif ( $1 eq "ifndef" ) {
+		    if ( not defined $PFTOOLS_VARS->{$2} ) {
+			unshift @cond, 0;
+		    }
+		    else {
+			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
+		    }
+		    next;
+		}
+		elsif ( $1 eq "if" ) {
+		    if ( defined $PFTOOLS_VARS->{$2} && $PFTOOLS_VARS->{$2} ) {
+			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
+		    }
+		    else {
+			unshift @cond, 0;
+		    }
+		    next;
+		}
+		elsif ( $1 eq "ifnot" ) {
+		    if ( defined $PFTOOLS_VARS->{$2} && ! $PFTOOLS_VARS->{$2} ) {
+			unshift @cond, 0;
+		    }
+		    else {
+			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
+		    }
+		    next;
+		}
+	    }
+
+	    # Seulement les directives IF si condition fausse
+	    next if ( $#cond >= 0 && !$cond[0] );
+
+	    if (/^\@([^\s]+)\s+([^\s]+)$/) {
+		if ( $1 eq "include" ) {
+		    my $fic_conf = $2;
+		    my $oldficconf;
+
+		    if ( $fic_conf =~ m|/| ) {
+			Abort( $CODE->{'OPEN'},
+			          $FIC_CONF[1] . ":"
+				. $line[1]
+				. ": Include avec chemin interdit" );
+		    }
+
+		    if ( $FIC_CONF[0] =~ m|^(.*)/[^/]*$| ) {
+			$fic_conf = $1 . '/include-' . $fic_conf;
+		    }
+		    else {
+			$fic_conf = "include-" . $fic_conf;
+		    }
+
+		    foreach $oldficconf (@ALL_CONF) {
+			if ( $fic_conf eq $oldficconf ) {
+			    Warn( $CODE->{'OPEN'},
+				      $FIC_CONF[0] . ":"
+				    . $line[0] . ": "
+				    . $fic_conf
+				    . " deja inclus ligne "
+				    . $LOCATION->{'include'}->{$fic_conf}->{'line'}
+				    . " dans "
+				    . $LOCATION->{'include'}->{$fic_conf}->{'source'} );
+			    next LOADCONFLINE;
+			}
+		    }
+			$LOCATION->{'include'}->{$fic_conf}->{'line'} = $line[0] ;
+			$LOCATION->{'include'}->{$fic_conf}->{'source'} = $FIC_CONF[0] ;
+		    unshift @FIC_CONF, $fic_conf;
+		    unshift @ALL_CONF, $fic_conf;
+		    unshift @line,     0;
+		    print "Opening $FIC_CONF[0]\n"  if ( $DEBUG );
+		    my $newfh ;
+		    open( $newfh, $FIC_CONF[0] )
+			|| Abort( $CODE->{'OPEN'},
+			      $FIC_CONF[1] . ":"
+			    . $line[1]
+			    . ": Impossible d'inclure "
+			    . $FIC_CONF[0] );
+		    ;    # Perl gruik, ne pas simplifier!!!
+		    print "File list after including $FIC_CONF[0] ".join ( " ", @ALL_CONF )."\n"  if ( $DEBUG );
+		    unshift @FH, $newfh ;
+		    $fh = $newfh ;
+		    print "Filehandles list after inclusion --> @FH\n" if ( $DEBUG );
+		}
+		elsif ( $1 eq "define" ) {
+		    if ( defined( $PFTOOLS_VARS->{$2} ) ) {
+			Warn( $CODE->{'OPEN'},
+			          $FIC_CONF[0] . ":"
+				. $line[0] . ": "
+				. $2
+				. " deja defini" );
+		    }
+		    else {
+			$PFTOOLS_VARS->{$2} = 1;
+		    }
+		}
+		elsif ( $1 eq "undef" ) {
+		    if ( not defined( $PFTOOLS_VARS->{$2} ) ) {
+			Warn( $CODE->{'OPEN'},
+			          $FIC_CONF[0] . ":"
+				. $line[0] . ": "
+				. $2
+				. " deja non defini" );
+		    }
+		    else {
+			undef $PFTOOLS_VARS->{$2};
+		    }
+		}
+		else {
+		    Abort( $CODE->{'SYNTAX'},
+			      $FIC_CONF[0] . ":"
+			    . $line[0]
+			    . ": Directive "
+			    . $1
+			    . " inconnue" );
+		}
+		next;
+	    }
+
+	    # Detection des sections
+	    if (/^\[([^\]]+)\]$/) {
+		if ( defined $substdestvars && $substdestvars ) {
+		    $current = Subst_vars( $1, $substdestvars );
+		}
+		else {
+		    $current = $1;
+		}
+		if ( defined( $CONF->{$current} ) ) {
+		    Abort( $CODE->{'SYNTAX'},
+			      $FIC_CONF[0] . ":"
+			    . $line[0] . ": ["
+			    . $current
+			    . "] dupliquee (precedente a "
+			    . $LOCATION->{$current}->{_location}
+			    . ")" );
+		}
+		else {
+		    $CONF->{$current} = {};
+		    $LOCATION->{$current}->{_location}
+			= $FIC_CONF[0] . ":" . $line[0];
+		}
+		next;
+	    }
+
+	    # Traitement des variables
+	    if (/^([^\s]+)\s*=\s*(.+)$/) {
+	    	my ( $var, $val ) = ( $1, $2 ) ;
+		if ( defined( $CONF->{$current}->{$var} ) ) {
+		    Abort( $CODE->{'SYNTAX'},
+			      $FIC_CONF[0] . ":"
+			    . $line[0] . ": "
+			    . $var
+			    . " dupliquee (precedente a "
+			    . $LOCATION->{$current}->{$var}->{_location}
+			    . ")" );
+		}
+		else {
+
+		    if ( __Add_var( $CONF->{$current}, $var, $val ) == $CODE->{'SYNTAX'} )
+		    {
+			Abort( $CODE->{'SYNTAX'},
+			          $FIC_CONF[0] . ":"
+				. $line[0] . ": "
+				. $var
+				. " dupliquee (precedente a "
+				. $LOCATION->{$current}->{$var}->{_location}
+				. ")" );
+		    }
+		    $LOCATION->{$current}->{$var}->{_location}
+			= $FIC_CONF[0] . ":" . $line[0];
+		}
+	    }
+	    else {
+		Abort( $CODE->{'SYNTAX'},
+		    $FIC_CONF[0] . ":" . $line[0] . ": Erreur de syntaxe" );
+	    }
+	}
+	close( $FH[0] ) ;
+	print "Closing $FIC_CONF[0] -- $FH[0]\n"  if ( $DEBUG );
+	shift @FH;
+	print "Filehandles after closing --> @FH\n"  if ( $DEBUG );
+	shift @line;
+	shift @FIC_CONF;
+    }
+
+    # Conditions non fermees
+    if ( $#cond >= 0 ) {
+	Abort( $CODE->{'SYNTAX'}, "EOC: endif manquant" );
+    }
+
+    return ($CONF);
+}
+

Propchange: branches/next-gen/lib/PFTools/Compat/Parser.pm
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Aug 27 14:31:45 2010
@@ -1,0 +1,2 @@
+Id
+Revision

Copied: branches/next-gen/lib/PFTools/Compat/Translation.pm (from r851, branches/next-gen/lib/PFTools/Translation.pm)
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Compat/Translation.pm?rev=856&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Translation.pm (original)
+++ branches/next-gen/lib/PFTools/Compat/Translation.pm Fri Aug 27 14:31:45 2010
@@ -1,4 +1,4 @@
-package PFTools::Translation;
+package PFTools::Compat::Translation;
 ##
 ##  $Id$
 ##

Modified: branches/next-gen/lib/PFTools/Parser.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Parser.pm?rev=856&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Parser.pm (original)
+++ branches/next-gen/lib/PFTools/Parser.pm Fri Aug 27 14:31:45 2010
@@ -28,7 +28,6 @@
 
 our @EXPORT = qw(
 	Subst_vars
-	Parser_pftools
 	Parser_ini
 );
 
@@ -40,317 +39,12 @@
 ######################
 ### Constants
 
-######################
-### Prototypes
-sub __Add_var ($$$);
-
-########################
-# Internal variables
-my $DEBUG = 0;
-
-sub __Add_var ($$$) {
-    my ( $V, $var, $val ) = @_;
-
-    if ( $var =~ /^((\\\.|[^.])*[^\\])\./ ) {
-	my $esc1  = $1;
-	my $quote = $';
-	$esc1 =~ s/\\\././g;
-	if ( !defined( $V->{$esc1} ) ) {
-	    $V->{$esc1} = {};
-	}
-	if ( !ref( $V->{$esc1} ) ) {
-	    return ($CODE->{'SYNTAX'});
-	}
-	__Add_var( $V->{$esc1}, $quote, $val );
-    }
-    else {
-	$var =~ s/\\\././g;
-	if ( defined( $V->{$var} ) ) {
-#		print "Syntax error\n" ;
-	    return ($CODE->{'SYNTAX'});
-	}
-	$V->{$var} = $val;
-	return (0);
-    }
-}
-
 # Subst_vars
 sub Subst_vars ($$) {
     my ( $str, $hash_subst ) = @_;
 
 	$str =~ s/%([^\%]+)%/$hash_subst->{$1}/gm;
-#     while ( $str =~ s/%([^%\s]*)%/$SUBST{"$1"}/ ) { }
-#     foreach my $elt ( split ( '%', $str ) ) {
-#         next if ( $elt eq '' );
-#         if ( defined $hash_subst->{$elt} ) {
-#             $str =~ s/%$elt%/$hash_subst->{$elt}/;
-#         }
-#     }
     return $str;
-}
-
-my $PFTOOLS_VARS = {};
-
-sub Parser_pftools ($$) {
-    my ( $fic_conf, $substdestvars ) = @_;
-
-    my $CONF     = {};
-    my $LOCATION	= {} ;
-    my $current  = ']';
-    my @FIC_CONF = ();
-    my @ALL_CONF = ();
-    my @FH	= () ;
-    my @line     = ();
-    my @cond     = ();
-
-    unshift @FIC_CONF, $fic_conf;
-    unshift @ALL_CONF, $fic_conf;
-    unshift @line,     0;
-    print "Opening $FIC_CONF[0]\n" if ( $DEBUG );
-    open( $FH[0], $FIC_CONF[0] )
-	|| Abort( $$CODE->{'OPEN'}, "Impossible d'ouvrir " . $FIC_CONF[0] );
-    print "Filehandles --> @FH\n"  if ( $DEBUG );
-    while ( $#FH >= 0 ) {
-	my $fh = $FH[0];    # Perl gruik, ne pas simplifier!!!
-    LOADCONFLINE: while (<$fh>) {
-# 		print "Using fh --> $fh\n" ;
-	    # Compter les lignes
-	    $line[0]++;
-
-	    # Eliminer les commentaires et les espaces inutiles
-	    chomp;
-	    s/^\s*//;
-	    s/\s*$//;
-	    s/\s*#.*$//;
-
-	    # Ne pas traiter les lignes vides
-	    next if (/^$/);
-
-	    # Traitement des directives IF (0 param)
-	    if (/^\@([^\s]+)$/) {
-		if ( $1 eq "else" ) {
-		    if ( $#cond < 0 ) {
-			Abort ( $CODE->{'SYNTAX'},
-			          $FIC_CONF[0] . ":"
-				. $line[0]
-				. ": else sans if" );
-		    }
-		    $cond[0] = ( $#cond > 0 && !$cond[1] ) ? 0 : !$cond[0];
-		    next;
-		}
-		elsif ( $1 eq "endif" ) {
-		    if ( $#cond < 0 ) {
-			Abort( $CODE->{'SYNTAX'},
-			          $FIC_CONF[0] . ":"
-				. $line[0]
-				. ": endif sans if" );
-		    }
-		    shift @cond;
-		    next;
-		}
-	    }
-
-	    # Traitement des directives IF (1 param)
-	    if (/^\@([^\s]+)\s+([^\s]+)$/) {
-		if ( $1 eq "ifdef" ) {
-		    if ( defined $PFTOOLS_VARS->{$2} ) {
-			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
-		    }
-		    else {
-			unshift @cond, 0;
-		    }
-		    next;
-		}
-		elsif ( $1 eq "ifndef" ) {
-		    if ( not defined $PFTOOLS_VARS->{$2} ) {
-			unshift @cond, 0;
-		    }
-		    else {
-			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
-		    }
-		    next;
-		}
-		elsif ( $1 eq "if" ) {
-		    if ( defined $PFTOOLS_VARS->{$2} && $PFTOOLS_VARS->{$2} ) {
-			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
-		    }
-		    else {
-			unshift @cond, 0;
-		    }
-		    next;
-		}
-		elsif ( $1 eq "ifnot" ) {
-		    if ( defined $PFTOOLS_VARS->{$2} && ! $PFTOOLS_VARS->{$2} ) {
-			unshift @cond, 0;
-		    }
-		    else {
-			unshift @cond, ( $#cond > 0 && !$cond[1] ) ? 0 : 1;
-		    }
-		    next;
-		}
-	    }
-
-	    # Seulement les directives IF si condition fausse
-	    next if ( $#cond >= 0 && !$cond[0] );
-
-	    if (/^\@([^\s]+)\s+([^\s]+)$/) {
-		if ( $1 eq "include" ) {
-		    my $fic_conf = $2;
-		    my $oldficconf;
-
-		    if ( $fic_conf =~ m|/| ) {
-			Abort( $CODE->{'OPEN'},
-			          $FIC_CONF[1] . ":"
-				. $line[1]
-				. ": Include avec chemin interdit" );
-		    }
-
-		    if ( $FIC_CONF[0] =~ m|^(.*)/[^/]*$| ) {
-			$fic_conf = $1 . '/include-' . $fic_conf;
-		    }
-		    else {
-			$fic_conf = "include-" . $fic_conf;
-		    }
-
-		    foreach $oldficconf (@ALL_CONF) {
-			if ( $fic_conf eq $oldficconf ) {
-			    Warn( $CODE->{'OPEN'},
-				      $FIC_CONF[0] . ":"
-				    . $line[0] . ": "
-				    . $fic_conf
-				    . " deja inclus ligne "
-				    . $LOCATION->{'include'}->{$fic_conf}->{'line'}
-				    . " dans "
-				    . $LOCATION->{'include'}->{$fic_conf}->{'source'} );
-			    next LOADCONFLINE;
-			}
-		    }
-			$LOCATION->{'include'}->{$fic_conf}->{'line'} = $line[0] ;
-			$LOCATION->{'include'}->{$fic_conf}->{'source'} = $FIC_CONF[0] ;
-		    unshift @FIC_CONF, $fic_conf;
-		    unshift @ALL_CONF, $fic_conf;
-		    unshift @line,     0;
-		    print "Opening $FIC_CONF[0]\n"  if ( $DEBUG );
-		    my $newfh ;
-		    open( $newfh, $FIC_CONF[0] )
-			|| Abort( $CODE->{'OPEN'},
-			      $FIC_CONF[1] . ":"
-			    . $line[1]
-			    . ": Impossible d'inclure "
-			    . $FIC_CONF[0] );
-		    ;    # Perl gruik, ne pas simplifier!!!
-		    print "File list after including $FIC_CONF[0] ".join ( " ", @ALL_CONF )."\n"  if ( $DEBUG );
-		    unshift @FH, $newfh ;
-		    $fh = $newfh ;
-		    print "Filehandles list after inclusion --> @FH\n" if ( $DEBUG );
-		}
-		elsif ( $1 eq "define" ) {
-		    if ( defined( $PFTOOLS_VARS->{$2} ) ) {
-			Warn( $CODE->{'OPEN'},
-			          $FIC_CONF[0] . ":"
-				. $line[0] . ": "
-				. $2
-				. " deja defini" );
-		    }
-		    else {
-			$PFTOOLS_VARS->{$2} = 1;
-		    }
-		}
-		elsif ( $1 eq "undef" ) {
-		    if ( not defined( $PFTOOLS_VARS->{$2} ) ) {
-			Warn( $CODE->{'OPEN'},
-			          $FIC_CONF[0] . ":"
-				. $line[0] . ": "
-				. $2
-				. " deja non defini" );
-		    }
-		    else {
-			undef $PFTOOLS_VARS->{$2};
-		    }
-		}
-		else {
-		    Abort( $CODE->{'SYNTAX'},
-			      $FIC_CONF[0] . ":"
-			    . $line[0]
-			    . ": Directive "
-			    . $1
-			    . " inconnue" );
-		}
-		next;
-	    }
-
-	    # Detection des sections
-	    if (/^\[([^\]]+)\]$/) {
-		if ( defined $substdestvars && $substdestvars ) {
-		    $current = Subst_vars( $1, $substdestvars );
-		}
-		else {
-		    $current = $1;
-		}
-		if ( defined( $CONF->{$current} ) ) {
-		    Abort( $CODE->{'SYNTAX'},
-			      $FIC_CONF[0] . ":"
-			    . $line[0] . ": ["
-			    . $current
-			    . "] dupliquee (precedente a "
-			    . $LOCATION->{$current}->{_location}
-			    . ")" );
-		}
-		else {
-		    $CONF->{$current} = {};
-		    $LOCATION->{$current}->{_location}
-			= $FIC_CONF[0] . ":" . $line[0];
-		}
-		next;
-	    }
-
-	    # Traitement des variables
-	    if (/^([^\s]+)\s*=\s*(.+)$/) {
-	    	my ( $var, $val ) = ( $1, $2 ) ;
-		if ( defined( $CONF->{$current}->{$var} ) ) {
-		    Abort( $CODE->{'SYNTAX'},
-			      $FIC_CONF[0] . ":"
-			    . $line[0] . ": "
-			    . $var
-			    . " dupliquee (precedente a "
-			    . $LOCATION->{$current}->{$var}->{_location}
-			    . ")" );
-		}
-		else {
-
-		    if ( __Add_var( $CONF->{$current}, $var, $val ) == $CODE->{'SYNTAX'} )
-		    {
-			Abort( $CODE->{'SYNTAX'},
-			          $FIC_CONF[0] . ":"
-				. $line[0] . ": "
-				. $var
-				. " dupliquee (precedente a "
-				. $LOCATION->{$current}->{$var}->{_location}
-				. ")" );
-		    }
-		    $LOCATION->{$current}->{$var}->{_location}
-			= $FIC_CONF[0] . ":" . $line[0];
-		}
-	    }
-	    else {
-		Abort( $CODE->{'SYNTAX'},
-		    $FIC_CONF[0] . ":" . $line[0] . ": Erreur de syntaxe" );
-	    }
-	}
-	close( $FH[0] ) ;
-	print "Closing $FIC_CONF[0] -- $FH[0]\n"  if ( $DEBUG );
-	shift @FH;
-	print "Filehandles after closing --> @FH\n"  if ( $DEBUG );
-	shift @line;
-	shift @FIC_CONF;
-    }
-
-    # Conditions non fermees
-    if ( $#cond >= 0 ) {
-	Abort( $CODE->{'SYNTAX'}, "EOC: endif manquant" );
-    }
-
-    return ($CONF);
 }
 
 sub Parser_ini ($) {




More information about the pf-tools-commits mailing list