Documentation processor in perl, for platforms that don't have sh
[openssl.git] / util / extract-names.pl
1 #! /usr/bin/env perl
2 # Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9
10 $/ = "";                        # Eat a paragraph at once.
11 while(<STDIN>) {
12     s|\R$||;
13     s/\n/ /gm;
14     if (/^=head1 /) {
15         $name = 0;
16     } elsif ($name) {
17         if (/ - /) {
18             s/ - .*//;
19             s/,\s+/,/g;
20             s/\s+,/,/g;
21             s/^\s+//g;
22             s/\s+$//g;
23             s/\s/_/g;
24             push @words, split ',';
25         }
26     }
27     if (/^=head1 *NAME *$/) {
28         $name = 1;
29     }
30 }
31
32 print join("\n", @words),"\n";
33