commit a81264cda1579437c197869396256c8032f3a664
parent 9827789a47f19dcad0e77fabc674d0ddd93260ff
Author: sin <sin@2f30.org>
Date: Thu, 29 Aug 2013 18:48:52 +0100
Implement the -q option for mountpoint(1)
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mountpoint.c b/mountpoint.c
@@ -8,18 +8,22 @@
static void
usage(void)
{
- eprintf("usage: %s target\n", argv0);
+ eprintf("usage: %s [-q] target\n", argv0);
}
int
main(int argc, char *argv[])
{
int i;
+ int qflag = 0;
struct mntinfo *minfo = NULL;
int siz;
int ret = 0;
ARGBEGIN {
+ case 'q':
+ qflag = 1;
+ break;
default:
usage();
} ARGEND;
@@ -38,5 +42,9 @@ main(int argc, char *argv[])
if (i == siz)
ret = 1;
+ if (!qflag)
+ printf("%s %s a mountpoint\n", argv[0],
+ !ret ? "is" : "is not");
+
return ret;
}