Merge branch 'fperrad-perlcritic' into develop

This commit is contained in:
Karel Miko 2017-02-28 20:00:25 +01:00
commit e96a895d0d
4 changed files with 44 additions and 31 deletions

View File

@ -2,29 +2,29 @@
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun) # we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
$dst = shift; use strict;
$ins = shift; use warnings;
open(SRC,"<$dst"); open(my $src, '<', shift);
open(INS,"<$ins"); open(my $ins, '<', shift);
open(TMP,">tmp.delme"); open(my $tmp, '>', 'tmp.delme');
$l = 0; my $l = 0;
while (<SRC>) { while (<$src>) {
if ($_ =~ /START_INS/) { if ($_ =~ /START_INS/) {
print TMP $_; print {$tmp} $_;
$l = 1; $l = 1;
while (<INS>) { while (<$ins>) {
print TMP $_; print {$tmp} $_;
} }
close INS; close $ins;
} elsif ($_ =~ /END_INS/) { } elsif ($_ =~ /END_INS/) {
print TMP $_; print {$tmp} $_;
$l = 0; $l = 0;
} elsif ($l == 0) { } elsif ($l == 0) {
print TMP $_; print {$tmp} $_;
} }
} }
close TMP; close $tmp;
close SRC; close $src;

View File

@ -1,11 +1,16 @@
open(IN,"<crypt.ind"); #!/usr/bin/perl
open(OUT,">crypt.ind.tmp");
$a = <IN>; use strict;
print OUT "$a\n\\addcontentsline{toc}{chapter}{Index}\n"; use warnings;
while (<IN>) {
print OUT $_; open(my $in, '<', 'crypt.ind');
open(my $out, '>', 'crypt.ind.tmp');
my $a = <$in>;
print {$out} "$a\n\\addcontentsline{toc}{chapter}{Index}\n";
while (<$in>) {
print {$out} $_;
} }
close OUT; close $out;
close IN; close $in;
system("mv -f crypt.ind.tmp crypt.ind"); system("mv -f crypt.ind.tmp crypt.ind");

View File

@ -406,6 +406,9 @@ check_defines:
| grep -v -e 'LTC_ECC[0-9]*' -e 'LTC_DH[0-9]*' -e 'LTC_NO_' -e 'LTC_MUTEX' -e 'LTC_MPI' \ | grep -v -e 'LTC_ECC[0-9]*' -e 'LTC_DH[0-9]*' -e 'LTC_NO_' -e 'LTC_MUTEX' -e 'LTC_MPI' \
| xargs -I '{}' sh -c 'grep -q -m 1 -o {} src/misc/crypt/crypt.c || echo {} not found' | xargs -I '{}' sh -c 'grep -q -m 1 -o {} src/misc/crypt/crypt.c || echo {} not found'
perlcritic:
perlcritic *.pl
# $Source$ # $Source$
# $Revision$ # $Revision$
# $Date$ # $Date$

View File

@ -4,20 +4,25 @@
# wrapped at 80 chars # wrapped at 80 chars
# #
# Tom St Denis # Tom St Denis
@a = split(" ", $ARGV[1]); use strict;
$b = "$ARGV[0]="; use warnings;
$len = length($b);
my @a = split ' ', $ARGV[1];
my $b = $ARGV[0] . '=';
my $len = length $b;
print $b; print $b;
foreach my $obj (@a) { foreach my $obj (@a) {
$len = $len + length($obj); $len = $len + length $obj;
$obj =~ s/\*/\$/; $obj =~ s/\*/\$/;
if ($len > 100) { if ($len > 100) {
printf "\\\n"; print "\\\n";
$len = length($obj); $len = length $obj;
} }
print "$obj "; print $obj . ' ';
}
if ($ARGV[0] eq 'HEADERS') {
print 'testprof/tomcrypt_test.h';
} }
if ($ARGV[0] eq "HEADERS") { print "testprof/tomcrypt_test.h"; }
print "\n\n"; print "\n\n";