2013-08-07 10:41:42 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
2013-08-14 13:19:05 +00:00
|
|
|
#include <sys/mount.h>
|
2013-08-07 08:52:10 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2013-08-07 09:33:19 +00:00
|
|
|
eprintf("usage: %s [-lf] target\n", argv0);
|
2013-08-07 08:52:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[]) {
|
|
|
|
int i;
|
2013-08-07 09:33:19 +00:00
|
|
|
int flags = 0;
|
2013-08-07 08:52:10 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
ARGBEGIN {
|
|
|
|
case 'f':
|
2013-08-14 13:19:05 +00:00
|
|
|
flags |= MNT_FORCE;
|
2013-08-07 09:33:19 +00:00
|
|
|
break;
|
|
|
|
case 'l':
|
2013-08-14 13:19:05 +00:00
|
|
|
flags |= MNT_DETACH;
|
2013-08-07 08:52:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
2013-08-10 10:38:30 +00:00
|
|
|
|
2013-08-07 08:52:10 +00:00
|
|
|
if (argc < 1)
|
|
|
|
usage();
|
2013-08-10 10:38:30 +00:00
|
|
|
|
2013-08-07 08:52:10 +00:00
|
|
|
for (i = 0; i < argc; i++) {
|
2013-08-14 13:19:05 +00:00
|
|
|
if (umount2(argv[i], flags) < 0)
|
|
|
|
eprintf("umount2:");
|
2013-08-07 08:52:10 +00:00
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|