blob: 7be037c486e8d437482fb944033fa52d3afa3eca (
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
|
implement Unmount;
include "sys.m";
include "draw.m";
FD: import Sys;
Context: import Draw;
Unmount: module
{
init: fn(ctxt: ref Context, argv: list of string);
};
sys: Sys;
stderr: ref FD;
usage()
{
sys->fprint(stderr, "Usage: unmount [source] target\n");
}
init(nil: ref Context, argv: list of string)
{
r: int;
sys = load Sys Sys->PATH;
stderr = sys->fildes(2);
argv = tl argv;
case len argv {
* =>
usage();
return;
1 =>
r = sys->unmount(nil, hd argv);
2 =>
r = sys->unmount(hd argv, hd tl argv);
};
if(r < 0)
sys->fprint(stderr, "unmount: %r\n");
}
|