TLSProxy/Proxy.pm: bind s_server to loopback interface.
[openssl.git] / crypto / objects / objects.pl
index b9e8890b461e0fe867cdac74266ee0b425b3ab6f..8f9b67f95991ad015a5e26e4874f72a3d7de269a 100644 (file)
@@ -1,12 +1,17 @@
 #! /usr/bin/env perl
-# Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
 # in the file LICENSE in the source distribution or at
 # https://www.openssl.org/source/license.html
 
-# Output year depends on the year of the script and the input files.
+use Getopt::Std;
+
+our($opt_n);
+getopts('n');
+
+# Output year depends on the year of the script and the input file.
 my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900;
 my $iYEAR = [localtime([stat($ARGV[0])]->[9])]->[5] + 1900;
 $YEAR = $iYEAR if $iYEAR > $YEAR;
@@ -123,15 +128,15 @@ print STDERR "Added OID $Cname\n";
        }
 close IN;
 
-open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
-foreach (sort { $a <=> $b } keys %nidn)
-       {
-       print NUMOUT $nidn{$_},"\t\t",$_,"\n";
-       }
-close NUMOUT;
+if ( $opt_n ) {
+    foreach (sort { $a <=> $b } keys %nidn)
+            {
+            print $nidn{$_},"\t\t",$_,"\n";
+            }
+    exit;
+}
 
-open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
-print OUT <<"EOF";
+print <<"EOF";
 /*
  * WARNING: do not edit!
  * Generated by crypto/objects/objects.pl
@@ -161,15 +166,13 @@ sub expand
 foreach (sort { $a <=> $b } keys %ordern)
        {
        $Cname=$ordern{$_};
-       print OUT "\n";
-       print OUT expand("#define SN_$Cname\t\t\"$sn{$Cname}\"\n") if $sn{$Cname} ne "";
-       print OUT expand("#define LN_$Cname\t\t\"$ln{$Cname}\"\n") if $ln{$Cname} ne "";
-       print OUT expand("#define NID_$Cname\t\t$nid{$Cname}\n") if $nid{$Cname} ne "";
-       print OUT expand("#define OBJ_$Cname\t\t$obj{$Cname}\n") if $obj{$Cname} ne "";
+       print "\n";
+       print expand("#define SN_$Cname\t\t\"$sn{$Cname}\"\n") if $sn{$Cname} ne "";
+       print expand("#define LN_$Cname\t\t\"$ln{$Cname}\"\n") if $ln{$Cname} ne "";
+       print expand("#define NID_$Cname\t\t$nid{$Cname}\n") if $nid{$Cname} ne "";
+       print expand("#define OBJ_$Cname\t\t$obj{$Cname}\n") if $obj{$Cname} ne "";
        }
 
-close OUT;
-
 sub process_oid
        {
        local($oid)=@_;