1 | RGUTFTP ;CAIRO/DKM - FTP support (currently defined only for VMS);12-Oct-1998 15:49;DKM
|
---|
2 | ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
|
---|
3 | ;=================================================================
|
---|
4 | ; Should not be invoked directly, but through a call to FTP^RGUTOS
|
---|
5 | ;=================================================================
|
---|
6 | VMS(RGIP,RGMODE,RGSRCF,RGTGTF,RGTGTD,RGUSER,RGPASS) ;
|
---|
7 | N RGZ,RGZ1,RGFIL,RGSRCD
|
---|
8 | D HOME^%ZIS
|
---|
9 | I IO=IO(0) D
|
---|
10 | .U IO
|
---|
11 | .I "@"[RGIP D
|
---|
12 | ..S:RGIP="@" RGIP=$P($ZIO," ",2)
|
---|
13 | ..I RGIP="" D Q:RGIP=""
|
---|
14 | ...R "Enter target IP address: ",RGIP:DTIME,!
|
---|
15 | ...S:RGIP[U RGIP=""
|
---|
16 | .I $G(RGSRCF)="" D Q:RGSRCF=""
|
---|
17 | ..R "Enter source file name : ",RGSRCF:DTIME,!
|
---|
18 | ..S:RGSRCF[U RGSRCF=""
|
---|
19 | .I $G(RGUSER)="" D Q:RGUSER=""
|
---|
20 | ..R "Enter target user name : ",RGUSER:DTIME,!
|
---|
21 | ..S:RGUSER[U RGUSER=""
|
---|
22 | .I $G(RGPASS)="" D Q:RGPASS=""
|
---|
23 | ..R "Enter target password : ",RGPASS:DTIME,!
|
---|
24 | ..S:RGPASS[U RGPASS=""
|
---|
25 | D:$G(RGIP)="" RAISE^RGUTOS("No IP address")
|
---|
26 | D:$G(RGSRCF)="" RAISE^RGUTOS("No source file")
|
---|
27 | D:$G(RGUSER)="" RAISE^RGUTOS("No target user")
|
---|
28 | D:$G(RGPASS)="" RAISE^RGUTOS("No target password")
|
---|
29 | S RGZ=$S(RGMODE["G":"get ",RGMODE["P":"put ",1:""),RGSRCF=$TR(RGSRCF,"\","/"),RGSRCD=""
|
---|
30 | S:RGSRCF["/" RGZ1=$L(RGSRCF,"/")-1,RGSRCD=$P(RGSRCF,"/",1,RGZ1)_"/",RGSRCF=$P(RGSRCF,"/",RGZ1+1)
|
---|
31 | D:RGZ="" RAISE^RGUTOS("Mode not specified")
|
---|
32 | W:IO=IO(0) !,"Beginning file transfer...",!!
|
---|
33 | I $$NEWERR^%ZTER N $ET S $ET=""
|
---|
34 | S @$$TRAP^RGUTOS("ERROR^RGUTFTP"),RGFIL="FTP"_$J_".TMP",RGMODE=$$UP^XLFSTR($G(RGMODE))
|
---|
35 | D OPEN^RGUTOS(.RGFIL,"W")
|
---|
36 | U RGFIL
|
---|
37 | W:RGSRCD'="" $S(RGMODE["G":"cd ",1:"lcd ")_RGSRCD,!
|
---|
38 | W:$G(RGTGTD)'="" $S(RGMODE["G":"lcd ",1:"cd ")_RGTGTD,!
|
---|
39 | W $S($G(RGTGTF)="":"m"_RGZ_RGSRCF,1:RGZ_RGSRCF_" "_RGTGTF),!
|
---|
40 | W:RGMODE["D"&(RGMODE["G") "mdelete "_RGSRCF,!
|
---|
41 | W "quit",!
|
---|
42 | D CLOSE^RGUTOS(.RGFIL)
|
---|
43 | U IO
|
---|
44 | S RGZ=$&ZLIB.%SPAWN("FTP "_RGIP_" /USER="""_RGUSER_"""/PASS="""_RGPASS_"""/INPUT="_RGFIL)
|
---|
45 | D DELETE^RGUTOS(RGFIL)
|
---|
46 | I RGMODE["P",RGMODE["D" D DELETE^RGUTOS(RGSRCF)
|
---|
47 | Q
|
---|
48 | ERROR I IO=IO(0) D
|
---|
49 | .U IO
|
---|
50 | .W $$EC^%ZOSV,!!
|
---|
51 | E D ^ZTER
|
---|
52 | Q
|
---|