only show file systems of interest
[unix-history] / usr / src / bin / df / df.c
index 80436ca..f245bdc 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)df.c        4.12 %G%";
+static char *sccsid = "@(#)df.c        4.15 %G%";
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -38,7 +38,7 @@ main(argc, argv)
 {
        int i;
 
 {
        int i;
 
-       while (argc >= 1 && argv[1][0]=='-') {
+       while (argc > 1 && argv[1][0]=='-') {
        switch (argv[1][1]) {
 
        case 'i':
        switch (argv[1][1]) {
 
        case 'i':
@@ -56,6 +56,7 @@ main(argc, argv)
                (void) read(i, (char *)mtab, sizeof mtab);
                (void) close(i);
        }
                (void) read(i, (char *)mtab, sizeof mtab);
                (void) close(i);
        }
+       sync();
        printf("Filesystem    kbytes    used   avail capacity");
        if (iflag)
                printf(" iused   ifree  %%iused");
        printf("Filesystem    kbytes    used   avail capacity");
        if (iflag)
                printf(" iused   ifree  %%iused");
@@ -66,8 +67,8 @@ main(argc, argv)
                if (setfsent() == 0)
                        perror(FSTAB), exit(1);
                while (fsp = getfsent()) {
                if (setfsent() == 0)
                        perror(FSTAB), exit(1);
                while (fsp = getfsent()) {
-                       if (!strcmp(fsp->fs_type, FSTAB_RW) &&
-                           !(strcmp(fsp->fs_type, FSTAB_RO)))
+                       if (strcmp(fsp->fs_type, FSTAB_RW) &&
+                           strcmp(fsp->fs_type, FSTAB_RO))
                                continue;
                        if (root[0] == 0)
                                (void) strcpy(root, fsp->fs_spec);
                                continue;
                        if (root[0] == 0)
                                (void) strcpy(root, fsp->fs_spec);