Merge lp://staging/~jeff-apple/openvista-gtm-integration/bug322986m into lp://staging/openvista-gtm-integration

Proposed by jeff.apple
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~jeff-apple/openvista-gtm-integration/bug322986m
Merge into: lp://staging/openvista-gtm-integration
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~jeff-apple/openvista-gtm-integration/bug322986m
Reviewer Review Type Date Requested Status
Jon Tai Approve
Review via email: mp+5508@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jon Tai (jontai) wrote :

I think we can remove line 43 (the commented out ZSYSTEM call) if line 42 works.

Is there any reason A="TEST1"? It probably works fine, but upon reading that code, I'm left wondering what the intention of the code is. Can we change it to something that doesn't suggest the code is unproven?

review: Needs Fixing
9. By jeff.apple

Simplify code

Revision history for this message
jeff.apple (jeff-apple) wrote :

> I think we can remove line 43 (the commented out ZSYSTEM call) if line 42
> works.
>
> Is there any reason A="TEST1"? It probably works fine, but upon reading that
> code, I'm left wondering what the intention of the code is. Can we change it
> to something that doesn't suggest the code is unproven?

Agreed and committed. Do I need to "request another review"?

Revision history for this message
Jon Tai (jontai) wrote :

I don't think so... I just changed my review to Approve. It looks good; go ahead and commit.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'mumps/ZOSVGUX.m'
--- mumps/ZOSVGUX.m 1970-01-01 00:00:00 +0000
+++ mumps/ZOSVGUX.m 2009-04-14 03:03:11 +0000
@@ -0,0 +1,255 @@
1%ZOSV ;SFISC/AC,PUG/TOAD,HOU/DHW,MSC/JDA - View commands & special functions. ;09/03/2003 15:34
2 ;;8.0;KERNEL;**275,MSC**;Jul 10, 1995
3 ;
4ACTJ() ; # active jobs
5 Q $G(^XUTL("XUSYS",0))
6 ;This would also work
7 N %FILE S %FILE=$$TEMP_"zosv_actj_"_$J_".tmp"
8 ZSYSTEM "ps cef -C mumps|wc>"_%FILE
9 N %I S %I=$I
10 O %FILE
11 U %FILE R Y U %I
12 C %FILE:DELETE
13 F Q:$E(Y)'=" " S $E(Y)=""
14 S Y=Y-1
15 Q Y
16 ;
17RTNDIR() ; primary routine source directory
18 ;Assume /home/xxx/o(/home/xxx/r /home/gtm)
19 Q $P($S($ZRO["(":$P($P($ZRO,"(",2),")"),1:$ZRO)," ")_"/"
20 ;
21TEMP() ; Return path to temp directory
22 ;N %TEMP S %TEMP=$P($$RTNDIR," "),%TEMP=$P(%TEMP,"/",1,$L(%TEMP,"/")-2)_"/t/"
23 Q $G(^%ZOSF("TMP"),"/tmp/")
24 ;
25AVJ() ; # available jobs
26 Q $G(^%ZTSCH("MAXJOBS"),1000)-$$ACTJ
27 ;
28PASSALL ;
29 U $I:(PASTHRU) Q ; <=====
30NOPASS ;
31 U $I:(NOPASTHRU) Q ; <=====
32 ;
33GETPEER() ;Get the IP address of a connection peer
34 Q $S($L($G(IO("GTM-IP"))):IO("GTM-IP"),1:"")
35 ;
36LOG(MSG,PRIORITY,TAG)
37 NEW CMD
38 S CMD="logger"
39 S:$G(PRIORITY)'="" CMD=CMD_" -p "_PRIORITY
40 S:$G(TAG)'="" CMD=CMD_" -t "_TAG
41 S CMD=CMD_" -- "_MSG
42 S A="TEST1" OPEN A:(COMM=CMD)::"PIPE" U A C A
43 ;ZSYSTEM CMD
44 Q
45PRGMODE ; <=====
46 N USER,PASS,ISOK,LOGTEXT,RDIR
47 D INITKB^XGF()
48 W "System user name: "
49 S USER=$$READ^XGF() Q:USER="^"
50 X ^%ZOSF("EOFF")
51 W !,"System password: "
52 S PASS=$$READ^XGF()
53 X ^%ZOSF("EON") Q:PASS=U
54 W !
55 S ISOK=$$AUTH(USER,PASS)
56 S RDIR=$$RTNDIR^%ZOSV
57 S LOGTEXT=$S(ISOK:"Granted",1:"Denied")_" programmer mode in "
58 S LOGTEXT=LOGTEXT_$P(RDIR,"/",$L(RDIR,"/")-2) ; instance
59 S LOGTEXT=LOGTEXT_" to "_USER ; Unix acct name
60 S LOGTEXT=LOGTEXT_" from "_$P($ZTRNLNM("SSH_CLIENT")," ",1) ; remote loc
61 S LOGTEXT=LOGTEXT_" logged in as "_$$GET1^DIQ(200,DUZ,.01) ; VistA user
62 D LOG(LOGTEXT,"authpriv.info","OpenVista")
63 I 'ISOK W "??",*7 Q
64 D LOGOPT^XQ12 ;keep in option audit.
65 K XMB,XMTEXT,XMY S XMB="XUPROGMODE",XMB(1)=DUZ,XMB(2)=$I D ^XMB:$L($T(^XMB)) D BYE^XUSCLEAN K ZTPAC,X,XMB
66 ;D UCI S XUCI=Y,XQZ="PRGM^ZUA[MGR]",XUSLNT=1 D DO^%XUCI
67 F BREAK
68 HALT
69 ;
70PROGMODE() ; <=====
71 Q 1 ; until we fix this, we're never in application mode
72 ;
73AUTH(USER,PASS) ;
74 Q $&openvista.dopam($G(USER),$G(PASS),"openvista")
75UCI ;
76 S Y=^%ZOSF("PROD") Q
77 ;
78UCICHECK(X) ;
79 Q X
80 ;
81JOBPAR ; <=====
82 N %FILE S %FILE=$$PWD^%ZISH_"zosv_jobpar_"_$J_".tmp"
83 ZSYSTEM "ps c -p "_X_"|tail -1>"_%FILE
84 N %I S %I=$I
85 O %FILE
86 U %FILE R Y U %I
87 C %FILE:DELETE
88 F Q:$E(Y)'=" " S $E(Y)=""
89 I +Y=X,$E(Y,$L(Y)-4,$L(Y))="mumps" S Y="VAH,ROU"
90 E S Y=""
91 Q
92 ;
93PRIORITY ; <=====
94 K Y ; Wally has this disabled in general, but I'd like to bring it back
95 Q
96 ;
97PRIINQ() ; <=====
98 Q 5 ; for now, we're always middle of the road
99 ;
100BAUD S X="UNKNOWN" Q
101 ;
102LGR() ; Last global reference ($REFERENCE)
103 Q $R
104 ;
105EC() ; Error Code: returning $ZS in format more like $ZE from DSM
106 N %ZE
107 I $ZS="" S %ZE=""
108 S %ZE=$P($ZS,",",2)_","_$P($ZS,",",4)_","_$P($ZS,",")_",-"_$P($ZS,",",3)
109 Q %ZE
110 ;
111DOLRO ;SAVE ENTIRE SYMBOL TABLE IN LOCATION SPECIFIED BY X
112 S Y="%" F S Y=$O(@Y) Q:Y="" D ;code from DEC
113 . I $D(@Y)#2 S @(X_"Y)="_Y)
114 . I $D(@Y)>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
115 K %X,%Y,Y Q
116 ;
117ORDER ;SAVE PARTS OF SYMBOL TABLE IN LOCATION SPECIFIED BY X
118 ;PARTS INDICATED BY X1("NAMESPACE*")="" ARRAY
119 I $D(X1("*"))#2 D DOLRO Q
120 S X1="" F S X1=$O(X1(X1)) Q:X1="" D
121 . S (Y,Y1)=$P(X1,"*") I $D(@Y)=0 F S Y=$O(@Y) Q:Y=""!(Y[Y1)
122 . Q:Y="" S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
123 . F S Y=$O(@Y) Q:Y=""!(Y'[Y1) S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
124 K %,%X,%Y,Y,Y1
125 Q
126 ;
127PARSIZ ;
128 S X=3 Q
129 ;
130NOLOG ;
131 S Y=0 Q
132 ;
133GETENV ;Get environment Return Y='UCI^VOL^NODE^BOX LOOKUP'
134 N %HOST,%V S %V=^%ZOSF("PROD"),%HOST=$$RETURN("hostname -s")
135 S Y=$TR(%V,",","^")_"^"_%HOST_"^"_$P(%V,",",2)_":"_%HOST
136 Q
137 ;
138VERSION(X) ;return OS version, X=1 - return OS
139 Q $S($G(X):$P($ZV," V"),1:+$P($ZV," V",2))
140 ;
141SETNM(X) ;Set name, Trap dup's, Fall into SETENV
142 N $ETRAP S $ETRAP="S $ECODE="""" Q"
143 ;
144SETENV ;Set environment X='PROCESS NAME^ '
145 S ^XUTL("XUSYS",$J,0)=$H,^("NM")=X ; workaround
146 Q
147 ;
148SID() ;System ID
149 N J1,T S T="~"
150 S J1(1)=$ZROUTINES,J1(1)=$P(J1(1)," ")
151 S J1(2)=$ZGBLDIR
152 Q "1~"_J1(1)_T_J1(2)
153 ;
154T0 ; start RT clock <=====
155 Q ; we don't have $ZH on GT.M
156 ;
157T1 ; store RT datum w/ZHDIF <=====
158 Q ; we don't have $ZH on GT.M
159 ;
160ZHDIF ;Display dif of two $ZH's <=====
161 W !," CPU=",$J($P(%ZH1,",")-$P(%ZH0,","),6,2)
162 W ?14," ET=",$J($P(%ZH1,",",2)-$P(%ZH0,",",2),6,1)
163 W ?27," DIO=",$J($P(%ZH1,",",7)-$P(%ZH0,",",7),5)
164 W ?40," BIO=",$J($P(%ZH1,",",8)-$P(%ZH0,",",8),5),! ; so far this won't be called
165 Q
166 ;
167 ;Code moved to %ZOSVKR, Comment out if needed.
168LOGRSRC(OPT,TYPE,STATUS) ;record resource usage in ^XTMP("KMPR"
169 Q:'$G(^%ZTSCH("LOGRSRC")) ; quit if RUM not turned on.
170 ; call to RUM routine.
171 D RU^%ZOSVKR($G(OPT),$G(TYPE),$G(STATUS))
172 Q
173 ;
174SETTRM(X) ;Turn on specified terminators.
175 U $I:(TERM=X)
176 Q 1
177 ;
178DEVOK ;
179 ;use lsof (list open files)
180 ; given a device name in X
181 ;INPUT: X=Device $I, X1=IOT -- X1 needed for resources
182 ;OUTPUT: Y=0 if available, Y=job # if owned
183 ; Y=-1 if device does not exists.
184 ; return Y=0 if not owned, Y=$J of owning job, Y=999 if dev cycling
185 ;
186 I $G(X1)="RES" G RESOK^%ZIS6
187 S Y=0
188 Q ;Let ZIS deal with it.
189 ;
190 N %FILE S %FILE=$$TEMP_"zosv_devok_"_$J_".tmp"
191 ZSYSTEM "/usr/sbin/lsof -F Pc "_X_" >"_%FILE
192 N %I,%X,%Y S %I=$I
193 O %FILE
194 N %I,%X,%Y S %I=$I
195 U %FILE
196 F %Y=0:1 R %X Q:%X="" Q:%X["lsof: status error" D
197 . S %Y(%Y\2,$S($E(%X)="p":"PID",$E(%X)="c":"CMD",1:"?"))=$E(%X,2,$L(%X))
198 U %I
199 C %FILE:(DELETE)
200 I %X["lsof: status error" S Y=-1 Q
201 S %X="",Y=0
202 F S %X=$O(%Y(%X)) Q:%X="" I %Y(%X,"CMD")="mumps" S Y=%Y(%X,"PID") Q
203 Q
204 ;
205PIDOPN ; give a list of of all JOBS that have the current device open
206 ; returns comma separated in Y
207 N %FILE S %FILE=$$TEMP_"zosv_pidopn_"_$J_".tmp"
208 ZSYSTEM "lsof -F Pc "_$I_" >"_%FILE
209 N %I,%X,%Y S %I=$I
210 O %FILE
211 N %I,%X,%Y S %I=$I
212 U %FILE
213 F %Y=0:1 R %X Q:%X="" S %Y(%Y\2,$S($E(%X)="p":"PID",$E(%X)="c":"CMD",1:"?"))=$E(%X,2,$L(%X))
214 U %I
215 C %FILE:(DELETE)
216 S (Y,%X)="" F S %X=$O(%Y(%X)) Q:%X="" I %Y(%X,"CMD")="mumps" S Y=Y_","_%Y(%X,"PID")
217 Q
218 ;
219DEVOPN ;List of Devices opened
220 ;Returns variable Y. Y=Devices owned separated by a comma
221 ; ZSHOW "D":Y
222 N %FILE S %FILE=$$TEMP_"zosv_devopn_"_$J_".tmp"
223 ZSYSTEM "lsof -F n -p "_$J_" >"_%FILE
224 N %I,%X,%Y S %I=$I
225 O %FILE
226 U %FILE
227 F %Y=0:1 R %X Q:%X="" S %Y($S($E(%X)="p":"PID",$E(%X)="n":%Y,1:"?"))=$E(%X,2,$L(%X))
228 U %I
229 C %FILE:(DELETE)
230 I %Y("PID")'=$J S Y="" Q
231 I $D(%Y("?")) S Y="" Q
232 K %Y("PID"),%Y("?")
233 S (Y,%X)="" F S %X=$O(%Y(%X)) Q:%X="" S Y=Y_","_%Y(%X)
234 Q
235 ;
236RETURN(%COMMAND) ; ** Private Entry Point: execute a shell command & return the resulting value **
237 ;
238 ; %COMMAND is the string value of the Linux command
239 N %VALUE S %VALUE="" ; value to return
240 N %FILE S %FILE=$$TEMP_"RET"_$J_".txt" ; temporary results file
241 ZSYSTEM %COMMAND_" > "_%FILE ; execute command & save result
242 O %FILE:(REWIND) U %FILE R:'$ZEOF %VALUE C %FILE:(DELETE) ; fetch value & delete file
243 ;
244 QUIT %VALUE ; return value
245 ;
246 ;
247STRIPCR(%DIRECTORY) ; ** Private Entry Point: strip extraneous CR from end of lines of all
248 ; routines in %DIRECTORY Linux directory
249 ;
250 ZSYSTEM "perl -pi -e 's/\r\n$/\n/' "_%DIRECTORY_"[A-K]*.m"
251 ZSYSTEM "perl -pi -e 's/\r\n$/\n/' "_%DIRECTORY_"[L-S]*.m"
252 ZSYSTEM "perl -pi -e 's/\r\n$/\n/' "_%DIRECTORY_"[T-z]*.m"
253 ZSYSTEM "perl -pi -e 's/\r\n$/\n/' "_%DIRECTORY_"[_]*.m"
254 Q
255 ;

Subscribers

People subscribed via source and target branches