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