ubase/umount.c

40 lines
542 B
C
Raw Normal View History

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