[hackers] [ubase] Don't list dummy rootfs by default || sin

From: <git_AT_suckless.org>
Date: Tue, 18 Mar 2014 15:21:10 +0100

commit ee88227c33bae40f5488c1d61969eed1e668186b
Author: sin <sin_AT_2f30.org>
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
_AT_@ -2,6 +2,7 @@
 #include <mntent.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/statvfs.h>
 #include "util.h"
 
_AT_@ -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':
_AT_@ -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;
Received on Tue Mar 18 2014 - 15:21:10 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 18 2014 - 15:24:16 CET