X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fobjects%2Fobjxref.pl;h=01ecf438f0b6b38416ffa55277d54a4772d03d5d;hb=339638b586e77c189e8294f931b99b03d1f08dbd;hp=4a42924c56a6b112795c5842c04914cedc84e748;hpb=babb379849ffb4112792f266f92e9ebb2bd35332;p=openssl.git diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl index 4a42924c56..01ecf438f0 100644 --- a/crypto/objects/objxref.pl +++ b/crypto/objects/objxref.pl @@ -1,24 +1,41 @@ -#!/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 -open IN, "obj_mac.num"; + +use strict; + +my %xref_tbl; +my %oid_tbl; + +my ($mac_file, $xref_file) = @ARGV; + +# 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, "obj_xref.txt"; +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+)/; @@ -32,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; } @@ -47,51 +65,74 @@ my @srt2 = sort return $ap2 - $bp2; } @xrkeys; - -print <