ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit c2db2d065bceb6eafd73ea0cc4ebb0345528c73e
parent 6fa02c77b3c4ec9ec1566526a4285aed9ebf9405
Author: sin <sin@2f30.org>
Date:   Fri, 16 Aug 2013 11:00:43 +0100

Add mountpoint(1)

Diffstat:
MMakefile | 1+
MTODO | 1-
Amountpoint.c | 42++++++++++++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -24,6 +24,7 @@ SRC = \ lsmod.c \ mkswap.c \ mount.c \ + mountpoint.c \ pivot_root.c \ ps.c \ reboot.c \ diff --git a/TODO b/TODO @@ -3,7 +3,6 @@ Tools * vmstat(8) * top(1) * Better ps(1) support - * mountpoint(1) * swaplabel(8) * last(1) diff --git a/mountpoint.c b/mountpoint.c @@ -0,0 +1,42 @@ +/* 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) +{ + eprintf("usage: %s target\n", argv0); +} + +int +main(int argc, char *argv[]) +{ + int i; + struct mntinfo *minfo = NULL; + int siz; + int ret = 0; + + ARGBEGIN { + 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; + + return ret; +}