1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
$! File: gawk_alias_setup.com
$!
$! The PCSI procedure needs a helper script to set up and remove aliases.
$!
$! If p1 starts with "R" then remove instead of install.
$!
$!
$! 02-Jan-2014 J. Malmberg - Gawk Version
$!
$!===========================================================================
$!
$ mode = "install"
$ code = f$extract(0, 1, p1)
$ if code .eqs. "R" .or. code .eqs. "r" then mode = "remove"
$!
$ arch_type = f$getsyi("ARCH_NAME")
$ arch_code = f$extract(0, 1, arch_type)
$!
$ if arch_code .nes. "V"
$ then
$ set proc/parse=extended
$ endif
$!
$!
$ call do_alias "gawk" "[bin]"
$ call do_alias "gawk" "[bin]" "awk"
$ call do_alias "gawk" "[bin]" "gawk" "[usr.bin]"
$ call do_alias "gawk" "[bin]" "awk" "[usr.bin]"
$ call do_alias "gawk.1" "[usr.share.man.man1]" "awk.1"
$!
$ exit
$!!
$!
$do_alias: subroutine
$ if mode .eqs. "install"
$ then
$ call add_alias "''p1'" "''p2'" "''p3'" "''p4'"
$ else
$ call remove_alias "''p1'" "''p2'" "''p3'" "''p4'"
$ endif
$ exit
$ENDSUBROUTINE ! do_alias
$!
$!
$! P1 is the filename, p2 is the directory prefix,
$! p3 is the alias name if different than p1
$! p4 is the alias directory if different than p2
$add_alias: subroutine
$ if p3 .eqs. "" then p3 = p1
$ if p4 .eqs. "" then p4 = p2
$ ftype = f$element(1, ".", p1)
$ if ftype .eqs. "."
$ then
$ file = "gnv$gnu:''p2'gnv$''p1'.EXE"
$ alias = "gnv$gnu:''p4'''p3'."
$ else
$ file = "gnv$gnu:''p2'''p1'"
$ alias = "gnv$gnu:''p4'''p3'"
$ endif
$ if f$search(file) .nes. ""
$ then
$ if f$search(alias) .eqs. ""
$ then
$ set file/enter='alias' 'file'
$ endif
$ alias1 = alias + "exe"
$ if (ftype .eqs. ".") .and. (f$search(alias1) .eqs. "")
$ then
$ set file/enter='alias1' 'file'
$ endif
$ endif
$ exit
$ENDSUBROUTINE ! add_alias
$!
$remove_alias: subroutine
$ if p3 .eqs. "" then p3 = p1
$ if p4 .eqs. "" then p4 = p2
$ ftype = f$element(1, ".", p1)
$ if ftype .eqs. "."
$ then
$ file = "gnv$gnu:''p2'''p1'.EXE"
$ alias = "gnv$gnu:''p4'''p3'."
$ else
$ file = "gnv$gnu:''p2'''p1'"
$ alias = "gnv$gnu:''p4'''p3'"
$ endif
$ file_fid = "No_file_fid"
$ if f$search(file) .nes. ""
$ then
$ fid = f$file_attributes(file, "FID")
$ if f$search(alias) .nes. ""
$ then
$ afid = f$file_attributes(alias, "FID")
$ if (afid .eqs. fid)
$ then
$ set file/remove 'alias';
$ endif
$ endif
$ alias1 = alias + "exe"
$ if (ftype .eqs. ".") .and. (f$search(alias1) .nes. "")
$ then
$ afid = f$file_attributes(alias1, "FID")
$ if (afid .eqs. fid)
$ then
$ set file/remove 'alias1';
$ endif
$ endif
$ endif
$ exit
$ENDSUBROUTINE ! remove_alias
|