-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBreak.aplf
50 lines (50 loc) · 1.51 KB
/
Break.aplf
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
msg←Break nss;names
;ns;linked;broken;missing;mask;⎕IO;there;n;parents
:If U.debug=2
(1+⊃⎕LC)⎕STOP⊃⎕SI
:EndIf
:Trap DEBUG↓0
:If ×⎕NC'⎕SE.Link.Links'
⎕SE.Link.Links/⍨←0≠⎕NC ⎕SE.Link.Links.ns
:AndIf ×≢⎕SE.Link.Links
⎕IO←1
there←⊃⌽2⍴⎕RSI↓⍨⎕XSI(∊⍨ׯ1+⍳)⊂'⎕SE.UCMD' ⍝ DO WE NEED TO DO THIS ELSEWHERE???
:If 2<10|⎕DR nss
nss←there{
''≢0⍴⍵:⍵
9≠⍺.⎕NC ⍵::⍵
⍺⍎⍵
}¨nss
:Else
nss←there⍎nss
:EndIf
linked←⍎¨⎕SE.Link.Links.ns
broken←0⍴⊂''
missing←0⍴⊂''
n←0
:For ns :In nss
mask←linked≠ns
:If 0∊mask
parents←⍕¨U.GetInfos'parent'
names←parents,¨'.',¨U.GetInfos'name'
n+←U.RemoveInfos names/⍨ns∘(⊃⍷)¨names
⎕SE.Link.Links/⍨←mask
broken,←⊂ns
:Else
missing,←⊂ns
:EndIf
:EndFor
msg←0⍴⊂''
:If ×≢broken
msg,←⊂'Unlinked ',(⍕n),' files:',U.List broken
:EndIf
:If ×≢missing
msg,←⊂'Not found:',U.List missing
:EndIf
msg←⊃{⍺,'; ',⍵}/msg
:Else
msg←'No active links'
:EndIf
:Else
U.Resignal 1
:EndTrap