ubase

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

commit ee88227c33bae40f5488c1d61969eed1e668186b
parent 7cd9280b112b908b17748b2ca20b056e0810eee5
Author: sin <sin@2f30.org>
Date:   Tue, 18 Mar 2014 16:19:56 +0200

Don't list dummy rootfs by default

Diffstat:
df.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/df.c b/df.c @@ -2,6 +2,7 @@ #include <mntent.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/statvfs.h> #include "util.h" @@ -18,9 +19,11 @@ main(int argc, char *argv[]) { struct mntent *me = NULL; FILE *fp; + int aflag = 0; ARGBEGIN { case 'a': + aflag = 1; break; case 's': case 'h': @@ -35,8 +38,12 @@ main(int argc, char *argv[]) fp = setmntent("/proc/mounts", "r"); if (!fp) eprintf("setmntent %s:", "/proc/mounts"); - while ((me = getmntent(fp)) != NULL) + while ((me = getmntent(fp)) != NULL) { + if (aflag == 0) + if (strcmp(me->mnt_type, "rootfs") == 0) + continue; mnt_show(me->mnt_fsname, me->mnt_dir); + } endmntent(fp); return EXIT_SUCCESS;