ubase

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

commit 1003ebad2600da527975442aa60cfacb820ee2c7
parent 2ca69a77fb92c7fdcbc93784e201362b1f9c3744
Author: sin <sin@2f30.org>
Date:   Sun Sep  1 18:24:34 +0100

Implement -d support for mountpoint(1)

Diffstat:
mountpoint.c | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/mountpoint.c b/mountpoint.c @@ -11,14 +11,14 @@ static void usage(void) { - eprintf("usage: %s [-q] target\n", argv0); + eprintf("usage: %s [-dq] target\n", argv0); } int main(int argc, char *argv[]) { int i; - int qflag = 0; + int qflag = 0, dflag = 0; struct mntinfo *minfo = NULL; int siz; int ret = 0; @@ -28,6 +28,9 @@ main(int argc, char *argv[]) case 'q': qflag = 1; break; + case 'd': + dflag = 1; + break; default: usage(); } ARGEND; @@ -41,6 +44,12 @@ main(int argc, char *argv[]) if (!S_ISDIR(st1.st_mode)) eprintf("lstat %s: not a directory\n", argv[0]); + if (dflag) { + printf("%u:%u\n", major(st1.st_dev), + minor(st1.st_dev)); + return 0; + } + siz = grabmntinfo(&minfo); if (!siz) eprintf("grabmntinfo:");