X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=cp-update;h=d5b2ab24f80e7413ce0b39af4296e185fa9a9c4d;hb=84585bc441d81f0e9d0b1cc514d88a97efe8a56f;hp=2207c407d1b8a7eab26066fd5dfe1fe65671b5e9;hpb=dbb7399cf634ebc433853bf4870789e424debf98;p=carnet-tools-cn.git diff --git a/cp-update b/cp-update index 2207c40..d5b2ab2 100755 --- a/cp-update +++ b/cp-update @@ -69,7 +69,6 @@ $UsageLong = " -i | --insert-after x Insert after this/matching line. -f | --insert-before x Insert before this/matching line. - -R | --regexp-match Use regexp mode for line matching. - Manipulating block marks: @@ -120,6 +119,7 @@ use constant DO_INSERT => 1; # Operation defaults $InsertRemove = DO_INSERT; $Placement = APPEND_AT_END; +$RegexpMatch = 1; $Comment = '#'; $CommentEnd = ''; $MatchLine = ''; @@ -166,7 +166,7 @@ while (@ARGV) { $Placement = INSERT_ON_TOP; } elsif (/^-R$/ || /^--regexp(?:-match|-mode)?$/) { - $RegexpMatch = 1; + $RegexpMatch = 1; # it's the default } elsif (/^-h$/ || /^--help$/) { die $UsageLong; @@ -299,8 +299,8 @@ sub add() { } ++ $lineNo; } - if (! $added) { - warn "$ProgramName: Inserting lines at the end implicitly!\n"; + if ($MatchLine and ! $added) { + warn "$ProgramName: Inserting lines at the end implicitly! No '$MatchLine'\n"; push(@Lines, $StdinContent); } }