summaryrefslogtreecommitdiff
path: root/appl/cmd/unmount.b
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
commit37da2899f40661e3e9631e497da8dc59b971cbd0 (patch)
treecbc6d4680e347d906f5fa7fca73214418741df72 /appl/cmd/unmount.b
parent54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff)
20060303a
Diffstat (limited to 'appl/cmd/unmount.b')
-rw-r--r--appl/cmd/unmount.b44
1 files changed, 44 insertions, 0 deletions
diff --git a/appl/cmd/unmount.b b/appl/cmd/unmount.b
new file mode 100644
index 00000000..7be037c4
--- /dev/null
+++ b/appl/cmd/unmount.b
@@ -0,0 +1,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");
+}