blob: 20b074da1f0508405ff812b3f6d2afd1ee42fc3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/perl
use strict;
use warnings;
sub ln80 {
my $file = $_[0];
$/ = "\n";
open(FILE, $_[0])
or die("$file: no such file or direcory\n");
while (<FILE>) {
chomp;
1 while $_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
if (length($_) > 80) {
print "WRN: in $file line $. has ".length($_)."/80 chars\n";
}
}
close (FILE);
}
sub eolSpace {
my $file = $_[0];
$/ = "\n";
open(FILE, $_[0])
or die("$file: no such file or direcory\n");
while (<FILE>) {
chomp;
if ($_ =~ /\s+$/) {
print "WRN: in $file line $. has trailing whitespaces\n";
}
}
close (FILE);
}
if (not $ARGV[0]) {
open(LS, 'find -name \*.\[c\|h\] |');
while (<LS>) {
chomp;
my $string = $_;
eolSpace($string);
ln80($string);
}
} else {
local $/ = " ";
foreach my $arg(@ARGV) {
ln80($arg);
eolSpace($arg);
}
}
|