01431f4aac19fc2ee3a751eb8c58f82f3f461eff
[openssl.git] / test / tverify.com
1 $! TVERIFY.COM
2 $
3 $       __arch := VAX
4 $       if f$getsyi("cpu") .ge. 128 then -
5            __arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
6 $       if __arch .eqs. "" then __arch := UNK
7 $!
8 $       line_max = 255 ! Could be longer on modern non-VAX.
9 $       temp_file_name = "certs_"+ f$getjpi( "", "PID")+ ".tmp"
10 $       exe_dir := sys$disk:[-.'__arch'.exe.apps]
11 $       cmd = "mcr ''exe_dir'openssl verify ""-CAfile"" ''temp_file_name'"
12 $       cmd_len = f$length( cmd)
13 $       pems = "[-.certs...]*.pem"
14 $!
15 $!      Concatenate all the certificate files.
16 $!
17 $       copy /concatenate 'pems' 'temp_file_name'
18 $!
19 $!      Loop through all the certificate files.
20 $!
21 $       args = ""
22 $       old_f :=
23 $ loop_file: 
24 $           f = f$search( pems)
25 $           if ((f .nes. "") .and. (f .nes. old_f))
26 $           then
27 $             old_f = f
28 $!
29 $!            If this file name would over-extend the command line, then
30 $!            run the command now.
31 $!
32 $             if (cmd_len+ f$length( args)+ 1+ f$length( f) .gt. line_max)
33 $             then
34 $                if (args .eqs. "") then goto disaster
35 $                'cmd''args'
36 $                args = ""
37 $             endif
38 $!            Add the next file to the argument list.
39 $             args = args+ " "+ f
40 $          else
41 $!            No more files in the list
42 $             goto loop_file_end
43 $          endif
44 $       goto loop_file
45 $       loop_file_end:
46 $!
47 $!      Run the command for any left-over arguments.
48 $!
49 $       if (args .nes. "")
50 $       then
51 $          'cmd''args'
52 $       endif
53 $!
54 $!      Delete the temporary file.
55 $!
56 $       if (f$search( "''temp_file_name';*") .nes. "") then -
57          delete 'temp_file_name';*
58 $!
59 $       exit
60 $!
61 $       disaster:
62 $       write sys$output "   Command line too long.  Doomed."
63 $!