mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 09:09:59 +09:00
17515512: JanRain php-openid library included, normalization fix
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5137 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f541dd59b9
commit
658c0e6dbc
219 changed files with 41415 additions and 10 deletions
46
modules/member/php-openid-1.2.3/admin/longlines.pl
Normal file
46
modules/member/php-openid-1.2.3/admin/longlines.pl
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
my $filename = $ARGV[0];
|
||||
|
||||
if (!$filename) {
|
||||
print "Usage: longlines.pl <filename> [length]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# Set a default maximum line length.
|
||||
my $max_length = $ARGV[1] || 80;
|
||||
|
||||
my @lines = ();
|
||||
my $line_num = 0;
|
||||
|
||||
open(HANDLE, "<", $filename) or die "Cannot open $filename\n";
|
||||
|
||||
# Read the file and track the lines with length > $max_length.
|
||||
while (<HANDLE>) {
|
||||
$line_num++;
|
||||
# Subtract one because the newline doesn't count toward the
|
||||
# length.
|
||||
if (length($_) - 1 > $max_length) {
|
||||
push @lines, $line_num;
|
||||
}
|
||||
}
|
||||
|
||||
# If more than five long lines were found, truncate to five and
|
||||
# indicate that others were present, too.
|
||||
if (@lines > 5) {
|
||||
@lines = @lines[0..4];
|
||||
push @lines, "and others";
|
||||
}
|
||||
|
||||
# If any long lines were found, notify and exit(1); otherwise,
|
||||
# exit(0).
|
||||
if (@lines) {
|
||||
print $filename." (line".((@lines > 1) ? "s" : "")." ".
|
||||
join(", ", @lines)." exceed".((@lines == 1) ? "s" : "").
|
||||
" length $max_length)\n";
|
||||
exit(1);
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue