diff options
| author | charles forsyth <charles.forsyth@gmail.com> | 2015-06-13 16:34:09 +0100 |
|---|---|---|
| committer | charles forsyth <charles.forsyth@gmail.com> | 2015-06-13 16:34:09 +0100 |
| commit | 62d7827bc358c000db9ff48fe61bd28ac352a884 (patch) | |
| tree | 3369436e1f4ccfabd4bd5a58632d26934b868688 /appl/cmd/ip/tftpd.b | |
| parent | 15cdcc9295cbd45a03f77559b9de402033858a41 (diff) | |
mkfiles/mkfile-Linux-386
Diffstat (limited to 'appl/cmd/ip/tftpd.b')
| -rw-r--r-- | appl/cmd/ip/tftpd.b | 18 |
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"); |
