diff options
Diffstat (limited to 'crypto/objects/objects.pl')
-rw-r--r-- | crypto/objects/objects.pl | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/crypto/objects/objects.pl b/crypto/objects/objects.pl index 20f726d44f..8f9b67f959 100644 --- a/crypto/objects/objects.pl +++ b/crypto/objects/objects.pl @@ -6,7 +6,12 @@ # 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)=@_; |