summaryrefslogtreecommitdiff
path: root/appl/cmd/ip/tftpd.b
diff options
context:
space:
mode:
Diffstat (limited to 'appl/cmd/ip/tftpd.b')
-rw-r--r--appl/cmd/ip/tftpd.b18
1 files changed, 12 insertions, 6 deletions
diff --git a/appl/cmd/ip/tftpd.b b/appl/cmd/ip/tftpd.b
index c7edef4e..57d80cd5 100644
--- a/appl/cmd/ip/tftpd.b
+++ b/appl/cmd/ip/tftpd.b
@@ -8,6 +8,9 @@ include "draw.m";
include "arg.m";
+include "dial.m";
+ dial: Dial;
+
include "ip.m";
ip: IP;
IPaddr, Udphdr: import ip;
@@ -34,7 +37,7 @@ port := 69;
Udphdrsize: con IP->Udphdrlen;
-tftpcon: Sys->Connection;
+tftpcon: ref Sys->Connection;
tftpreq: ref Sys->FD;
dokill(pid: int, scope: string)
@@ -152,6 +155,10 @@ init(nil: ref Draw->Context, args: list of string)
sys->pctl(Sys->NEWPGRP|Sys->FORKFD|Sys->FORKNS, nil);
stderr = sys->fildes(2);
+ dial = load Dial Dial->PATH;
+ if(dial == nil)
+ fatal("can't load Dial");
+
arg := load Arg Arg->PATH;
if(arg == nil)
fatal("can't load Arg");
@@ -206,8 +213,8 @@ mainthing()
raddr := sys->sprint("%s/udp!%s!%d", net, hdr.raddr.text(), hdr.rport);
DBG(sys->sprint("raddr=%s", raddr));
- (err, cx) := sys->dial(raddr, nil);
- if(err < 0)
+ cx := dial->dial(raddr, nil);
+ if(cx == nil)
fatal("dialing "+raddr);
# showbuf("bigbuf", bigbuf[0:dlen]);
@@ -492,9 +499,8 @@ fatal(msg: string)
openlisten()
{
name := net+"/udp!*!" + string port;
- err := 0;
- (err, tftpcon) = sys->announce(name);
- if(err < 0)
+ tftpcon = dial->announce(name);
+ if(tftpcon == nil)
fatal("can't announce "+name);
if(sys->fprint(tftpcon.cfd, "headers") < 0)
fatal("can't set header mode");