Usage was fifty-fifty between these syntaxes before this patch.
Closes #22036
my @asyms;
open(S, "<./docs/libcurl/symbols-in-versions")
- || die "cannot find symbols-in-versions";
+ or die "cannot find symbols-in-versions";
while(<S>) {
if(/^([^ ]*) /) {
push @asyms, $1;
);
open(O, "<./docs/options-in-versions")
- || die "cannot find options-in-versions";
+ or die "cannot find options-in-versions";
while(<O>) {
chomp;
if(/^([^ ]+)/) {
close(O);
open(C, "<./.github/scripts/spellcheck.curl")
- || die "cannot find spellcheck.curl";
+ or die "cannot find spellcheck.curl";
while(<C>) {
if(/^\#/) {
next;
use strict;
use warnings;
-open(S, "<../libcurl/symbols-in-versions") || die;
+open(S, "<../libcurl/symbols-in-versions") or die;
my %doc;
my %rem;
}
my %used;
-open(C, "<$ARGV[0]") || die;
+open(C, "<$ARGV[0]") or die;
while(<C>) {
if(/\W(CURL[_A-Z0-9v]+)\W/) {
sub convert {
my ($dir) = @_;
- opendir(my $dh, $dir) || die "could not open $dir";
+ opendir(my $dh, $dir) or die "could not open $dir";
my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh);
closedir $dh;
my @files;
my $is_git = 0;
if(system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') == 0) {
- open(O, '-|', 'git', 'ls-files', '*.[ch]') || die; push @files, <O>; close(O);
+ open(O, '-|', 'git', 'ls-files', '*.[ch]') or die; push @files, <O>; close(O);
$is_git = 1;
}
else {
for my $dir (@dirs) {
if($is_git) {
@files = ();
- open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") || die; push @files, <O>; close(O);
+ open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") or die; push @files, <O>; close(O);
chomp(@files);
}
else {
printf "Checking file: $file\n";
}
- open(my $R, '<', $file) || die "failed to open $file";
+ open(my $R, '<', $file) or die "failed to open $file";
my $incomment = 0;
my @copyright = ();
my (@files, @list);
my ($dir_handle, $file_content);
- opendir($dir_handle, $opts_dir) || die "Unable to open dir: $opts_dir due to error: $!";
+ opendir($dir_handle, $opts_dir) or die "Unable to open dir: $opts_dir due to error: $!";
@files = readdir($dir_handle);
- closedir($dir_handle) || die "Unable to close handle on dir: $opts_dir due to error: $!";
+ closedir($dir_handle) or die "Unable to close handle on dir: $opts_dir due to error: $!";
# We want regular files that end with .md and do not start with an underscore
# Edge case: MANPAGE.md does not start with an underscore but also is not documentation for an option
@files = grep { $_ =~ /\.md$/i && !/^_/ && -f "$opts_dir/$_" && $_ ne "MANPAGE.md" } @files;
for my $file (@files) {
- open(my $doc_handle, '<', "$opts_dir/$file") || die "Unable to open file: $file due to error: $!";
+ open(my $doc_handle, '<', "$opts_dir/$file") or die "Unable to open file: $file due to error: $!";
$file_content = join('', <$doc_handle>);
- close($doc_handle) || die "Unable to close file: $file due to error: $!";
+ close($doc_handle) or die "Unable to close file: $file due to error: $!";
# Extract the curldown header section demarcated by ---
- $file_content =~ /^---\s*\n(.*?)\n---\s*\n/s || die "Unable to parse file $file";
+ $file_content =~ /^---\s*\n(.*?)\n---\s*\n/s or die "Unable to parse file $file";
$file_content = $1;
my ($short, $long, $arg, $desc);
sub scanfile {
my ($file) = @_;
- open(F, "<$file") || die "$file failed";
+ open(F, "<$file") or die "$file failed";
my $unit = 0;
my $line = 0;
my $unitref = 0;
$version = $ENV{'CURL_MAKETGZ_VERSION'};
}
else {
- open(INC, "<$include/curl/curlver.h") || die "no $include/curl/curlver.h";
+ open(INC, "<$include/curl/curlver.h") or die "no $include/curl/curlver.h";
while(<INC>) {
if($_ =~ /^#define LIBCURL_VERSION \"([0-9.]*)/) {
$version = $1;
return @also;
}
-open(N, '-|', 'nm', $file) || die;
+open(N, '-|', 'nm', $file) or die;
my %exist;
my %uses;
sub redir {
my $outfn = shift if($_[0] =~ /^>/);
my $hideerr = shift if($_[0] =~ /^2>/);
- open(my $outfd, $outfn) || die if($outfn);
+ open(my $outfd, $outfn) or die if($outfn);
my $pid = open3(my $in, my $out, my $err = gensym, @_);
if(!$hideerr) { while(<$err>) { print STDERR $_; }; }
if($outfn) { while(<$out>) { print $outfd $_; }; close($outfd); }
sub writearray {
my ($filename, $arrayref) = @_;
- open(my $temp, ">", $filename) || die "Failure writing file";
+ open(my $temp, ">", $filename) or die "Failure writing file";
binmode($temp,":raw"); # Cygwin fix
for(@$arrayref) {
print $temp $_;
}
- close($temp) || die "Failure writing file";
+ close($temp) or die "Failure writing file";
}
#
# Read the output of curl --version
my $curl_protocols = "";
-open(CURL, $ARGV[1]) || die "Cannot get curl $what list\n";
+open(CURL, $ARGV[1]) or die "Cannot get curl $what list\n";
while(<CURL>) {
$curl_protocols = $_ if(/$what:/i);
}
# Read the output of curl-config
my @curl_config;
-open(CURLCONFIG, '-|', 'sh', $ARGV[0], "--$what") || die "Cannot get curl-config $what list\n";
+open(CURLCONFIG, '-|', 'sh', $ARGV[0], "--$what") or die "Cannot get curl-config $what list\n";
while(<CURLCONFIG>) {
chomp;
$_ = lc($_) if($what eq "protocols"); # accept uppercase protocols in curl-config
my $what = $ARGV[2];
# Read the output of curl --version
-open(CURL, $ARGV[1]) || die "Cannot open curl --version list in $ARGV[1]\n";
+open(CURL, $ARGV[1]) or die "Cannot open curl --version list in $ARGV[1]\n";
$_ = <CURL>;
chomp;
/libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/;
my $curlconfigversion;
# Read the output of curl-config --version/--vernum
-open(CURLCONFIG, '-|', 'sh', $ARGV[0], "--$what") || die "Cannot get curl-config --$what list\n";
+open(CURLCONFIG, '-|', 'sh', $ARGV[0], "--$what") or die "Cannot get curl-config --$what list\n";
$_ = <CURLCONFIG>;
chomp;
my $filever = $_;
my $cmd = shift @ARGV;
my $arg = shift @ARGV;
if($cmd eq "mkdir") {
- mkdir $arg || die "$!";
+ mkdir $arg or die "$!";
}
elsif($cmd eq "rmdir") {
- rmdir $arg || die "$!";
+ rmdir $arg or die "$!";
}
elsif($cmd eq "rm") {
- unlink $arg || die "$!";
+ unlink $arg or die "$!";
}
elsif($cmd eq "move") {
my $arg2 = shift @ARGV;
- move($arg,$arg2) || die "$!";
+ move($arg,$arg2) or die "$!";
}
elsif($cmd eq "gone") {
- ! -e $arg || die "Path $arg exists";
+ ! -e $arg or die "Path $arg exists";
} else {
print "Unsupported command $cmd\n";
exit 1;
unlink "$dirname/plainfile.txt";
rmdir "$dirname/asubdir";
- rmdir $dirname || die "$!";
+ rmdir $dirname or die "$!";
if($#ARGV >= 3) { # Verify mtime if requested
my $checkfile = $ARGV[2];
# -r-?r-?r-? 12 U U 47 Dec 31 2000 rofile.txt
my @canondir;
- open(IN, "<$logfile") || die "$!";
+ open(IN, "<$logfile") or die "$!";
while(<IN>) {
/^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)\s+(.*)$/;
if($1 eq "d") {
@canondir = sort {substr($a, 57) cmp substr($b, 57)} @canondir;
my $newfile = $logfile . ".new";
- open(OUT, ">$newfile") || die "$!";
+ open(OUT, ">$newfile") or die "$!";
print OUT join('', @canondir);
close(OUT);
@entiretest = prepro($testnum, @entiretest);
# save the new version
- open(my $fulltesth, ">", $otest) || die "Failure writing test file";
+ open(my $fulltesth, ">", $otest) or die "Failure writing test file";
foreach my $bytes (@entiretest) {
print $fulltesth pack('a*', $bytes) or die "Failed to print '$bytes': $!";
}
- close($fulltesth) || die "Failure writing test file";
+ close($fulltesth) or die "Failure writing test file";
# in case the process changed the file, reload it
loadtest("$LOGDIR/test${testnum}");
open(my $cmdlog, ">", "$LOGDIR/$CURLLOG") ||
die "Failure writing log file";
print $cmdlog "$CMDLINE\n";
- close($cmdlog) || die "Failure writing log file";
+ close($cmdlog) or die "Failure writing log file";
my $dumped_core;
my $cmdres;
if($gdbthis) {
my $gdbinit = "$TESTDIR/gdbinit$testnum";
- open(my $gdbcmd, ">", "$LOGDIR/gdbcmd") || die "Failure writing gdb file";
+ open(my $gdbcmd, ">", "$LOGDIR/gdbcmd") or die "Failure writing gdb file";
if($gdbthis == 1) {
# gdb mode
print $gdbcmd "set args $cmdargs\n";
# lldb mode
print $gdbcmd "set args $cmdargs\n";
}
- close($gdbcmd) || die "Failure writing gdb file";
+ close($gdbcmd) or die "Failure writing gdb file";
}
# Flush output.
logmsg "core dumped\n";
if(0 && $gdb) {
logmsg "running gdb for post-mortem analysis:\n";
- open(my $gdbcmd, ">", "$LOGDIR/gdbcmd2") || die "Failure writing gdb file";
+ open(my $gdbcmd, ">", "$LOGDIR/gdbcmd2") or die "Failure writing gdb file";
print $gdbcmd "bt\n";
- close($gdbcmd) || die "Failure writing gdb file";
+ close($gdbcmd) or die "Failure writing gdb file";
runclient("$gdb --directory libtest -x $LOGDIR/gdbcmd2 -batch " . shell_quote($DBGCURL) . " core ");
# unlink("$LOGDIR/gdbcmd2");
}
my $margs = freeze \@_;
# Send IPC call via pipe
- length($margs) < 1000 || die "A large IPC write risks blocking on some platforms";
+ length($margs) < 1000 or die "A large IPC write risks blocking on some platforms";
my $err;
while(! defined ($err = syswrite($controllerw{$runnerid}, (pack "L", length($margs)) . $margs)) || $err <= 0) {
if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) {
$maxfileno = $fd;
}
}
- $maxfileno || die "Internal error: no runners are available to wait on\n";
+ $maxfileno or die "Internal error: no runners are available to wait on\n";
# Wait for any pipe from any runner to be ready
# This may be interrupted and return EINTR, but this is ignored and the
my $file1 = "$logdir/check-generated";
my $file2 = "$logdir/check-expected";
- open(my $temp, ">", $file1) || die "Failure writing diff file";
+ open(my $temp, ">", $file1) or die "Failure writing diff file";
for(@$firstref) {
my $l = $_;
$l =~ s/\r/[CR]/g;
print $temp $l;
print $temp "\n";
}
- close($temp) || die "Failure writing diff file";
+ close($temp) or die "Failure writing diff file";
- open($temp, ">", $file2) || die "Failure writing diff file";
+ open($temp, ">", $file2) or die "Failure writing diff file";
for(@$secondref) {
my $l = $_;
$l =~ s/\r/[CR]/g;
print $temp $l;
print $temp "\n";
}
- close($temp) || die "Failure writing diff file";
+ close($temp) or die "Failure writing diff file";
my @out = qx(diff -u $file2 $file1 2>$dev_null);
if(!$out[0]) {
$CURLVERSION = $1;
$CURLVERNUM = $CURLVERSION;
$CURLVERNUM =~ s/^([0-9.]+)(.*)/$1/; # leading dots and numbers
- $curl =~ s/^(.*)(libcurl.*)/$1/g || die "Failure determining curl binary version";
+ $curl =~ s/^(.*)(libcurl.*)/$1/g or die "Failure determining curl binary version";
$libcurl = $2;
if($curl =~ /win32|Windows|windows|mingw(32|64)/) {
my $loadfile = $hash{'loadfile'};
if($loadfile) {
- open(my $tmp, "<", $loadfile) || die "Cannot open file $loadfile: $!";
+ open(my $tmp, "<", $loadfile) or die "Cannot open file $loadfile: $!";
@validstdout = <$tmp>;
close($tmp);
#
sub pickrunner {
my ($testnum) = @_;
- scalar(@runnersidle) || die "No runners available";
+ scalar(@runnersidle) or die "No runners available";
return pop @runnersidle;
}
open(my $curlvh, "-|", exerunner() . shell_quote($CURL) . " --version 2>$dev_null") ||
die "could not get curl version!";
my @c = <$curlvh>;
- close($curlvh) || die "could not get curl version!";
+ close($curlvh) or die "could not get curl version!";
# use the first line of output and get the md5 out of it
my $str = md5($c[0]);
$randseed += unpack('S', $str); # unsigned 16-bit value
if($TESTCASES eq "all") {
# Get all commands and find out their test numbers
- opendir(DIR, $TESTDIR) || die "cannot opendir $TESTDIR: $!";
+ opendir(DIR, $TESTDIR) or die "cannot opendir $TESTDIR: $!";
my @cmds = grep { /^test([0-9]+)$/ && -f "$TESTDIR/$_" } readdir(DIR);
closedir(DIR);
# Put an "exec" in front of the command so that the child process
# keeps this child's process ID by being tied to the spawned shell.
- exec("exec $cmd") || die "Cannot exec() $cmd: $!";
+ exec("exec $cmd") or die "Cannot exec() $cmd: $!";
# exec() creates a new process, but ties the existence of the
# new process to the parent waiting perl.exe and sh.exe processes.
# Put an "exec" in front of the command so that the child process
# keeps this child's process ID.
- exec("exec $cmd") || die "Cannot exec() $cmd: $!";
+ exec("exec $cmd") or die "Cannot exec() $cmd: $!";
# exec() should never return back here to this process. We protect
# ourselves by calling die() in case something goes really bad.
if($fakepidfile) {
if(open(my $out, ">", $pidfile)) {
print $out $child . "\n";
- close($out) || die "Failure writing pidfile";
+ close($out) or die "Failure writing pidfile";
logmsg "startnew: $pidfile faked with pid=$child\n" if($verbose);
}
else {
# Put an "exec" in front of the command so that the child process
# keeps this child's process ID by being tied to the spawned shell.
- exec("exec $cmd") || die "Cannot exec() $cmd: $!";
+ exec("exec $cmd") or die "Cannot exec() $cmd: $!";
# exec() creates a new process, but ties the existence of the
# new process to the parent waiting perl.exe and sh.exe processes.
# included by it, which *should* be all headers
sub scanenum {
my ($file) = @_;
- open my $h_in, "-|", "$Cpreprocessor $i$file" || die "Cannot preprocess $file";
+ open my $h_in, "-|", "$Cpreprocessor $i$file" or die "Cannot preprocess $file";
while(<$h_in>) {
if(/enum\s+(\S+\s+)?{/ .. /}/) {
s/^\s+//;
push @syms, $_;
}
}
- close $h_in || die "Error preprocessing $file";
+ close $h_in or die "Error preprocessing $file";
}
sub scanheader {
}
$root = "$root/include/curl";
-opendir(D, $root) || die "Cannot open directory $root: $!\n";
+opendir(D, $root) or die "Cannot open directory $root: $!\n";
my @dir = readdir(D);
closedir(D);
my @out;
foreach my $f (@incs) {
- open H, "<$f" || die;
+ open H, "<$f" or die;
my $first = "";
while(<H>) {
s/CURL_DEPRECATED\(.*"\)//;
}
sub scan_configure {
- opendir(my $m, "$root/m4") || die "Cannot opendir $root/m4: $!";
+ opendir(my $m, "$root/m4") or die "Cannot opendir $root/m4: $!";
my @m4 = grep { /\.m4$/ } readdir($m);
closedir $m;
scanconf("$root/configure.ac");
sub scan_dir {
my ($dir) = @_;
- opendir(my $dh, $dir) || die "Cannot opendir $dir: $!";
+ opendir(my $dh, $dir) or die "Cannot opendir $dir: $!";
my @cfiles = grep { /\.[ch]\z/ && -f "$dir/$_" } readdir($dh);
closedir $dh;
for my $f (sort @cfiles) {
}
}
}
- close H_IN || die "Error preprocessing $file";
+ close H_IN or die "Error preprocessing $file";
}
sub scanheader {
close H;
}
-opendir(my $dh, $incdir) || die "Cannot opendir $incdir: $!";
+opendir(my $dh, $incdir) or die "Cannot opendir $incdir: $!";
my @hfiles = grep { /\.h$/ } readdir($dh);
closedir $dh;
}
# Get header filenames,
-opendir(my $dh, $incdir) || die "Cannot opendir $incdir";
+opendir(my $dh, $incdir) or die "Cannot opendir $incdir";
my @hfiles = grep { /\.h$/ } readdir($dh);
closedir $dh;
close(H);
}
-opendir(my $dh, $curlh) || die "Cannot opendir $curlh: $!";
+opendir(my $dh, $curlh) or die "Cannot opendir $curlh: $!";
my @hfiles = grep { /\.h$/ } readdir($dh);
closedir $dh;
}
# first run the help command
-my @curlout; open(O, '-|', $curl, '-h', $opt) || die; push @curlout, <O>; close(O);
+my @curlout; open(O, '-|', $curl, '-h', $opt) or die; push @curlout, <O>; close(O);
# figure out the short+long option combo using -h all*/
open(C, '-|', $curl, '-h', 'all');
my %enum; # from libcurl-errors.3
sub gettypecheck {
- open(my $f, "<", "$root/include/curl/typecheck-gcc.h") || die "no typecheck file";
+ open(my $f, "<", "$root/include/curl/typecheck-gcc.h") or die "no typecheck file";
while(<$f>) {
chomp;
if($_ =~ /\(option\) == (CURL[^ \)]*)/) {
sub getinclude {
my $f;
- open($f, "<", "$root/include/curl/curl.h") || die "no curl.h";
+ open($f, "<", "$root/include/curl/curl.h") or die "no curl.h";
while(<$f>) {
if($_ =~ /\((CURLOPT[^,]*), (CURLOPTTYPE_[^,]*)/) {
my ($opt, $type) = ($1, $2);
$enum{"CURLOPT_CONV_TO_NETWORK_FUNCTION"}++;
close($f);
- open($f, "<", "$root/include/curl/multi.h") || die "no curl.h";
+ open($f, "<", "$root/include/curl/multi.h") or die "no curl.h";
while(<$f>) {
if($_ =~ /\((CURLMOPT[^,]*), (CURLOPTTYPE_[^,]*)/) {
my ($opt, $type) = ($1, $2);
sub cmdfiles {
my ($dir) = @_;
- opendir(my $dh, $dir) || die "Cannot opendir $dir: $!";
+ opendir(my $dh, $dir) or die "Cannot opendir $dir: $!";
my @opts = grep { /[a-z0-9].*\.md$/ && -f "$dir/$_" } readdir($dh);
closedir $dh;