Produced by Araxis Merge on 10/31/2017 11:20:27 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_MCCF EDI TAS_TASCore_v1.00.00_iter1_October_2017.zip\OSCIF_MCCF EDI TAS_TASCore_v1.00.00_iter1_October_2017\mccf_misc_repo\M-Web-Server | WWWINIT.RSA | Sat Oct 7 07:48:04 2017 UTC |
| 2 | OSCIF_MCCF EDI TAS_TASCore_v1.00.00_iter1_October_2017.zip\OSCIF_MCCF EDI TAS_TASCore_v1.00.00_iter1_October_2017\mccf_misc_repo\M-Web-Server | WWWINIT.RSA | Tue Oct 31 19:47:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 974 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | Init routi ne for 0.1 .1 | |
| 2 | GT.M 01-JA N-2014 14: 03:54 | |
| 3 | WWWINIT | |
| 4 | WWWINIT ; VEN/SMH - Initialize Web Serve r;2013-12- 27 4:05 P M; 12/25/1 3 1:03pm | |
| 5 | ;;0.1;MAS H WEB SERV ER/WEB SER VICES | |
| 6 | ; | |
| 7 | ; Map %W on Cache | |
| 8 | I +$SYSTE M=0 DO CAC HEMAP | |
| 9 | ; | |
| 10 | ; Set-up TLS on Cac he | |
| 11 | I +$SYSTE M=0 DO CAC HETLS | |
| 12 | ; | |
| 13 | ; Get cur rent direc tory (GT.M may need it to writ e routines later) | |
| 14 | N PWD S P WD=$$PWD() | |
| 15 | ; | |
| 16 | ; Change to tempora ry directo ry (a bit complex fo r Windows) | |
| 17 | D CDTMPDI R | |
| 18 | ; | |
| 19 | ; Get tem p dir | |
| 20 | N TMPDIR S TMPDIR=$ $PWD() | |
| 21 | ; | |
| 22 | ; Downloa d the file s from Git hub into t emp direct ory | |
| 23 | D DOWNLOA D("https:/ /raw.githu b.com/shab iel/M-Web- Server/0.1 .1/dist/MW S.RSA") | |
| 24 | ; | |
| 25 | ; Go back to the ol d director y | |
| 26 | D CD(PWD) | |
| 27 | ; | |
| 28 | ; Silentl y install RSA -- fur GT.M pass the GTM d irectory i n case we need it. | |
| 29 | I +$SYSTE M=0 DO RIC ACHE(TMPDI R_"MWS.RSA ") | |
| 30 | I +$SYSTE M=47 DO RI GTM(TMPDIR _"MWS.RSA" ,,PWD) | |
| 31 | ; | |
| 32 | ; If file man is ins talled, do an init f or the %W( 17.001 fil e | |
| 33 | I $D(^DD) D ^%WINIT | |
| 34 | ; | |
| 35 | ; Load th e URLs | |
| 36 | D LOADHAN D | |
| 37 | ; | |
| 38 | ; Set the home dire ctory for the server | |
| 39 | D HOMEDIR | |
| 40 | ; | |
| 41 | ; Set sta rt port | |
| 42 | N PORT S PORT=$$POR T() | |
| 43 | ; | |
| 44 | ; Start S erver | |
| 45 | D JOB^VPR JREQ(PORT) | |
| 46 | ; | |
| 47 | W !!,"Mum ps Web Ser vices is n ow listeni ng to port "_PORT,! | |
| 48 | N SERVER S SERVER=" http://loc alhost:"_P ORT_"/" | |
| 49 | W "Visit "_SERVER_" to see th e home pag e.",! | |
| 50 | W "Also, try the sa mple web s ervices... ",! | |
| 51 | W " - "_S ERVER_"xml ",! | |
| 52 | W " - "_S ERVER_"pin g",! | |
| 53 | ; | |
| 54 | QUIT | |
| 55 | ; | |
| 56 | PWD() ; $$ - Get cur rent direc tory | |
| 57 | Q:+$SY=0 $ZU(168) | |
| 58 | Q:+$SY=47 $ZD | |
| 59 | S $EC=",U -NOT-IMPLE MENTED," | |
| 60 | QUIT | |
| 61 | ; | |
| 62 | CDTMPDIR ; Proc - Ch ange to te mporary di rectory | |
| 63 | I +$SY=47 S $ZD="/t mp/" QUIT ; GT.M | |
| 64 | I +$SY=0 DO QUIT | |
| 65 | . new OS set OS=$zv ersion(1) | |
| 66 | . if OS=1 S $EC=",U -VMS-NOT-S UPPORTED," | |
| 67 | . if OS=2 D ; wind ows | |
| 68 | . . N % S %=$ZU(168 ,"C:\TEMP\ ") | |
| 69 | . if OS=3 D ; UNIX | |
| 70 | . . N % S %=$ZU(168 ,"/tmp/") | |
| 71 | S $EC=",U -NOT-IMPLE MENTED," | |
| 72 | QUIT | |
| 73 | ; | |
| 74 | CD(DIR) ; Proc - Cha nge to the old direc tory | |
| 75 | I +$SY=0 N % S %=$Z U(168,DIR) QUIT | |
| 76 | I +$SY=47 S $ZD=DIR QUIT | |
| 77 | QUIT | |
| 78 | ; | |
| 79 | CACHEMAP ; Map %W* G lobals and Routines away from %SYS in Ca che | |
| 80 | ; Get cur rent names pace | |
| 81 | N NMSP S NMSP=$NAME SPACE | |
| 82 | ; | |
| 83 | ; Map %W globals aw ay from %S YS | |
| 84 | ZN "%SYS" ; Go to S YS | |
| 85 | N % S %=# #class(Con fig.Config uration).G etGlobalMa pping(NMSP ,"%W*","", NMSP,NMSP) | |
| 86 | I '% S %= ##class(Co nfig.Confi guration). AddGlobalM apping(NMS P,"%W*","" ,NMSP,NMSP ) | |
| 87 | I '% W !, "Error="_$ SYSTEM.Sta tus.GetErr orText(%) QUIT | |
| 88 | ; | |
| 89 | ; Map %W routines a way from % SYS | |
| 90 | N A S A(" Database") =NMSP | |
| 91 | N % S %=# #Class(Con fig.MapRou tines).Get (NMSP,"%W* ",.A) | |
| 92 | S A("Data base")=NMS P | |
| 93 | I '% S %= ##Class(Co nfig.MapRo utines).Cr eate(NMSP, "%W*",.A) | |
| 94 | I '% W !, "Error="_$ SYSTEM.Sta tus.GetErr orText(%) QUIT | |
| 95 | ZN NMSP ; Go back | |
| 96 | QUIT | |
| 97 | ; | |
| 98 | CACHETLS ; Create a client SSL /TLS confi g on Cache | |
| 99 | ; | |
| 100 | ; Create the config uration | |
| 101 | N NMSP S NMSP=$NAME SPACE | |
| 102 | ZN "%SYS" | |
| 103 | n config, status | |
| 104 | n % s %=# #class(Sec urity.SSLC onfigs).Ex ists("clie nt",.confi g,.status) ; check i f config e xists | |
| 105 | i '% d | |
| 106 | . n prop s prop("Na me")="clie nt" | |
| 107 | . s %=##c lass(Secur ity.SSLCon figs).Crea te("client ",.prop) ; create a default ss l config | |
| 108 | . i '% w $SYSTEM.St atus.GetEr rorText(%) s $ec=",u -cache-err or," | |
| 109 | . s %=##c lass(Secur ity.SSLCon figs).Exis ts("client ",.config, .status) ; get confi g | |
| 110 | e s %=co nfig.Activ ate() | |
| 111 | ; | |
| 112 | ; Test it by connec ting to en crypted.go ogle.com | |
| 113 | n rtn | |
| 114 | d config. TestConnec tion("173. 194.33.4", 443,.rtn) | |
| 115 | i rtn w " TLS/SSL cl ient confi gured on C ache as co nfig name 'client'", ! | |
| 116 | e w "Can not config ure TLS/SS L on Cache ",! s $ec= ",u-cache- error," | |
| 117 | ZN NMSP | |
| 118 | QUIT | |
| 119 | ; | |
| 120 | DOWNLOAD(U RL) ; Down load the f iles from Github | |
| 121 | D:+$SY=0 DOWNCACH(U RL) | |
| 122 | D:+$SY=47 DOWNGTM(U RL) | |
| 123 | QUIT | |
| 124 | ; | |
| 125 | DOWNCACH(U RL) ; Down load for C ache | |
| 126 | ; Downloa d and save | |
| 127 | set httpr equest=##c lass(%Net. HttpReques t).%New() | |
| 128 | if $e(URL ,1,5)="htt ps" do | |
| 129 | . set htt prequest.H ttps=1 | |
| 130 | . set htt prequest.S SLConfigur ation="cli ent" | |
| 131 | new serve r set serv er=$p(URL, "://",2),s erver=$p(s erver,"/") | |
| 132 | new port set port=$ p(server," :",2) | |
| 133 | new filep ath set fi lepath=$p( URL,"://", 2),filepat h=$p(filep ath,"/",2, 99) | |
| 134 | new filen ame set fi lename=$p( filepath," /",$l(file path,"/")) | |
| 135 | set httpr equest.Ser ver=server | |
| 136 | if port s et httpreq uest.Port= port | |
| 137 | set httpr equest.Tim eout=5 | |
| 138 | new statu s set stat us=httpreq uest.Get(f ilepath) | |
| 139 | new respo nse set re sponse=htt prequest.H ttpRespons e.Data | |
| 140 | new sysfi le set sys file=##cla ss(%Stream .FileBinar y).%New() | |
| 141 | set statu s=sysfile. FilenameSe t(filename ) | |
| 142 | set statu s=sysfile. CopyFromAn dSave(resp onse) | |
| 143 | set statu s=sysfile. %Close() | |
| 144 | QUIT | |
| 145 | ; | |
| 146 | DOWNGTM(UR L) ; Downl oad for GT .M | |
| 147 | N CMD S C MD="curl - s -L -O "_ URL | |
| 148 | O "pipe": (shell="/b in/sh":com mand=CMD): :"pipe" | |
| 149 | U "pipe" C "pipe" | |
| 150 | QUIT | |
| 151 | ; | |
| 152 | RIGTM(ROPA TH,FF,GTMD IR) ; Sile nt Routine Input for GT.M | |
| 153 | ; ROPATH = full pat h to routi ne archive | |
| 154 | ; FF = Fo rm Feed 1 = Yes 0 = No. Option al. | |
| 155 | ; GTMDIR = GTM dire ctory in c ase gtmrou tines is r elative to current d ir | |
| 156 | ; | |
| 157 | ; Check i nputs | |
| 158 | I $ZPARSE (ROPATH)=" " S $EC=", U-NO-SUCH- FILE," | |
| 159 | S FF=$G(F F,0) | |
| 160 | ; | |
| 161 | ; Convert line endi ngs from t hat other Mumps | |
| 162 | O "pipe": (shell="/b in/sh":com mand="perl -pi -e 's /\r\n?/\n/ g' "_ROPAT H:parse):: "pipe" | |
| 163 | U "pipe" C "pipe" | |
| 164 | ; | |
| 165 | ; Set end of routin e | |
| 166 | I FF S EO R=$C(13,12 ) | |
| 167 | E S EOR= "" | |
| 168 | ; | |
| 169 | ; Get out put direct ory | |
| 170 | N D D PAR SEZRO(.D,$ ZROUTINES) | |
| 171 | N OUTDIR S OUTDIR=$ $ZRO1ST(.D ) | |
| 172 | ; | |
| 173 | ; If outp ut directo ry is rela tive, appe nd GTM dir ectory to it. | |
| 174 | I $E(OUTD IR)'="/" S OUTDIR=GT MDIR_OUTDI R | |
| 175 | ; | |
| 176 | ; Open us e RO/RSA | |
| 177 | O ROPATH: (readonly: block=2048 :record=20 44:rewind) :0 E S $E C=",U-ERR- OPEN-FILE, " | |
| 178 | U ROPATH | |
| 179 | ; | |
| 180 | ; Discard first two lines | |
| 181 | N X,Y R X ,Y | |
| 182 | ; | |
| 183 | F D Q:$ ZEOF | |
| 184 | . ; Read routine in fo line | |
| 185 | . N RTNIN FO R RTNIN FO | |
| 186 | . Q:$ZEOF | |
| 187 | . ; | |
| 188 | . ; Routi ne Name is 1st piece | |
| 189 | . N RTNNA ME S RTNNA ME=$P(RTNI NFO,"^") | |
| 190 | . ; | |
| 191 | . ; Check routine n ame | |
| 192 | . I RTNNA ME="" QUIT | |
| 193 | . I RTNNA ME'?1(1"%" ,1A).99AN S $EC=",U- INVALID-RO UTINE-NAME ," | |
| 194 | . ; | |
| 195 | . ; Path to save ro utine, and save | |
| 196 | . N SAVEP ATH S SAVE PATH=OUTDI R_$TR(RTNN AME,"%","_ ")_".m" | |
| 197 | . O SAVEP ATH:(newve rsion:nore adonly:blo cksize=204 8:recordsi ze=2044) | |
| 198 | . F U RO PATH R Y Q :Y=EOR Q: $ZEOF U S AVEPATH W $S(Y="":" ",1:Y),! | |
| 199 | . C SAVEP ATH | |
| 200 | ; | |
| 201 | C ROPATH | |
| 202 | ; | |
| 203 | QUIT ; D one | |
| 204 | ; | |
| 205 | PARSEZRO(D IRS,ZRO) ; Parse $zr outines pr operly int o an array | |
| 206 | N PIECE | |
| 207 | N I | |
| 208 | F I=1:1:$ L(ZRO," ") S PIECE(I )=$P(ZRO," ",I) | |
| 209 | N CNT S C NT=1 | |
| 210 | F I=0:0 S I=$O(PIEC E(I)) Q:'I D | |
| 211 | . S DIRS( CNT)=$G(DI RS(CNT))_P IECE(I) | |
| 212 | . I DIRS( CNT)["("&( DIRS(CNT)[ ")") S CNT =CNT+1 QUI T | |
| 213 | . I DIRS( CNT)'["("& (DIRS(CNT) '[")") S C NT=CNT+1 Q UIT | |
| 214 | . S DIRS( CNT)=DIRS( CNT)_" " ; prep for next piece | |
| 215 | QUIT | |
| 216 | ; | |
| 217 | ZRO1ST(DIR S) ; $$ Ge t first ro utine dire ctory | |
| 218 | ; TODO: D eal with . so. | |
| 219 | N OUT ; $ $ return | |
| 220 | N %1 S %1 =DIRS(1) ; 1st direc tory | |
| 221 | ; Parse w ith (...) | |
| 222 | I %1["(" DO | |
| 223 | . S OUT=$ P(%1,"(",2 ) | |
| 224 | . I OUT[" " S OUT=$ P(OUT," ") | |
| 225 | . E S OU T=$P(OUT," )") | |
| 226 | ; no pare ns | |
| 227 | E S OUT= %1 | |
| 228 | ; | |
| 229 | ; Add tra iling slas h | |
| 230 | I $E(OUT, $L(OUT))'= "/" S OUT= OUT_"/" | |
| 231 | QUIT OUT | |
| 232 | ; | |
| 233 | RICACHE(RO PATH) ; Si lent Routi ne Input f or Cache | |
| 234 | D $SYSTEM .Process.S etZEOF(1) ; Cache st uff!! | |
| 235 | I $ZSEARC H(ROPATH)= "" S $EC=" ,U-NO-SUCH -FILE," | |
| 236 | N EOR S E OR="" | |
| 237 | ; | |
| 238 | ; Open us ing Stream Format (T ERMs are C R/LF/FF) | |
| 239 | O ROPATH: ("RS"):0 E S $EC=", U-ERR-OPEN -FILE," | |
| 240 | U ROPATH | |
| 241 | ; | |
| 242 | ; Discard first two lines | |
| 243 | N X,Y R X ,Y | |
| 244 | ; | |
| 245 | F D Q:$ ZEOF | |
| 246 | . ; Read routine in fo line | |
| 247 | . N RTNIN FO R RTNIN FO | |
| 248 | . Q:$ZEOF | |
| 249 | . ; | |
| 250 | . ; Routi ne Name is 1st piece | |
| 251 | . N RTNNA ME S RTNNA ME=$P(RTNI NFO,"^") | |
| 252 | . ; | |
| 253 | . ; Check routine n ame | |
| 254 | . I RTNNA ME="" QUIT | |
| 255 | . I RTNNA ME'?1(1"%" ,1A).99AN S $EC=",U- INVALID-RO UTINE-NAME ," | |
| 256 | . ; | |
| 257 | . N RTNCO DE,L S L=1 | |
| 258 | . F R Y: 0 Q:Y=EOR Q:$ZEOF S RTNCODE( L)=Y,L=L+1 | |
| 259 | . S RTNCO DE(0)=L-1 ; required for Cache | |
| 260 | . D ROUTI NE^%R(RTNN AME_".INT" ,.RTNCODE, .ERR,"CS", 0) | |
| 261 | ; | |
| 262 | C ROPATH | |
| 263 | ; | |
| 264 | QUIT ; D one | |
| 265 | ; | |
| 266 | TESTD(DIR) ; $$ ; Ca n I write to this di rectory? | |
| 267 | Q:(+$SY=0 ) $$TESTD0 0(DIR) | |
| 268 | Q:(+$SY=4 7) $$TESTD 47(DIR) | |
| 269 | ; | |
| 270 | TESTD00(DI R) ; $$ ; Can I writ e to this directory in Cache? | |
| 271 | N $ET S $ ET="G TEST DET" | |
| 272 | O DIR_"te st.txt":"N WS":0 | |
| 273 | E Q 0 | |
| 274 | U DIR_"te st.txt" | |
| 275 | WRITE "TE ST" | |
| 276 | C DIR_"te st.txt":"D " | |
| 277 | QUIT 1 | |
| 278 | ; | |
| 279 | TESTD47(DI R) ; $$ ; Can I writ e to this directory in GT.M? | |
| 280 | N $ET S $ ET="G TEST DET" | |
| 281 | O DIR_"te st.txt":(n ewversion) :0 | |
| 282 | E Q 0 | |
| 283 | U DIR_"te st.txt" | |
| 284 | WRITE "TE ST" | |
| 285 | C DIR_"te st.txt":(d elete) | |
| 286 | QUIT 1 | |
| 287 | ; | |
| 288 | TESTDET ; Open File Error hand ler | |
| 289 | S $EC="" | |
| 290 | QUIT 0 | |
| 291 | ; | |
| 292 | ; Load UR L handler | |
| 293 | LOADHAND N I F I=1:1 N LN S LN =$P($T(LH+ I),";;",2, 99) Q:LN=" " D ; Re ad inline | |
| 294 | . N NREF S NREF=$P( LN,"=") ; variable n ame refere nce | |
| 295 | . I $E(NR EF)="^" S NREF=$NA(@ NREF) ; co nvert IEN to actual value | |
| 296 | . N TESTN ODE S TEST NODE="" ; for $DATA testing | |
| 297 | . I $QS(N REF,2)="B" S TESTNOD E=$NA(@NRE F,5) ; Get all subs b4 IEN | |
| 298 | . I $L(TE STNODE),$D (@TESTNODE ) DO QUIT ; If nod e exists i n B index | |
| 299 | . . WRITE TESTNODE_ " ALREADY INSTALLED" ,! ; say so | |
| 300 | . . KILL ^%W(17.600 1,IEN) ; a nd delete the stuff we entered | |
| 301 | . S @LN ; okay to set. | |
| 302 | QUIT | |
| 303 | LH ;; STAR T | |
| 304 | ;;^%W(17. 6001,0)="W EB SERVICE URL HANDL ER^17.6001 S" | |
| 305 | ;;IEN=$O( ^%W(17.600 1," "),-1) +1 | |
| 306 | ;;^%W(17. 6001,IEN,0 )="GET" | |
| 307 | ;;^%W(17. 6001,IEN,1 )="xml" | |
| 308 | ;;^%W(17. 6001,IEN,2 )="XML^VPR JRSP" | |
| 309 | ;;^%W(17. 6001,"B"," GET","xml" ,"XML^VPRJ RSP",IEN)= "" | |
| 310 | ;;IEN=IEN +1 | |
| 311 | ;;^%W(17. 6001,IEN,0 )="GET" | |
| 312 | ;;^%W(17. 6001,IEN,1 )="r/{rout ine?.1""%2 5"".32AN}" | |
| 313 | ;;^%W(17. 6001,IEN,2 )="R^%W0" | |
| 314 | ;;^%W(17. 6001,"B"," GET","r/{r outine?.1" "%25"".32A N}","R^%W0 ",IEN)="" | |
| 315 | ;;IEN=IEN +1 | |
| 316 | ;;^%W(17. 6001,IEN,0 )="GET" | |
| 317 | ;;^%W(17. 6001,IEN,1 )="filesys tem/*" | |
| 318 | ;;^%W(17. 6001,IEN,2 )="FILESYS ^%W0" | |
| 319 | ;;^%W(17. 6001,IEN," AUTH")="1" | |
| 320 | ;;^%W(17. 6001,"B"," GET","file system/*", "FILESYS^% W0",IEN)=" " | |
| 321 | ;; | |
| 322 | ENDLOAD | |
| 323 | ; | |
| 324 | HOMEDIR ; Set ^%WHOM E | |
| 325 | W "Enter the home d irectory w here you w ill store the html, js, and cs s files" | |
| 326 | W !! | |
| 327 | W "Make s ure this i s a direct ory where you have w rite permi ssions.",! ! | |
| 328 | ; | |
| 329 | W "To hel p you, I a m going to try to te st various directori es I think ",! | |
| 330 | W "may wo rk",!! | |
| 331 | ; | |
| 332 | N D F D=$ $PWD(),"/v ar/www/"," C:\Inetpub \www\" D | |
| 333 | . W D,?50 ,$S($$TEST D(D):"[OK] ",1:"[NOT OK]"),! | |
| 334 | ; | |
| 335 | N DIR | |
| 336 | AGAIN ; Tr y again | |
| 337 | W !,"Ente r Director y: ",$$PWD (),"// " | |
| 338 | R DIR:30 | |
| 339 | I $L(DIR) ,DIR["/",$ E(DIR,$L(D IR))'="/" S $E(DIR,$ L(DIR)+1)= "/" | |
| 340 | I $L(DIR) ,DIR["\",$ E(DIR,$L(D IR))'="\" S $E(DIR,$ L(DIR)+1)= "\" | |
| 341 | S ^%WHOME =$S($L(DIR ):DIR,1:$$ PWD()) | |
| 342 | I '$$TEST D(^%WHOME) WRITE "So rry, I can 't write t o this dir ectory" G AGAIN | |
| 343 | ; | |
| 344 | ; Create www direct ory; D = d elimiter | |
| 345 | N D S D=$ S(^%WHOME[ "/":"/",1: "\") | |
| 346 | I $P(^%WH OME,D,$L(^ %WHOME,D)- 1)'="www" D MKDIR(^% WHOME_"www ") S ^%WHO ME=^%WHOME _"www"_D | |
| 347 | QUIT | |
| 348 | ; | |
| 349 | MKDIR(DIR) ; Proc; M ake direct ory; does not create parents | |
| 350 | I +$SY=0 N % S %=$Z F(-1,"mkdi r "_DIR) | |
| 351 | I +$SY=47 o "p":(sh ell="/bin/ sh":comman d="mkdir " _DIR)::"pi pe" U "p" C "p" | |
| 352 | QUIT | |
| 353 | ; | |
| 354 | PORT() ; $ $; select a port | |
| 355 | N PORT,PO RTOK | |
| 356 | S PORT="" ,PORTOK=0 | |
| 357 | F D Q:( (PORT>1023 )&(PORT<65 536)&(PORT OK)) | |
| 358 | . R !,"En ter a port number be tween 1024 and 65535 : 9080// " ,PORT:30 | |
| 359 | . I PORT= "" S PORT= PORT | |
| 360 | . Q:'((PO RT>1023)&( PORT<65536 )) ; De Mo rgan's law exit | |
| 361 | . S PORTO K=$$PORTOK (PORT) | |
| 362 | . I 'PORT OK W !,"Co uldn't ope n this por t... try a nother one " | |
| 363 | QUIT PORT | |
| 364 | ; | |
| 365 | PORTOK(POR T) ; $$; I s this por t okay? | |
| 366 | N OKAY | |
| 367 | N $ET,$ES S $ET="G PORTOKER" | |
| 368 | ; | |
| 369 | ; Cache | |
| 370 | I +$SY=0 DO QUIT O KAY | |
| 371 | . N TCPIO S TCPIO=" |TCP|"_POR T | |
| 372 | . O TCPIO :(:PORT:"A CT"):2 | |
| 373 | . I S OK AY=1 | |
| 374 | . E S OK AY=0 | |
| 375 | . C TCPIO | |
| 376 | ; | |
| 377 | ; GT.M | |
| 378 | I +$SY=47 DO QUIT OKAY | |
| 379 | . N TCPIO S TCPIO=" server$"_P ORT | |
| 380 | . O TCPIO :(ZLISTEN= PORT_":TCP ":delim=$c (10,13):at tach="serv er"):2:"so cket" | |
| 381 | . I S OK AY=1 | |
| 382 | . E S OK AY=0 | |
| 383 | . C TCPIO | |
| 384 | ; | |
| 385 | S $EC=",U -NOT-IMPLE MENTED," | |
| 386 | QUIT | |
| 387 | PORTOKER ; Error han dler for o pen port | |
| 388 | I $ES QUI T | |
| 389 | S $EC="" | |
| 390 | QUIT 0 | |
| 391 | ; | |
| 392 | TEST D EN^ XTMUNIT($T (+0),1) QU IT | |
| 393 | GTMRITST ; @TEST - T est GT.M R outine Inp ut | |
| 394 | ; Use VPE 's RSA fil e to test. | |
| 395 | Q:+$SY'=4 7 | |
| 396 | N OLDDIR S OLDDIR=$ $PWD() | |
| 397 | D DELRGTM ("%ZV*"),D ELRGTM("ZV *") | |
| 398 | D SILENT^ %RSEL("%ZV *") | |
| 399 | D CHKEQ^X TMUNIT(%ZR ,0) | |
| 400 | N URL S U RL="http:/ /hardhats. org/tools/ vpe/VPE_12 .zip" | |
| 401 | S $ZD="/t mp/" | |
| 402 | N CMD S C MD="curl - L -s -O "_ URL | |
| 403 | O "p":(sh ell="/bin/ sh":comman d=CMD:pars e)::"pipe" | |
| 404 | U "p" C " p" | |
| 405 | S CMD="un zip -o /tm p/VPE_12.z ip" | |
| 406 | O "p":(sh ell="/bin/ sh":comman d=CMD:pars e)::"pipe" | |
| 407 | U "p" C " p" | |
| 408 | S $ZD=OLD DIR | |
| 409 | N PATH S PATH="/tmp /VPE_12_Rt ns.MGR" | |
| 410 | D RIGTM(P ATH,,OLDDI R) | |
| 411 | D SILENT^ %RSEL("%ZV *") | |
| 412 | D CHKTF^X TMUNIT(%ZR >0) | |
| 413 | QUIT | |
| 414 | ; | |
| 415 | DELRGTM(NM SP) ; Dele te routine s for GT.M - yahoo | |
| 416 | D SILENT^ %RSEL(NMSP ) | |
| 417 | N R S R=" " F S R=$ O(%ZR(R)) Q:R="" D | |
| 418 | . N P S P =%ZR(R)_$T R(R,"%","_ ")_".m" | |
| 419 | . O P C P :(delete) | |
| 420 | QUIT | |
| 421 | ; | |
| 422 | CACHERIT ; @TEST - T est Cache Routine In put | |
| 423 | Q:+$SY'=0 | |
| 424 | D DELRCAC H("%ZV*"), DELRCACH(" ZV*") | |
| 425 | D CHKTF^X TMUNIT('$D (^$R("%ZVE MD"))) | |
| 426 | N OLD S O LD=$$PWD() | |
| 427 | D CDTMPDI R | |
| 428 | N URL S U RL="http:/ /hardhats. org/tools/ vpe/VPE_12 .zip" | |
| 429 | D DOWNCAC H(URL) | |
| 430 | S %=$ZF(- 1,"unzip - o VPE_12.z ip") | |
| 431 | N PATH S PATH="VPE_ 12_Rtns.MG R" | |
| 432 | N %,A | |
| 433 | ; Fur VPE | |
| 434 | N NS S NS =$NAMESPAC E | |
| 435 | ZN "%SYS" | |
| 436 | S %=##cla ss(Config. Configurat ion).AddGl obalMappin g(NS,"%Z*" ,"",NS,NS) | |
| 437 | S A("Data base")=NS S %=##Clas s(Config.M apRoutines ).Create(N S,"%Z*",.A ) | |
| 438 | ZN NS | |
| 439 | D RICACHE (PATH) | |
| 440 | D CD(OLD) | |
| 441 | D CHKTF^X TMUNIT($D( ^$R("%ZVEM D"))) | |
| 442 | QUIT | |
| 443 | ; | |
| 444 | DELRCACH(N MSP) ; Del ete routin es for Cac he - yahoo again | |
| 445 | I $E(NMSP ,$L(NMSP)) '="*" D Q UIT | |
| 446 | . D DEL^% R(NMSP_".I NT") | |
| 447 | S NMSP=$E (NMSP,1,$L (NMSP)-1) | |
| 448 | N R S R=N MSP | |
| 449 | D:$D(^$R( R)) F S R=$O(^$R(R )) Q:R="" Q:($P(R,N MSP,2)="") D | |
| 450 | . X "ZR ZS @R" | |
| 451 | QUIT | |
| 452 | ; | |
| 453 | LHTEST ; @ TEST - Loa d hander t est... mak e sure it loads okay even mult iple times | |
| 454 | N I F I=1 :1:30 D LO ADHAND | |
| 455 | D CHKTF^X TMUNIT($O( ^%W(17.600 1," "),-1) <20) ; Sho uld have j ust 3 entr ies | |
| 456 | D CHKTF^X TMUNIT($D( ^%W(17.600 1,"B","GET ","xml","X ML^VPRJRSP "))) ; Mus t be loade d | |
| 457 | QUIT | |
| 458 | ; | |
| 459 | WDTESTY ; @TEST - Su ccessful w rite to a directory! | |
| 460 | N OUT | |
| 461 | N OLD S O LD=$$PWD() | |
| 462 | D CDTMPDI R | |
| 463 | N D S D=$ $PWD() | |
| 464 | I +$SY=0 S OUT=$$TE STD00(D) | |
| 465 | I +$SY=47 S OUT=$$T ESTD47(D) | |
| 466 | D CHKTF^X TMUNIT(OUT ) | |
| 467 | D CD(OLD) | |
| 468 | QUIT | |
| 469 | ; | |
| 470 | WDTESTN0 ; @TEST - T ry to writ e to a dir ectory wit h no permi ssions | |
| 471 | N OUT | |
| 472 | I +$SY=0 S OUT=$$TE STD00("/ro ot/") | |
| 473 | I +$SY=47 S OUT=$$T ESTD47("/r oot/") | |
| 474 | D CHKTF^X TMUNIT(OUT =0) | |
| 475 | QUIT | |
| 476 | WDTESTN1 ; @TEST - T ry to writ e to a dir ectory tha t doesn't exist | |
| 477 | N OUT | |
| 478 | I +$SY=0 S OUT=$$TE STD00("/lk jasdf/lkas jdflka/lak jdfs/") | |
| 479 | I +$SY=47 S OUT=$$T ESTD47("/l kjasdf/lka sjdflka/la kjdfs/") | |
| 480 | D CHKTF^X TMUNIT(OUT =0) | |
| 481 | QUIT | |
| 482 | PORTOKT ; @TEST - Te st Port Ok ay | |
| 483 | D CHKEQ^X TMUNIT($$P ORTOK(135) ,0) | |
| 484 | D CHKEQ^X TMUNIT($$P ORTOK(6123 2),1) | |
| 485 | QUIT | |
| 486 | ||
| 487 | ||
| 488 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.