2013-08-16 10:00:43 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "grabmntinfo.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2013-08-29 17:48:52 +00:00
|
|
|
eprintf("usage: %s [-q] target\n", argv0);
|
2013-08-16 10:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int i;
|
2013-08-29 17:48:52 +00:00
|
|
|
int qflag = 0;
|
2013-08-16 10:00:43 +00:00
|
|
|
struct mntinfo *minfo = NULL;
|
|
|
|
int siz;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
ARGBEGIN {
|
2013-08-29 17:48:52 +00:00
|
|
|
case 'q':
|
|
|
|
qflag = 1;
|
|
|
|
break;
|
2013-08-16 10:00:43 +00:00
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
|
|
|
|
|
|
|
if (argc < 1)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
siz = grabmntinfo(&minfo);
|
|
|
|
if (!siz)
|
|
|
|
eprintf("grabmntinfo:");
|
|
|
|
for (i = 0; i < siz; i++)
|
|
|
|
if (!strcmp(minfo[i].mntdir, argv[0]))
|
|
|
|
break;
|
|
|
|
free(minfo);
|
|
|
|
|
|
|
|
if (i == siz)
|
|
|
|
ret = 1;
|
|
|
|
|
2013-08-29 17:48:52 +00:00
|
|
|
if (!qflag)
|
|
|
|
printf("%s %s a mountpoint\n", argv[0],
|
|
|
|
!ret ? "is" : "is not");
|
|
|
|
|
2013-08-16 10:00:43 +00:00
|
|
|
return ret;
|
|
|
|
}
|