Import of old SSLeay release: SSLeay 0.8.1b
[openssl.git] / util / up_ver.pl
1 #!/usr/local/bin/perl
2 #
3 # Up the version numbers in the files.
4 #
5
6 @files=(
7         "crypto/des/ecb_enc.c",
8         "crypto/idea/i_ecb.c",
9         "crypto/lhash/lhash.c",
10         "crypto/conf/conf.c",
11         "crypto/md/md2_dgst.c",
12         "crypto/md/md5_dgst.c",
13         "crypto/pem/pem_lib.c",
14         "crypto/bn/bn_lib.c",
15         "crypto/dh/dh_lib.c",
16         "crypto/rc4/rc4_enc.org",
17         "crypto/rc2/rc2_ecb.c",
18         "crypto/bf/bf_ecb.c",
19         "crypto/rsa/rsa_lib.c",
20         "crypto/dsa/dsa_lib.c",
21         "crypto/sha/sha1dgst.c",
22         "crypto/sha/sha_dgst.c",
23         "crypto/asn1/asn1_lib.c",
24         "crypto/x509/x509_vfy.c",
25         "crypto/evp/evp_enc.c",
26         "crypto/rand/md_rand.c",
27         "crypto/stack/stack.c",
28         "crypto/txt_db/txt_db.c",
29         "crypto/cversion.c",
30         "ssl/ssl_lib.c",
31         "ssl/s2_lib.c",
32         "ssl/s3_lib.c",
33         "README",
34         );
35
36 @month=('Jan','Feb','Mar','Apr','May','Jun',
37         'Jul','Aug','Sep','Oct','Nov','Dec');
38 @a=localtime(time());
39 $time=sprintf("%02d-%s-%04d",$a[3],$month[$a[4]],$a[5]+1900);
40
41 $ver=$ARGV[0];
42 ($ver ne "") || die "no version number specified\n";
43
44 foreach $file (@files)
45         {
46         open(IN,"<$file") || die "unable to open $file:$!\n";
47         open(OUT,">$file.new") || die "unable to open $file.new:$!\n";
48         $found=0;
49
50         print STDERR "$file:";
51
52         while (<IN>)
53                 {
54                 if (s/SSLeay \d\.\d.\d[^"]*(\"|\s)/SSLeay $ver $time\1/)
55                         {
56                         print STDERR " Done";
57                         $found++;
58                         print OUT;
59                         while (<IN>) { print OUT; }
60                         last;
61                         }
62                 print OUT;
63                 }
64         print STDERR "\n";
65         close(IN);
66         close(OUT);
67         (!$found) && die "unable to update the version number in $file\n";
68         rename($file,"$file.old") || die "unable to rename $file:$!\n";
69         rename("$file.new",$file) || die "unable to rename $file.new:$!\n";
70         }