diff options
author | Bram <perl-rt@wizbit.be> | 2022-08-31 00:16:39 +0200 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-08-31 12:11:58 -0600 |
commit | 0c33882a943825845dde164b60900bf224b131cc (patch) | |
tree | b6a1fefb3bfc20b7e3249c7eb2c4a5b7f7f4d762 /patchlevel.h | |
parent | e4bbbfe02b9e9aae521b164eba0e518ca478945f (diff) | |
download | perl-0c33882a943825845dde164b60900bf224b131cc.tar.gz |
patchlevel.h: Adjust embedded script for detabify
patchlevel.h was detabified[^1] and tabs replaced with spaces.
It however contains an embedded perl script for updating the
`local_patches` list (in patchlevel.h).
This no longer worked because it used:
/\t,NULL/
(which no longer matches after the detabify)
Fix it by using `\s+` (and by capturing it and using it
as leading space in the added text).
Example of how to run it:
$ perl -x patchlevel.h patch_foo patch_bar patch_baz
[^1]: in commit 1604cfb0273418ed479719f39def5ee559bffda2
Diffstat (limited to 'patchlevel.h')
-rw-r--r-- | patchlevel.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/patchlevel.h b/patchlevel.h index de1ecf3ced..88d0b0d44d 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -118,11 +118,12 @@ open PLIN, "<", "patchlevel.h" or die "Couldn't open patchlevel.h : $!"; open PLOUT, ">", "patchlevel.new" or die "Couldn't write on patchlevel.new : $!"; my $seen=0; while (<PLIN>) { - if (/\t,NULL/ and $seen) { + if (/^(\s+),NULL/ and $seen) { + my $pre = $1; while (my $c = shift @ARGV){ $c =~ s|\\|\\\\|g; $c =~ s|"|\\"|g; - print PLOUT qq{\t,"$c"\n}; + print PLOUT qq{$pre,"$c"\n}; } } $seen++ if /local_patches\[\]/; |