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

Subscribers

People subscribed via source and target branches