Add missing funtions from non ANSI section of header files and add missing
[openssl.git] / util / ssldir.pl
1 #!/usr/local/bin/perl
2
3 $#ARGV == 0 || die "usage: ssldir.pl /new/path\n";
4 @files=('crypto/cryptlib.h',
5         'Makefile.ssl',
6         'tools/c_rehash',
7         'util/mk1mf.pl',
8         );
9
10 %cryptlib=(
11         '\sX509_CERT_AREA\s',"#define X509_CERT_AREA\t\t".'"%s"',
12         '\sX509_CERT_DIR\s', "#define X509_CERT_DIR\t\t".'"%s/certs"',
13         '\sX509_CERT_FILE\s', "#define X509_CERT_FILE\t\t".'"%s/cert.pem"',
14         '\sX509_PRIVATE_DIR\s',"#define X509_PRIVATE_DIR\t".'"%s/private"',
15         );
16
17 %Makefile_ssl=(
18         '^INSTALLTOP=','INSTALLTOP=%s',
19         );
20
21 %c_rehash=(
22         '^DIR=',        'DIR=%s',
23         );
24
25 %mk1mf=(
26         '^\$INSTALLTOP=','$INSTALLTOP="%s";',
27         );
28
29 &dofile("crypto/cryptlib.h",$ARGV[0],%cryptlib);
30 &dofile("Makefile.ssl",$ARGV[0],%Makefile_ssl);
31 &dofile("tools/c_rehash",$ARGV[0],%c_rehash);
32 &dofile("util/mk1mf.pl",$ARGV[0],%mk1mf);
33
34 sub dofile
35         {
36         ($f,$p,%m)=@_;
37
38         open(IN,"<$f") || die "unable to open $f:$!\n";
39         @a=<IN>;
40         close(IN);
41         foreach $k (keys %m)
42                 {
43                 grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
44                 }
45         ($ff=$f) =~ s/\..*$//;
46         open(OUT,">$ff.new") || die "unable to open $f:$!\n";
47         print OUT @a;
48         close(OUT);
49         rename($f,"$ff.bak") || die "unable to rename $f\n";
50         rename("$ff.new",$f) || die "unable to rename $ff.new\n";
51         }
52