1$!                                              28 December 2006.  SMS.
2$!
3$! Info-ZIP VMS accessory procedure.
4$!
5$! Find the BZIP2 object library under P1, starting in the [.'P2']
6$! destination directory.  (We assume, initially, that the BZIP2
7$! directory has a destination directory structure like ours.)
8$!
9$! Set the P4 logical name to the directory where it was found.
10$! P5 and P6 may be used for qualifiers on the DEFINE command.
11$!
12$ bz_orig = p1
13$ dest = p2
14$ libbz2 = p3
15$!
16$! Remove any trailing colon, to allow logical name translation.
17$!
18$ bz_dev_dir = ""
19$ bz_base = bz_orig
20$ if (f$extract( (f$length( bz_base)- 1), 1, bz_base) .eqs. ":")
21$ then
22$     bz_base = bz_base- ":"
23$ endif
24$!
25$ bz_base_eqv = f$trnlnm( bz_base)
26$ if (bz_base_eqv .nes. "")
27$ then
28$     bz_orig = bz_base_eqv
29$     bz_base = bz_base_eqv
30$ endif
31$ bz_base = bz_base- "]"
32$!
33$! Candidate 1 = the actual analogue destination directory.
34$!
35$ bz_dev_dir_cand = bz_base+ "."+ dest+ "]"
36$ lib_cand = bz_dev_dir_cand+ libbz2
37$ if (f$search( lib_cand) .nes. "")
38$ then
39$     bz_dev_dir = bz_dev_dir_cand
40$ else
41$!
42$!     Candidate 2 = the actual analogue destination directory + "L".
43$!
44$     bz_dev_dir_cand = bz_base+ "."+ dest+ "L]"
45$     lib_cand = bz_dev_dir_cand+ libbz2
46$     if (f$search( lib_cand) .nes. "")
47$     then
48$         bz_dev_dir = bz_dev_dir_cand
49$     else
50$!
51$!         Candidate 3 = the actual user-specified directory.
52$!
53$         bz_dev_dir_cand = bz_orig
54$         lib_cand = bz_dev_dir_cand+ libbz2
55$         if (f$search( lib_cand) .nes. "")
56$         then
57$             bz_dev_dir = bz_dev_dir_cand
58$         endif
59$     endif
60$ endif
61$!
62$ if (bz_dev_dir .nes. "")
63$ then
64$     if (p4 .eqs. "")
65$     then
66$         write sys$output bz_dev_dir
67$     else
68$         define 'p5' 'p4' 'bz_dev_dir' 'p6'
69$     endif
70$ endif
71$!
72