source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZISHMSMU.m@ 785

Last change on this file since 785 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1ZISHMSMU ; IHS/DSM/MFD - HOST COMMANDS FOR UNIX ; [ 06/03/96 10:58 AM ]
2 ;;8.0;KERNEL;;JUL 10, 1995
3 ;
4 ; Excepted from IHS SAC 6.1.5, 6.1.2.2 and 6.1.2.3 memo dated 16Nov93.
5 ;
6 ; Rename to %ZISH in the managers account
7 ;
8OPEN(ZISH1,ZISH2,ZISH3) ; ----- Open unix file.
9 ; S Y=$$OPEN^%ZISH("/directory/","filename","R")
10 ;error 1=no dev
11 ; 2=open new fl with 'R'
12 ; 3=passed fls by ref
13 ; 4=invalid fi len
14 ;
15 ; ---------------------------------------------------------------
16 ; PROGRAMMERS NOTE: IHS/ADC/GTH - 06-03-96
17 ; The VA's K8 version of %ZISH added another parameter to $$OPEN,
18 ; the "handle name" of the file, but put the parameter at the
19 ; beginning of the formal parameter list, instead of at the end,
20 ; causing backwards incompatibility problems.
21 ; This version is the IHS's version, with three parameters.
22 ; ---------------------------------------------------------------
23 ;
24 NEW ZISHDF,ZISHIOP,%ZIS,POP,ZISHQ,IOUPAR
25 ;
26 ; -- Directory format.
27 D DF(.ZISH1)
28 ;
29 ; -- Pass by value, or quit.
30 I $O(ZISH2(0)) S ZISHX=3 Q ZISHX
31 ;
32 ; -- Check filename length.
33 D FL(.ZISH2)
34 I ZISH2=4 Q ZISH2
35 ;
36 S ZISHDF=$S(ZISH1'="":ZISH1_ZISH2,1:ZISH2)
37 ;
38 ; -- Open MSM host.
39 F ZISHIOP=51:1:54 I '$D(IO(1,ZISHIOP)) S IOP=ZISHIOP,%ZIS("IOPAR")="("""_ZISHDF_""":"""_ZISH3_""")" D ^%ZIS Q:'POP
40 I POP Q 1
41 ;
42 ; -- Check new filename with "R" privileges.
43 I ZISH3="R" D
44 .U IO I $ZA=-1 S ZISHQ=2 D ^%ZISC
45 ; Excepted from SAC 6.1.5, 6.1.2.2 and 6.1.2.3 memo dated 16Nov93.
46 ;
47 I '$D(ZISHQ),'$D(ZTQUEUED) U IO(0)
48 Q $S($D(ZISHQ):ZISHQ,1:0)
49 ;
50DEL(ZISH1,ZISH2) ; ----- Delete file(s).
51 ; S Y=$$DEL^%ZISH("/directory/","filename")
52 ; ,.array)
53 NEW ZISHDA,ZISHF,ZISHX,ZISHQ,ZISHDF,ZISHC
54 ;
55 ; -- Directory format.
56 D DF(.ZISH1)
57 ;
58 ; -- Set array if filename(s) passed by value.
59 I '$O(ZISH2(0)) S ZISH2(1)=ZISH2
60 ;
61 ; -- Get filename(s) to act on.
62 ; -- No '*' allowed.
63 F ZISHDA=0:0 S ZISHDA=$O(ZISH2(ZISHDA)) Q:'ZISHDA S ZISHF=ZISH2(ZISHDA) I ZISHF["*" S ZISHX=1,ZISHQ=1 Q
64 I $D(ZISHQ) Q ZISHX
65 F ZISHDA=0:0 S ZISHDA=$O(ZISH2(ZISHDA)) Q:'ZISHDA S ZISHF=ZISH2(ZISHDA) D
66 . I ZISH1'="" S ZISHDF=ZISH1_ZISHF
67 . S ZISHC="rm "_$S(ZISH1'="":ZISHDF,1:ZISHF)
68 . D JW
69 .Q
70 Q ZISHX
71 ;
72FROM(ZISH1,ZISH2,ZISH3,ZISH4,ZISH5) ; ----- Get unix file(s) from.
73 ; S Y=$$FROM^%ZISH("/dir/","fl","mach","qlfr","/dir/")
74 ; "fl*"
75 ; .array
76 Q 20
77 ;
78SEND(ZISH1,ZISH2,ZISH3) ;Send unix fl
79 ; S Y=$$SEND^%ZISH("/dir/","fl","mach")
80 ; "fl*"
81 ; .array
82 NEW ZISH,ZISHPARM
83 S ZISH1=$G(ZISH1) ; If directory not passed, use system.
84 I '$L($G(ZISH2)) Q "-1^<file not specified>"
85 I '$L($G(ZISH3)) Q "-1^<destination not specified>"
86 S Y=$$LIST(.ZISH1,ZISH2,.ZISH2) ; Put array of files in ZISH2()
87 ;I OS=AIX S ZISHPARM="-nc"
88 S ZISHPARM="-nc"
89 ; -n = suppress sending results in UNIX mail message to the user
90 ; -c = pack file(s) with 'compress' before sending
91 ;I OS=SCO S ZISHPARM="-p"
92 ; -p = pack the file before the send request
93 F ZISH=1:1 Q:'$D(ZISH2(ZISH)) S ZISHC="sendto "_ZISHPARM_" "_ZISH3_" "_ZISH1_ZISH2(ZISH) D JW
94 Q ZISHX
95 ;
96LIST(ZISH1,ZISH2,ZISH3) ; ----- Set local array holding filename(s).
97 ; S Y=$$LIST^%ZISH("/dir/","fl",".return array")
98 ; "fl*",
99 ; .array,
100 ;
101 NEW ZISHC,ZISHDA,ZISHDF,ZISHX,ZISHLN,ZISHF,X,Y,POP,ZISHIOP1
102 ;
103 ; -- Directory format.
104 D DF(.ZISH1)
105 ;
106 ; -- Init ZISHAUTO.$J.
107 S ZISHC="rm ZISHAUTO."_$J
108 D JW
109 ;
110 ; -- Set array if filename(s) are passed by value.
111 I '$O(ZISH2(0)) S ZISH2(1)=ZISH2
112 ;
113 ; -- Get filename(s) to act on.
114 ; -- Append listing to ZISHAUTO.$J.
115 F ZISHDA=0:0 S ZISHDA=$O(ZISH2(ZISHDA)) Q:'ZISHDA S ZISHF=ZISH2(ZISHDA) D
116 . S ZISHDF=$S(ZISH1'="":ZISH1_ZISHF,1:ZISHF)
117 . S ZISHC="ls "_ZISHDF_" >> ZISHAUTO."_$J
118 . D JW
119 .Q
120 ;
121 ; -- Open ZISHAUTO.$J to read.
122 ; -- Create the 'Return Array' to pass back to user.
123 S ZISHIOP1=ION_";"_IOST_";"_IOM_";"_IOSL
124 S ZISHX=$$OPEN("/usr/mumps/","ZISHAUTO."_$J,"R")
125 I ZISHX Q ZISHX
126 F ZISHLN=1:1 U IO R X Q:$$STATUS=-1 S ZISH3(ZISHLN)=$P(X,"/",$L(X,"/"))
127 D ^%ZISC
128 S IOP=ZISHIOP1
129 D ^%ZIS
130 ;
131 ; -- Remove ZISHAUTO.$J.
132 S ZISHC="rm ZISHAUTO."_$J
133 D JW
134 ;
135 Q ZISHX
136 ;
137MV(ZISH1,ZISH2,ZISH3,ZISH4) ; ----- Rename a file.
138 ; S Y=$$MV^%ZISH("/from_dir/","from_fl","/to_dir/","to_fl")
139 ;
140 NEW ZISHC,ZISHX
141 ;
142 ; -- Directory format.
143 D DF(.ZISH1)
144 D DF(.ZISH3)
145 ;
146 ; -- Check for pass by value, or quit.
147 I $O(ZISH2(0))!($O(ZISH4(0))) S ZISHX=3 Q ZISHX
148 ;
149 ; -- Check for 'from' and 'to' directory.
150 S ZISH2=$S(ZISH1="":ZISH2,1:ZISH1_ZISH2)
151 S ZISH4=$S(ZISH3="":ZISH4,1:ZISH3_ZISH4)
152 ;
153 S ZISHC="mv "_ZISH2_" "_ZISH4
154 D JW
155 Q ZISHX
156 ;
157PWD(ZISH1) ; ----- Print working directory.
158 ; S Y=$$PWD^%ZISH(.return array)
159 ;
160 ; ---------------------------------------------------------------
161 ; PROGRAMMERS NOTE: IHS/ADC/GTH - 06-03-96
162 ; The VA's K 8 version makes $$PWD a parameter-less extrinsic, which
163 ; makes it backwards incompatible with IHS. This is the IHS's
164 ; version of $$PWD.
165 ; ---------------------------------------------------------------
166 ;
167 NEW %ZIS,POP,X,Y,ZISHC,ZISHDA,ZISHDF,ZISHF,ZISHIOP,ZISHLN,ZISHQ,ZISHX,ZISHSYFI,ZISHIOP1
168 ;
169 ; -- Init ZISHAUTO.$J.
170 S ZISHC="rm ZISHAUTO."_$J
171 D JW
172 ;
173 S ZISHC="pwd > ZISHAUTO."_$J
174 D JW
175 ;
176 ; -- Open ZISHAUTO.$J to read.
177 ; -- Create the 'Return Array' to pass back to user.
178 S ZISHIOP1=ION_";"_IOST_";"_IOM_";"_IOSL
179 S ZISHX=$$OPEN("/usr/mumps/","ZISHAUTO."_$J,"R")
180 I ZISHX Q ZISHX
181 F ZISHLN=1:1 U IO R X Q:$$STATUS=-1 S ZISH1(ZISHLN)=X
182 D ^%ZISC
183 S IOP=ZISHIOP1
184 D ^%ZIS
185 ;
186 ; -- Remove ZISHAUTO.$J.
187 S ZISHC="rm ZISHAUTO."_$J
188 D JW
189 ;
190 Q ZISHX
191 ;
192JW ; -- MSM extrinsic.
193 S ZISHX=$$JOBWAIT^%HOSTCMD(ZISHC)
194 ; Excepted from SAC 6.1.5, 6.1.2.2 and 6.1.2.3 memo dated 16Nov93.
195 Q
196 ;
197DF(X) ; ----- Directory format.
198 Q:X=""
199 S X=$TR(X,"\","/")
200 I $E(X,$L(X))'="/" S X=X_"/"
201 Q
202 ;
203STATUS() ; ----- EndOfFile flag.
204 Q $ZC
205 ; Excepted from SAC 6.1.5, 6.1.2.2 and 6.1.2.3 memo dated 16Nov93.
206 ;
207QL(X) ;Qlfrs
208 Q:X=""
209 S:$E(X)'="-" X="-"_X
210 Q
211 ;
212FL(X) ; ----- Filename length.
213 NEW ZISHP1,ZISHP2
214 S ZISHP1=$P(X,"."),ZISHP2=$P(X,".",2)
215 I $L(ZISHP1)>14 S X=4 Q
216 I $L(ZISHP2)>8 S X=4 Q
217 Q
218 ;
Note: See TracBrowser for help on using the repository browser.