my $salist = 0;
my $copyright;
my $spdx;
- open(F, "<:crlf", $f) ||
+ open(F, "<:crlf", $f) or
return 1;
while(<F>) {
$line++;
close(F);
if($inplace) {
- open(O, ">$f") || return 1;
+ open(O, ">$f") or return 1;
print O @desc;
close(O);
}
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;
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;
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);
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]*)/) {
# 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;
# $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
sub findlinks {
my ($f) = @_;
my $line = 1;
- open(F, "<:crlf", $f) ||
+ open(F, "<:crlf", $f) or
return;
# is it a markdown extension?
sub oldhash {
my $hash = "";
- open(C, "<$_[0]") || return 0;
+ open(C, "<$_[0]") or return 0;
while(<C>) {
chomp;
if($_ =~ /^\#\# SHA256: (.*)/) {
sub single {
my ($f) = @_;
- open(F, "<:crlf", $f) ||
+ open(F, "<:crlf", $f) or
return 1;
my $line;
my $title;
# 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
sub allversions {
my ($file) = @_;
- open(A, "<$file") ||
+ open(A, "<$file") or
die "cannot open the versions file $file\n";
my $before = 1;
my $relcount;
sub ftpmsg {
# append to the server.input file
- open(my $input, ">>", "$logdir/server$idstr.input") ||
+ open(my $input, ">>", "$logdir/server$idstr.input") or
logmsg "failed to open $logdir/server$idstr.input\n";
print $input @_;
logmsg "Store test number $testno in $filename\n";
- open(my $file, ">", $filename) ||
+ open(my $file, ">", $filename) or
return 0; # failed to open output
my $line;
logmsg "Store test number $testno in $filename\n";
- open(my $file, ">", $filename) ||
+ open(my $file, ">", $filename) or
return 0; # failed to open output
my $received = 0;
sendcontrol "125 Gimme gimme gimme!\r\n";
- open(my $file, ">", $filename) ||
+ open(my $file, ">", $filename) or
return 0; # failed to open output
my $line;
%customcount = (); #
%delayreply = (); #
- open(my $custom, "<", "$logdir/$SERVERCMD") ||
+ open(my $custom, "<", "$logdir/$SERVERCMD") or
return 1;
logmsg "FTPD: Getting commands from $logdir/$SERVERCMD\n";
if($ARGV[0] eq "prepare") {
my $dirname = $ARGV[1];
- mkdir $dirname || errout "$!";
+ mkdir $dirname or errout "$!";
chdir $dirname;
# Create the files in alphabetical order, to increase the chances
# of receiving a consistent set of directory contents regardless
# of whether the server alphabetizes the results or not.
- mkdir "asubdir" || errout "$!";
+ mkdir "asubdir" or errout "$!";
chmod 0777, "asubdir";
- open(FILE, ">plainfile.txt") || errout "$!";
+ open(FILE, ">plainfile.txt") or errout "$!";
binmode FILE;
print FILE "Test file to support curl test suite\n";
close(FILE);
utime time, timegm(0,0,12,1,0,100), "plainfile.txt";
chmod 0666, "plainfile.txt";
- open(FILE, ">emptyfile.txt") || errout "$!";
+ open(FILE, ">emptyfile.txt") or errout "$!";
binmode FILE;
close(FILE);
# The mtime is specifically chosen to be an even number so that it can be
utime time, timegm(0,0,12,1,0,100), "emptyfile.txt";
chmod 0666, "emptyfile.txt";
- open(FILE, ">rofile.txt") || errout "$!";
+ open(FILE, ">rofile.txt") or errout "$!";
binmode FILE;
print FILE "Read-only test file to support curl test suite\n";
close(FILE);
logmsg "$CMDLINE\n";
}
- open(my $cmdlog, ">", "$LOGDIR/$CURLLOG") ||
- die "Failure writing log file";
+ open(my $cmdlog, ">", "$LOGDIR/$CURLLOG") or die "Failure writing log file";
print $cmdlog "$CMDLINE\n";
close($cmdlog) or die "Failure writing log file";
my $file;
# Get all files
- opendir(my $dh, $dir) ||
- return 0; # cannot open dir
+ opendir(my $dh, $dir) or return 0; # cannot open dir
while($file = readdir($dh)) {
# Do not clear the $PIDDIR or $LOCKDIR since those need to live beyond
# one test
# seed of the month. December 2019 becomes 201912
$randseed = ($year + 1900) * 100 + $mon + 1;
print "Using curl: $CURL\n";
- open(my $curlvh, "-|", exerunner() . shell_quote($CURL) . " --version 2>$dev_null") ||
+ open(my $curlvh, "-|", exerunner() . shell_quote($CURL) . " --version 2>$dev_null") or
die "could not get curl version!";
my @c = <$curlvh>;
close($curlvh) or die "could not get curl version!";
sub displaylogs {
my ($runnerid, $testnum) = @_;
my $logdir = getrunnerlogdir($runnerid);
- opendir(DIR, $logdir) ||
- die "cannot open dir: $!";
+ opendir(DIR, $logdir) or die "cannot open dir: $!";
my @logs = readdir(DIR);
closedir(DIR);
$endwaitcnt = 0;
# This runner is ready to be serviced
my $testnum = $runnersrunning{$ridready};
- defined $testnum || die "Internal error: test for runner $ridready unknown";
+ defined $testnum or die "Internal error: test for runner $ridready unknown";
delete $runnersrunning{$ridready};
my ($error, $again) = singletest($ridready, $testnum, $countforrunner{$ridready}, $totaltests);
if($again) {
sub scanallheaders {
my $d = "$root/include/curl";
- opendir(my $dh, $d) ||
- die "Cannot opendir: $!";
+ opendir(my $dh, $d) or die "Cannot opendir: $!";
my @headers = grep { /.h\z/ } readdir($dh);
closedir $dh;
foreach my $h (@headers) {
sub scanman_md_dir {
my ($d) = @_;
- opendir(my $dh, $d) ||
- die "Cannot opendir: $!";
+ opendir(my $dh, $d) or die "Cannot opendir: $!";
my @mans = grep { /.md\z/ } readdir($dh);
closedir $dh;
for my $m (@mans) {
sub scanmdpage {
my ($file, @words) = @_;
- open(my $mh, "<", $file) ||
- die "could not open $file";
+ open(my $mh, "<", $file) or die "could not open $file";
my @m;
while(<$mh>) {
if($_ =~ /^## (.*)/) {
my $r;
# check for define aliases
-open($r, "<", $curlh) ||
- die "no curl.h";
+open($r, "<", $curlh) or die "no curl.h";
while(<$r>) {
if(/^\#define (CURL(OPT|INFO|MOPT)_\w+) (.*)/) {
$alias{$1} = $3;
my @curlopt;
my @curlinfo;
my @curlmopt;
-open($r, "<", $syms) ||
- die "no input file";
+open($r, "<", $syms) or die "no input file";
while(<$r>) {
chomp;
my $l= $_;
#########################################################################
# parse the curl code that parses the command line arguments!
-open($r, "<", "$root/src/tool_getparam.c") ||
- die "no input file";
+open($r, "<", "$root/src/tool_getparam.c") or die "no input file";
my $list;
my @getparam; # store all parsed parameters
#########################################################################
# parse the curl.1 man page, extract all documented command line options
# The man page may or may not be rebuilt, so check both possible locations
-open($r, "<", "$buildroot/docs/cmdline-opts/curl.1") || open($r, "<", "$root/docs/cmdline-opts/curl.1") ||
+open($r, "<", "$buildroot/docs/cmdline-opts/curl.1") or
+ open($r, "<", "$root/docs/cmdline-opts/curl.1") or
die "failed getting curl.1";
my @manpage; # store all parsed parameters
while(<$r>) {
#########################################################################
# parse the curl code that outputs the curl -h list
-open($r, "<", "$root/src/tool_listhelp.c") ||
- die "no input file";
+open($r, "<", "$root/src/tool_listhelp.c") or die "no input file";
my @toolhelp; # store all parsed parameters
while(<$r>) {
chomp;
sub file {
my ($f) = @_;
- open(my $fh, "<", $f) ||
- die "test1140.pl could not open $f";
+ open(my $fh, "<", $f) or die "test1140.pl could not open $f";
my $line = 1;
while(<$fh>) {
chomp;
my ($file) = @_;
my $skipit = 0;
- open H_IN, "-|", "$Cpreprocessor -DCURL_DISABLE_DEPRECATION $i$file" ||
+ open(H_IN, "-|", "$Cpreprocessor -DCURL_DISABLE_DEPRECATION $i$file") or
die "Cannot preprocess $file";
while(<H_IN>) {
my ($line, $linenum) = ($_, $.);
CURLOPT_RANDOM_FILE => 1,
);
sub allsymbols {
- open(my $f, "<", $symbolsinversions) ||
- die "$symbolsinversions: $|";
+ open(my $f, "<", $symbolsinversions) or die "$symbolsinversions: $|";
while(<$f>) {
if($_ =~ /^([^ ]*) +(.*)/) {
my ($name, $info) = ($1, $2);
my @separators;
my @sepline;
- open(my $m, "<", $file) ||
- die "test1173.pl could not open $file";
+ open(my $m, "<", $file) or die "test1173.pl could not open $file";
if($file =~ /[\/\\](CURL|curl_)([^\/\\]*).3/) {
# This is a man page for libcurl. It requires an example unless it is
# considered deprecated.
}
# Read symbols-in-versions.
-open(my $fh, "<", "$root/docs/libcurl/symbols-in-versions") ||
+open(my $fh, "<", "$root/docs/libcurl/symbols-in-versions") or
die "$root/docs/libcurl/symbols-in-versions";
while(<$fh>) {
if($_ =~ /^((?:CURL|LIBCURL)\S+)\s+\S+\s*(\S*)\s*(\S*)$/) {
sub scanman_md_dir {
my ($d) = @_;
- opendir(my $dh, $d) ||
- die "Cannot opendir: $!";
+ opendir(my $dh, $d) or die "Cannot opendir: $!";
my @mans = grep { /.md\z/ } readdir($dh);
closedir $dh;
for my $m (@mans) {
sub valgrindparse {
my ($file) = @_;
my @o;
- open(my $val, "<", $file) ||
- return;
+ open(my $val, "<", $file) or return;
@o = <$val>;
close($val);
return @o;