Lines Matching +full:line +full:- +full:name
2 # SPDX-License-Identifier: GPL-2.0
4 # Clean a patch file -- or directory of patch files -- of stealth whitespace.
15 # Clean up space-tab sequences, either by removing spaces or
31 my $ntab = ($npos >> 3) - ($pos >> 3);
80 $name = basename($0);
85 if ($a =~ /^-/) {
86 if ($a eq '-width' || $a eq '-w') {
89 print STDERR "Usage: $name [-width #] files...\n";
98 print STDERR "$name: $f\n";
100 if (! -f $f) {
106 print STDERR "$name: Cannot open file: $f: $!\n";
125 print STDERR "$name: $f: binary file\n";
140 while ( defined($line = <FILE>) ) {
142 $in_bytes += length($line);
145 if ($line =~
146 /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@/) {
151 @hunk_lines = ($line);
154 push(@lines, $line);
155 $out_bytes += length($line);
160 if ($line =~ /^\+/) {
161 $plus_lines--;
163 $text = substr($line, 1);
170 "$f:$lineno: adds line exceeds $max_width ",
175 } elsif ($line =~ /^\-/) {
176 $minus_lines--;
177 push(@hunk_lines, $line);
178 } elsif ($line =~ /^ /) {
179 $plus_lines--;
180 $minus_lines--;
181 push(@hunk_lines, $line);
183 print STDERR "$name: $f: malformed patch\n";
189 print STDERR "$name: $f: malformed patch\n";
200 for ($i = scalar(@hunk_lines)-1; $i > 0; $i--) {
203 $adj++; # Skip this line
217 ($l =~ /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@(.*)$/);
224 $l = sprintf("@@ -%d,%d +%d,%d @@%s\n",
225 $mstart, $mlin, $pstart, $plin-$adj,
242 print STDERR "$name: $f: malformed patch\n";
254 die "$name: Failed to truncate modified file: $f: $!\n";