summaryrefslogtreecommitdiffstats
path: root/crypto/s390xcpuid.pl
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/s390xcpuid.pl')
-rwxr-xr-xcrypto/s390xcpuid.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/s390xcpuid.pl b/crypto/s390xcpuid.pl
index 0bb1004245..36f742068b 100755
--- a/crypto/s390xcpuid.pl
+++ b/crypto/s390xcpuid.pl
@@ -6,7 +6,10 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
-$flavour = shift;
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /3[12]/) {
$SIZE_T=4;
@@ -16,8 +19,7 @@ if ($flavour =~ /3[12]/) {
$g="g";
}
-while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
-open STDOUT,">$output";
+$output and open STDOUT,">$output";
$ra="%r14";
$sp="%r15";