blob: e5dfced0b15c56c664a68350111b12dc302b29c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# Last change: R 24 May 2001 11:05 am
implement PPPTest;
include "sys.m";
sys: Sys;
include "draw.m";
include "lock.m";
include "modem.m";
include "script.m";
include "pppclient.m";
include "pppgui.m";
PPPTest: module {
init: fn(nil: ref Draw->Context, args: list of string);
};
usage()
{
sys->print("ppptest device modem_init tel user password \n");
sys->print("Example: ppptest /dev/modem atw2 4125678 rome xxxxxxxx\n");
exit;
}
init( ctxt: ref Draw->Context, argv: list of string )
{
sys = load Sys Sys->PATH;
mi: Modem->ModemInfo;
pi: PPPClient->PPPInfo;
tel : string;
# si: Script->ScriptInfo;
argv = tl argv;
if(argv == nil)
usage();
else
mi.path = hd argv;
argv = tl argv;
if(argv == nil)
usage();
else
mi.init = hd argv;
argv = tl argv;
if(argv == nil)
usage();
else
tel = hd argv;
argv = tl argv;
if(argv == nil)
usage();
else
pi.username = hd argv;
argv = tl argv;
if(argv==nil)
usage();
else
pi.password = hd argv;
#si.path = "rdid.script";
#si.username = "ericvh";
#si.password = "foobar";
#si.timeout = 60;
ppp := load PPPClient PPPClient->PATH;
logger := chan of int;
spawn ppp->connect( ref mi, tel, nil, ref pi, logger );
pppgui := load PPPGUI PPPGUI->PATH;
respchan := pppgui->init( ctxt, logger,ppp, nil);
event := 0;
while (1) {
event =<- respchan;
sys->print("GUI event received: %d\n",event);
if (event) {
sys->print("success");
exit;
} else {
raise "fail: Couldn't connect to ISP";
}
}
}
|