mirror of
https://github.com/curl/curl.git
synced 2026-05-30 09:07:33 +03:00
tidy-up: whitespace (more in Perl)
Follow-up to 8eab2b7086 #17896
Cherry-picked from #17877
Closes #17901
This commit is contained in:
parent
8eab2b7086
commit
ddcfd2d511
43 changed files with 84 additions and 98 deletions
|
|
@ -54,7 +54,7 @@ while(1) {
|
|||
|
||||
use POSIX qw(strftime);
|
||||
my @ts;
|
||||
if (defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
if(defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
@ts = localtime($ENV{SOURCE_DATE_EPOCH});
|
||||
} else {
|
||||
@ts = localtime;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ HELP
|
|||
|
||||
use POSIX qw(strftime);
|
||||
my @ts;
|
||||
if (defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
if(defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
@ts = gmtime($ENV{SOURCE_DATE_EPOCH});
|
||||
} else {
|
||||
@ts = localtime;
|
||||
|
|
|
|||
|
|
@ -169,17 +169,17 @@ sub readlocalfile {
|
|||
$i++;
|
||||
|
||||
# Lines starting with '#' are considered comments
|
||||
if (/^\s*(#.*)/) {
|
||||
if(/^\s*(#.*)/) {
|
||||
next;
|
||||
}
|
||||
elsif (/^enable ([A-Z]+)$/) {
|
||||
elsif(/^enable ([A-Z]+)$/) {
|
||||
if(!defined($warnings_extended{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
}
|
||||
$warnings{$1} = $warnings_extended{$1};
|
||||
}
|
||||
elsif (/^disable ([A-Z]+)$/) {
|
||||
elsif(/^disable ([A-Z]+)$/) {
|
||||
if(!defined($warnings{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
|
|
@ -187,10 +187,10 @@ sub readlocalfile {
|
|||
# Accept-list
|
||||
push @alist, $1;
|
||||
}
|
||||
elsif (/^banfunc ([^ ]*)/) {
|
||||
elsif(/^banfunc ([^ ]*)/) {
|
||||
$banfunc{$1} = $1;
|
||||
}
|
||||
elsif (/^allowfunc ([^ ]*)/) {
|
||||
elsif(/^allowfunc ([^ ]*)/) {
|
||||
undef $banfunc{$1};
|
||||
}
|
||||
else {
|
||||
|
|
@ -344,7 +344,7 @@ readlocalfile($file);
|
|||
do {
|
||||
if("$wlist" !~ / $file /) {
|
||||
my $fullname = $file;
|
||||
$fullname = "$dir/$file" if ($fullname !~ '^\.?\.?/');
|
||||
$fullname = "$dir/$file" if($fullname !~ '^\.?\.?/');
|
||||
scanfile($fullname);
|
||||
}
|
||||
$file = shift @ARGV;
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ Pod::Usage::pod2usage() if $help;
|
|||
|
||||
my @opts = parse_main_opts($opts_dir);
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
if($shell eq 'fish') {
|
||||
print "# curl fish completion\n\n";
|
||||
print "# Complete file paths after @\n";
|
||||
print q(complete -c curl -n 'string match -qr "^@" -- (commandline -ct)' -k -xa "(printf '%s\n' -- @(__fish_complete_suffix --complete=(commandline -ct | string replace -r '^@' '') ''))");
|
||||
print "\n\n";
|
||||
print qq{$_ \n} foreach (@opts);
|
||||
} elsif ($shell eq 'zsh') {
|
||||
} elsif($shell eq 'zsh') {
|
||||
my $opts_str;
|
||||
|
||||
$opts_str .= qq{ $_ \\\n} foreach (@opts);
|
||||
|
|
@ -99,10 +99,10 @@ sub parse_main_opts {
|
|||
$file_content = $1;
|
||||
my ($short, $long, $arg, $desc);
|
||||
|
||||
if ($file_content =~ /^Short:\s+(.*)\s*$/im) {$short = "-$1";}
|
||||
if ($file_content =~ /^Long:\s+(.*)\s*$/im) {$long = "--$1";}
|
||||
if ($file_content =~ /^Arg:\s+(.*)\s*$/im) {$arg = $1;}
|
||||
if ($file_content =~ /^Help:\s+(.*)\s*$/im) {$desc = $1;}
|
||||
if($file_content =~ /^Short:\s+(.*)\s*$/im) {$short = "-$1";}
|
||||
if($file_content =~ /^Long:\s+(.*)\s*$/im) {$long = "--$1";}
|
||||
if($file_content =~ /^Arg:\s+(.*)\s*$/im) {$arg = $1;}
|
||||
if($file_content =~ /^Help:\s+(.*)\s*$/im) {$desc = $1;}
|
||||
|
||||
$arg =~ s/\:/\\\:/g if defined $arg;
|
||||
$desc =~ s/'/'\\''/g if defined $desc;
|
||||
|
|
@ -112,7 +112,7 @@ sub parse_main_opts {
|
|||
|
||||
my $option = '';
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
if($shell eq 'fish') {
|
||||
$option .= "complete --command curl";
|
||||
$option .= " --short-option '" . strip_dash(trim($short)) . "'"
|
||||
if defined $short;
|
||||
|
|
@ -120,23 +120,23 @@ sub parse_main_opts {
|
|||
if defined $long;
|
||||
$option .= " --description '" . strip_dash(trim($desc)) . "'"
|
||||
if defined $desc;
|
||||
} elsif ($shell eq 'zsh') {
|
||||
} elsif($shell eq 'zsh') {
|
||||
$option .= '{' . trim($short) . ',' if defined $short;
|
||||
$option .= trim($long) if defined $long;
|
||||
$option .= '}' if defined $short;
|
||||
$option .= '\'[' . trim($desc) . ']\'' if defined $desc;
|
||||
|
||||
if (defined $arg) {
|
||||
if(defined $arg) {
|
||||
$option .= ":'$arg'";
|
||||
if ($arg =~ /<file ?(name)?>|<path>/) {
|
||||
if($arg =~ /<file ?(name)?>|<path>/) {
|
||||
$option .= ':_files';
|
||||
} elsif ($arg =~ /<dir>/) {
|
||||
} elsif($arg =~ /<dir>/) {
|
||||
$option .= ":'_path_files -/'";
|
||||
} elsif ($arg =~ /<url>/i) {
|
||||
} elsif($arg =~ /<url>/i) {
|
||||
$option .= ':_urls';
|
||||
} elsif ($long =~ /ftp/ && $arg =~ /<method>/) {
|
||||
} elsif($long =~ /ftp/ && $arg =~ /<method>/) {
|
||||
$option .= ":'(multicwd nocwd singlecwd)'";
|
||||
} elsif ($arg =~ /<method>/) {
|
||||
} elsif($arg =~ /<method>/) {
|
||||
$option .= ":'(DELETE GET HEAD POST PUT)'";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ my %catlong;
|
|||
|
||||
use POSIX qw(strftime);
|
||||
my @ts;
|
||||
if (defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
if(defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
@ts = gmtime($ENV{SOURCE_DATE_EPOCH});
|
||||
} else {
|
||||
@ts = localtime;
|
||||
|
|
@ -195,7 +195,7 @@ sub printdesc {
|
|||
chomp $l;
|
||||
lastline($baselvl + $lvl + 1, $l);
|
||||
my $w = ($baselvl + $lvl + 1) * $indent + length($l);
|
||||
if ($w > $colwidth) {
|
||||
if($w > $colwidth) {
|
||||
print STDERR "ERROR: $w columns is too long\n";
|
||||
print STDERR "$l\n";
|
||||
$error++;
|
||||
|
|
@ -1176,7 +1176,7 @@ sub mainpage {
|
|||
.\\"
|
||||
.TH curl 1 "$date" "curl $version" "curl Manual"
|
||||
HEADER
|
||||
if ($manpage);
|
||||
if($manpage);
|
||||
|
||||
while(<$fh>) {
|
||||
my $f = $_;
|
||||
|
|
|
|||
|
|
@ -162,4 +162,4 @@ for my $l (sort keys %flink) {
|
|||
}
|
||||
}
|
||||
|
||||
exit 1 if ($error);
|
||||
exit 1 if($error);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ sub oldhash {
|
|||
return $hash;
|
||||
}
|
||||
|
||||
if( $opt_p !~ m/:/ ) {
|
||||
if($opt_p !~ m/:/) {
|
||||
print "Error: Mozilla trust identifier list must include both purposes and levels\n";
|
||||
HELP_MESSAGE();
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ sub should_output_cert(%) {
|
|||
foreach my $level (@included_mozilla_trust_levels) {
|
||||
# for each level we want to output, see if any of our desired purposes are
|
||||
# included
|
||||
return 1 if( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
|
||||
return 1 if(defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -656,8 +656,8 @@ unless($stdout) {
|
|||
$bk++;
|
||||
}
|
||||
rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n";
|
||||
} elsif( -e $crt ) {
|
||||
unlink( $crt ) or die "Failed to remove $crt: $!\n";
|
||||
} elsif(-e $crt) {
|
||||
unlink($crt) or die "Failed to remove $crt: $!\n";
|
||||
}
|
||||
rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ open(N, "nm $file|") ||
|
|||
my %exist;
|
||||
my %uses;
|
||||
my $file;
|
||||
while (<N>) {
|
||||
while(<N>) {
|
||||
my $l = $_;
|
||||
chomp $l;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ use warnings;
|
|||
sub checkcmd {
|
||||
my ($cmd)=@_;
|
||||
my @paths;
|
||||
if ($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
|
||||
if($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
|
||||
# PATH separator is different
|
||||
@paths=(split(';', $ENV{'PATH'}));
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ sub checkcmd {
|
|||
"/sbin", "/usr/bin", "/usr/local/bin");
|
||||
}
|
||||
for(@paths) {
|
||||
if( -x "$_/$cmd" && ! -d "$_/$cmd" ) {
|
||||
if(-x "$_/$cmd" && ! -d "$_/$cmd") {
|
||||
# executable bit but not a directory!
|
||||
return "$_/$cmd";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue