backwardify.pl 900 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/perl -w
  2. use strict;
  3. # Use as $0
  4. # Use as $0 -noname
  5. my $did_library;
  6. my $did_description;
  7. my $do_exports;
  8. my @imports;
  9. my $noname = (@ARGV and $ARGV[0] eq '-noname' and shift);
  10. while (<>) {
  11. unless ($did_library) {
  12. s/\b(cryptssl)\b/crypto/ and $did_library = $1 if /^LIBRARY\s+cryptssl\b/;
  13. s/\b(open_ssl)\b/ssl/ and $did_library = $1 if /^LIBRARY\s+open_ssl\b/;
  14. }
  15. unless ($did_description) {
  16. s&^(DESCRIPTION\s+(['"])).*&${1}\@#www.openssl.org/:#\@forwarder DLL for pre-0.9.7c+ OpenSSL to the new dll naming scheme$2& and $did_description++;
  17. }
  18. if ($do_exports) {{
  19. last unless /\S/;
  20. warn, last unless /^ \s* ( \w+ ) \s+ \@(\d+)\s*$/x;
  21. push @imports, [$1, $2];
  22. s/$/ NONAME/ if $noname;
  23. }}
  24. $do_exports++ if not $do_exports and /^EXPORTS/;
  25. print $_;
  26. }
  27. print "IMPORTS\n";
  28. for my $imp (@imports) {
  29. print "\t$imp->[0]=$did_library.$imp->[1]\n";
  30. }