summaryrefslogtreecommitdiff
path: root/appl/cmd/auxi/mangaload.b
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2009-12-14 19:43:13 +0000
committerforsyth <forsyth@vitanuova.com>2009-12-14 19:43:13 +0000
commit9274481003af38a88988b4e9a3a2c3e0df206bee (patch)
treea2003748180a351aa779bc819a83fe5489761f6f /appl/cmd/auxi/mangaload.b
parent112f90aed6c636816f40afc88ae63af0966c9e3a (diff)
20091214-1943
Diffstat (limited to 'appl/cmd/auxi/mangaload.b')
-rw-r--r--appl/cmd/auxi/mangaload.b26
1 files changed, 7 insertions, 19 deletions
diff --git a/appl/cmd/auxi/mangaload.b b/appl/cmd/auxi/mangaload.b
index 380dd22e..d91c07c5 100644
--- a/appl/cmd/auxi/mangaload.b
+++ b/appl/cmd/auxi/mangaload.b
@@ -16,6 +16,9 @@ include "timers.m";
timers: Timers;
Timer: import timers;
+include "dial.m";
+ dial: Dial;
+
include "arg.m";
Mangaload: module
@@ -88,6 +91,7 @@ init(nil: ref Draw->Context, args: list of string)
{
sys = load Sys Sys->PATH;
timers = load Timers Timers->PATH;
+ dial = load Dial Dial->PATH;
ip = load IP IP->PATH;
ip->init();
@@ -137,9 +141,9 @@ init(nil: ref Draw->Context, args: list of string)
filesize := int d.length;
port := sys->sprint("%d", 16r8695);
- addr := netmkaddr(hd args, "icmp", port);
- (rok, c) := sys->dial(addr, port);
- if(rok < 0){
+ addr := dial->netmkaddr(hd args, "icmp", port);
+ c := dial->dial(addr, port);
+ if(c == nil){
sys->fprint(sys->fildes(2), "mangaload: can't dial %s: %r\n", addr);
raise "fail:dial";
}
@@ -182,7 +186,6 @@ init(nil: ref Draw->Context, args: list of string)
last := 0;
while((n := sys->read(fd, buf, len buf)) >= 0 && !last){
last = n != len buf;
- nretry := 0;
Retry:
for(;;){
if(++nsent%10 == 0){ # probe
@@ -345,18 +348,3 @@ Icmp.unpack(b: array of byte): ref Icmp
ic.data = b[Odata:];
return ic;
}
-
-netmkaddr(addr, net, svc: string): string
-{
- if(net == nil)
- net = "net";
- (n, nil) := sys->tokenize(addr, "!");
- if(n <= 1){
- if(svc== nil)
- return sys->sprint("%s!%s", net, addr);
- return sys->sprint("%s!%s!%s", net, addr, svc);
- }
- if(svc == nil || n > 2)
- return addr;
- return sys->sprint("%s!%s", addr, svc);
-}