X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fobjects%2Fobjxref.pl;h=01ecf438f0b6b38416ffa55277d54a4772d03d5d;hp=3fa584036e1e13cb430c742ec08620a4ba1c786f;hb=339638b586e77c189e8294f931b99b03d1f08dbd;hpb=aaa29f9e8354aa8a3a8d33474a28b70a2010ad30 diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl index 3fa584036e..01ecf438f0 100644 --- a/crypto/objects/objxref.pl +++ b/crypto/objects/objxref.pl @@ -1,4 +1,11 @@ -#!/usr/local/bin/perl +#! /usr/bin/env perl +# Copyright 1998-2019 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (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 + use strict; @@ -7,25 +14,28 @@ my %oid_tbl; my ($mac_file, $xref_file) = @ARGV; -open(IN, $mac_file) || die "Can't open $mac_file"; +# The year the output file is generated. +my $YEAR = [localtime()]->[5] + 1900; + +open(IN, $mac_file) || die "Can't open $mac_file, $!\n"; # Read in OID nid values for a lookup table. while () { - chomp; + s|\R$||; # Better chomp my ($name, $num) = /^(\S+)\s+(\S+)$/; $oid_tbl{$name} = $num; } close IN; -open(IN, $xref_file) || die "Can't open $xref_file"; +open(IN, $xref_file) || die "Can't open $xref_file, $!\n"; my $ln = 1; while () { - chomp; + s|\R$||; # Better chomp s/#.*$//; next if (/^\S*$/); my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/; @@ -39,7 +49,8 @@ my @xrkeys = keys %xref_tbl; my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys; -for(my $i = 0; $i <= $#srt1; $i++) +my $i; +for($i = 0; $i <= $#srt1; $i++) { $xref_tbl{$srt1[$i]}[2] = $i; } @@ -54,51 +65,74 @@ my @srt2 = sort return $ap2 - $bp2; } @xrkeys; - -print <