summaryrefslogtreecommitdiff
path: root/sys/src/cmd/unmount.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/unmount.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/unmount.c')
-rwxr-xr-xsys/src/cmd/unmount.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/src/cmd/unmount.c b/sys/src/cmd/unmount.c
new file mode 100755
index 000000000..d485ecff3
--- /dev/null
+++ b/sys/src/cmd/unmount.c
@@ -0,0 +1,32 @@
+#include <u.h>
+#include <libc.h>
+
+void
+main(int argc, char *argv[])
+{
+ int r;
+ char *mnted, *mtpt;
+
+ argv0 = argv[0];
+ switch (argc) {
+ case 2:
+ mnted = nil;
+ mtpt = argv[1];
+ break;
+ case 3:
+ mnted = argv[1];
+ mtpt = argv[2];
+ break;
+ default:
+ SET(mnted, mtpt);
+ fprint(2, "usage: unmount mountpoint\n");
+ fprint(2, " unmount mounted mountpoint\n");
+ exits("usage");
+ }
+
+ /* unmount takes arguments in the same order as mount */
+ r = unmount(mnted, mtpt);
+ if(r < 0)
+ sysfatal("%s: %r", mtpt);
+ exits(0);
+}