commit ee88227c33bae40f5488c1d61969eed1e668186b
Author: sin <[email protected]>
Date: Tue Mar 18 16:19:56 2014 +0200
Don't list dummy rootfs by default
diff --git a/df.c b/df.c
index dc3411f..299c297 100644
--- 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;