Debian Codegraph @

vms/remove_old_gawk.com

raw
1 $! File: remove_old_gawk.com
2 $!
3 $! This is a procedure to remove the old gawk images that were installed
4 $! by the GNV kits and replace them with links to the new image.
5 $!
6 $! 02-Jan-2014 J. Malmberg Gawk version
7 $!
8 $!==========================================================================
9 $!
10 $vax = f$getsyi("HW_MODEL") .lt. 1024
11 $old_parse = ""
12 $if .not. VAX
13 $then
14 $ old_parse = f$getjpi("", "parse_style_perm")
15 $ set process/parse=extended
16 $endif
17 $!
18 $old_cutils = "gawk,awk,"
19 $!
20 $!
21 $ i = 0
22 $cutils_loop:
23 $ file = f$element(i, ",", old_cutils)
24 $ if file .eqs. "" then goto cutils_loop_end
25 $ if file .eqs. "," then goto cutils_loop_end
26 $ call update_old_image 'file'
27 $ call update_old_image 'file' '[usr.bin]'
28 $ i = i + 1
29 $ goto cutils_loop
30 $cutils_loop_end:
31 $!
32 $!
33 $if .not. VAX
34 $then
35 $ file = "gnv$gnu:[usr.share.man.cat1]awk^.1.gz"
36 $ if f$search(file) .nes. "" then delete 'file';*
37 $ file = "gnv$gnu:[usr.share.man.cat1]gawk^.1.gz"
38 $ if f$search(file) .nes. "" then delete 'file';*
39 $ file = "gnv$gnu:[usr.share.man.cat1]iawk^.1.gz"
40 $ if f$search(file) .nes. "" then delete 'file';*
41 $endif
42 $!
43 $!
44 $if .not. VAX
45 $then
46 $ set process/parse='old_parse'
47 $endif
48 $!
49 $all_exit:
50 $ exit
51 $!
52 $! Remove old image or update it if needed.
53 $!-------------------------------------------
54 $update_old_image: subroutine
55 $!
56 $ file = p1
57 $ fdir = p2
58 $ if fdir .eqs. "" then fdir = "[bin]"
59 $! First get the FID of the new gawk image.
60 $! Don't remove anything that matches it.
61 $ new_gawk = f$search("GNV$GNU:[user.bin]GNV$''file'.EXE")
62 $!
63 $ new_gawk_fid = "No_new_gawk_fid"
64 $ if new_gawk .nes. ""
65 $ then
66 $ new_gawk_fid = f$file_attributes(new_gawk, "FID")
67 $ endif
68 $!
69 $!
70 $!
71 $! Now get check the "''file'." and "''file'.exe"
72 $! May be links or copies.
73 $! Ok to delete and replace.
74 $!
75 $!
76 $ old_gawk_fid = "No_old_gawk_fid"
77 $ old_gawk = f$search("gnv$gnu:''fdir'''file'.")
78 $ old_gawk_exe_fid = "No_old_gawk_fid"
79 $ old_gawk_exe = f$search("gnv$gnu:''fdir'''file'.exe")
80 $ if old_gawk_exe .nes. ""
81 $ then
82 $ old_gawk_exe_fid = f$file_attributes(old_gawk_exe, "FID")
83 $ endif
84 $!
85 $ if old_gawk .nes. ""
86 $ then
87 $ fid = f$file_attributes(old_gawk, "FID")
88 $ if fid .nes. new_gawk_fid
89 $ then
90 $ if fid .eqs. old_gawk_exe_fid
91 $ then
92 $ set file/remove 'old_gawk'
93 $ else
94 $ delete 'old_gawk'
95 $ endif
96 $ if new_gawk .nes. ""
97 $ then
98 $ set file/enter='old_gawk' 'new_gawk'
99 $ endif
100 $ endif
101 $ endif
102 $!
103 $ if old_gawk_exe .nes. ""
104 $ then
105 $ if old_gawk_fid .nes. new_gawk_fid
106 $ then
107 $ delete 'old_gawk_exe'
108 $ if new_gawk .nes. ""
109 $ then
110 $ set file/enter='old_gawk_exe' 'new_gawk'
111 $ endif
112 $ endif
113 $ endif
114 $!
115 $ exit
116 $ENDSUBROUTINE ! Update old image