History

20080116-1354

Charles.Forsyth committed 18 years ago

Commit ff72aa71 parent f4bb33e2 files · +25 −21Browse files

Unified · Split

2 files
  1. appl/cmd/ftpfs.b +26 −22
  2. dis/ftpfs.dis +0 −0
appl/cmd/ftpfs.b+26−22
@@ -2,7 +2,7 @@ implement Ftpfs; · 1 unmodified line
22
33 include "sys.m";
44 sys: Sys;
5− FD, Connection, Dir: import Sys;
5+ FD, Dir: import Sys;
66
77 include "draw.m";
88
@@ -23,6 +23,10 @@ include "styx.m"; · 14 unmodified lines
2323 styx: Styx;
2424 Tmsg, Rmsg: import styx;
2525
26+include "dial.m";
27+ dial: Dial;
28+ Connection: import dial;
29+
2630 include "factotum.m";
2731
2832 Ftpfs: module
@@ -107,7 +111,7 @@ File: adt · 78 unmodified lines
107111 createtmp: fn(f: self ref File): ref FD;
108112 };
109113
110−ftp: Connection;
114+ftp: ref Connection;
111115 dfid: ref FD;
112116 dfidiob: ref Iobuf;
113117 buffresidue: int = 0;
@@ -700,7 +704,7 @@ getfullreply(echo: int): (int, int, string) · 586 unmodified lines
700704
701705 getreply(echo: int): (int, string)
702706 {
703− (c, code, s) := getfullreply(echo);
707+ (c, nil, s) := getfullreply(echo);
704708 return (c, s);
705709 }
706710
@@ -767,15 +771,15 @@ third(cmd: string): ref FD · 60 unmodified lines
767771 {
768772 acquire();
769773 for (;;) {
770− (n, data) := sys->dial(firewall, nil);
771− if (n < 0) {
774+ data := dial->dial(firewall, nil);
775+ if(data == nil) {
772776 if (debug)
773777 sys->print("dial %s failed: %r\n", firewall);
774778 break;
775779 }
776780 t := sys->sprint("\n%s!*\n\n%s\n%s\n1\n-1\n-1\n", proxyhost, myhost, myname);
777781 b := array of byte t;
778− n = sys->write(data.dfd, b, len b);
782+ n := sys->write(data.dfd, b, len b);
779783 if (n < 0) {
780784 if (debug)
781785 sys->print("firewall write failed: %r\n");
@@ -872,8 +876,8 @@ passive(cmd: string): ref FD · 90 unmodified lines
872876 a := dataport(l);
873877 if (debug)
874878 sys->print("data dial %s\n", a);
875− (s, d) := sys->dial(a, nil);
876− if (s < 0)
879+ d := dial->dial(a, nil);
880+ if(d == nil)
877881 return nil;
878882 acquire();
879883 r = sendrequest(cmd, 0);
@@ -919,14 +923,14 @@ activate(cmd: string): ref FD · 39 unmodified lines
919923 {
920924 r: int;
921925
922− listenport, dataport: Connection;
926+ listenport, dataport: ref Connection;
923927 m: string;
924928
925− (r, listenport) = sys->announce("tcp!" + net + "!0");
926− if (r < 0)
929+ listenport = dial->announce("tcp!" + net + "!0");
930+ if(listenport == nil)
927931 return nil;
928932 (x1, x2) := getnet(listenport.dir);
929− (x3, x4) := sys->tokenize(x1, ".");
933+ (nil, x4) := sys->tokenize(x1, ".");
930934 t := sys->sprint("PORT %s,%d,%d", commas(x4), int x2 / 256, int x2&255);
931935 acquire();
932936 r = sendrequest(t, 0);
@@ -948,8 +952,8 @@ activate(cmd: string): ref FD · 15 unmodified lines
948952 release();
949953 if (r != Extra)
950954 return nil;
951− (r, dataport) = sys->listen(listenport);
952− if (r < 0) {
955+ dataport = dial->listen(listenport);
956+ if(dataport == nil) {
953957 sys->fprint(stderr, "activate: listen failed: %r\n");
954958 return nil;
955959 }
@@ -1488,8 +1492,8 @@ init(nil: ref Draw->Context, args: list of string) · 532 unmodified lines
14881492 rv: int;
14891493 code: int;
14901494
1491− if (sys == nil)
1492− sys = load Sys Sys->PATH;
1495+ sys = load Sys Sys->PATH;
1496+ dial = load Dial Dial->PATH;
14931497 stdin = sys->fildes(0);
14941498 stderr = sys->fildes(2);
14951499
@@ -1549,8 +1553,8 @@ init(nil: ref Draw->Context, args: list of string) · 53 unmodified lines
15491553 if (proxy) {
15501554 if (!quiet)
15511555 sys->print("dial firewall service %s\n", firewall);
1552− (rv, ftp) = sys->dial(firewall, nil);
1553− if (rv < 0) {
1556+ ftp = dial->dial(firewall, nil);
1557+ if(ftp == nil) {
15541558 sys->print("dial %s failed: %r\n", firewall);
15551559 exit;
15561560 }
@@ -1593,13 +1597,13 @@ init(nil: ref Draw->Context, args: list of string) · 36 unmodified lines
15931597 sys->print("proxyhost %s\n", proxyhost);
15941598 } else {
15951599 d := "tcp!" + hostname + "!ftp";
1596− (rv, ftp) = sys->dial(d, nil);
1597− if (debug)
1598− sys->print("localdir %s\n", ftp.dir);
1599− if (rv < 0) {
1600+ ftp = dial->dial(d, nil);
1601+ if(ftp == nil) {
16001602 sys->print("dial %s failed: %r\n", d);
16011603 exit;
16021604 }
1605+ if(debug)
1606+ sys->print("localdir %s\n", ftp.dir);
16031607 dfid = ftp.dfd;
16041608 }
16051609 dfidiob = bufio->fopen(dfid, sys->OREAD);
dis/ftpfs.dis+0−0

Binary file not shown.