perl: open... || -> open... or (cont.)

Also: unfold a few lines, fix a space, add a missing parentheses.

Follow-up to 678e63934c #22036

Closes #22047
This commit is contained in:
Viktor Szakats 2026-06-16 15:40:07 +02:00
parent 1bb75af8e9
commit be8f24323e
No known key found for this signature in database
18 changed files with 44 additions and 58 deletions

View file

@ -89,7 +89,7 @@ sub single {
my $salist = 0;
my $copyright;
my $spdx;
open(F, "<:crlf", $f) ||
open(F, "<:crlf", $f) or
return 1;
while(<F>) {
$line++;
@ -212,7 +212,7 @@ HEAD
close(F);
if($inplace) {
open(O, ">$f") || return 1;
open(O, ">$f") or return 1;
print O @desc;
close(O);
}

View file

@ -562,7 +562,7 @@ sub maybespace {
sub single {
my ($dir, $manpage, $f, $standalone) = @_;
my $fh;
open($fh, "<:crlf", "$dir/$f") ||
open($fh, "<:crlf", "$dir/$f") or
die "could not find $dir/$f";
my $short;
my $long;
@ -969,7 +969,7 @@ sub single {
sub getshortlong {
my ($dir, $f) = @_;
$f =~ s/^.*\///;
open(F, "<:crlf", "$dir/$f") ||
open(F, "<:crlf", "$dir/$f") or
die "could not find $dir/$f";
my $short;
my $long;
@ -1037,7 +1037,7 @@ sub indexoptions {
sub header {
my ($dir, $manpage, $f) = @_;
my $fh;
open($fh, "<:crlf", "$dir/$f") ||
open($fh, "<:crlf", "$dir/$f") or
die "could not find $dir/$f";
my @d = render($manpage, $fh, $f, 1);
close($fh);
@ -1047,7 +1047,7 @@ sub header {
sub sourcecategories {
my ($dir) = @_;
my %cats;
open(H, "<$dir/../../src/tool_help.h") ||
open(H, "<$dir/../../src/tool_help.h") or
die "cannot find the header file";
while(<H>) {
if(/^\#define CURLHELP_([A-Z0-9]*)/) {
@ -1177,7 +1177,7 @@ sub listglobals {
# Find all global options and output them
foreach my $f (sort @files) {
open(F, "<:crlf", "$dir/$f") ||
open(F, "<:crlf", "$dir/$f") or
die "could not read $dir/$f";
my $long;
my $start = 0;
@ -1222,7 +1222,7 @@ sub mainpage {
# $manpage is 1 for nroff, 0 for ASCII
my $ret;
my $fh;
open($fh, "<:crlf", "$dir/mainpage.idx") ||
open($fh, "<:crlf", "$dir/mainpage.idx") or
die "no $dir/mainpage.idx file";
print <<HEADER

View file

@ -154,7 +154,7 @@ sub storelink {
sub findlinks {
my ($f) = @_;
my $line = 1;
open(F, "<:crlf", $f) ||
open(F, "<:crlf", $f) or
return;
# is it a markdown extension?

View file

@ -257,7 +257,7 @@ sub sha256 {
sub oldhash {
my $hash = "";
open(C, "<$_[0]") || return 0;
open(C, "<$_[0]") or return 0;
while(<C>) {
chomp;
if($_ =~ /^\#\# SHA256: (.*)/) {

View file

@ -43,7 +43,7 @@ my $nroff2cd = "0.1"; # to keep check
sub single {
my ($f) = @_;
open(F, "<:crlf", $f) ||
open(F, "<:crlf", $f) or
return 1;
my $line;
my $title;
@ -67,7 +67,7 @@ sub single {
# remove leading directory
$f =~ s/(.*?\/)//;
close(F);
open(F, "<:crlf", $f) || return 1;
open(F, "<:crlf", $f) or return 1;
}
if($d =~ /^\.TH ([^ ]*) (\d) \"(.*?)\" ([^ \n]*)/) {
# header, this needs to be the first thing after leading comments