diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
commit | 126777bc019a54afb4ec51299f2cf9d2841698aa (patch) | |
tree | 97f76e571902ead55ba138f1156a4b4f00b9b779 /perl-install/printer/common.pm | |
parent | f1f67448efc714873378dfeb8279fae68054a90a (diff) | |
download | drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2 drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip |
re-sync after the big svn loss
Diffstat (limited to 'perl-install/printer/common.pm')
-rw-r--r-- | perl-install/printer/common.pm | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/perl-install/printer/common.pm b/perl-install/printer/common.pm deleted file mode 100644 index 9d8f4d9a5..000000000 --- a/perl-install/printer/common.pm +++ /dev/null @@ -1,86 +0,0 @@ -package printer::common; - -use strict; -use vars qw(@ISA @EXPORT); - -@ISA = qw(Exporter); -@EXPORT = qw(addentry addsection removeentry removesection); - - -sub addentry { - my ($section, $entry, $filecontent) = @_; - my $sectionfound = 0; - my $entryinserted = 0; - my @lines = split("\n", $filecontent); - foreach (@lines) { - if (!$sectionfound) { - $sectionfound = 1 if /^\s*\[\s*$section\s*\]\s*$/; - } else { - if (!/^\s*$/ && !/^\s*;/) { #-# - $_ = "$entry\n$_"; - $entryinserted = 1; - last; - } - } - } - push(@lines, $entry) if $sectionfound && !$entryinserted; - return join "\n", @lines; -} - -sub addsection { - my ($section, $filecontent) = @_; - my @lines = split("\n", $filecontent); - foreach (@lines) { - # section already there, nothing to be done - return $filecontent if /^\s*\[\s*$section\s*\]\s*$/; - } - return $filecontent . "\n[$section]"; -} - -sub removeentry { - my ($section, $entry, $filecontent) = @_; - my $sectionfound = 0; - my $done = 0; - my @lines = split("\n", $filecontent); - foreach (@lines) { - $_ = "$_\n"; - next if $done; - if (!$sectionfound) { - $sectionfound = 1 if /^\s*\[\s*$section\s*\]\s*$/; - } else { - if (/^\s*\[.*\]\s*$/) { # Next section - $done = 1; - } elsif (/^\s*$entry/) { - $_ = ""; - $done = 1; - } - } - } - return join "", @lines; -} - -sub removesection { - my ($section, $filecontent) = @_; - my $sectionfound = 0; - my $done = 0; - my @lines = split("\n", $filecontent); - foreach (@lines) { - $_ = "$_\n"; - next if $done; - if (!$sectionfound) { - if (/^\s*\[\s*$section\s*\]\s*$/) { - $_ = ""; - $sectionfound = 1; - } - } else { - if (/^\s*\[.*\]\s*$/) { # Next section - $done = 1; - } else { - $_ = ""; - } - } - } - return join "", @lines; -} - -1; |