home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / gnu / utils / bug / 2215 < prev    next >
Encoding:
Text File  |  1992-12-12  |  5.4 KB  |  182 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!mercury.cs.mun.ca!michael
  3. From: michael@mercury.cs.mun.ca (Mike Rendell)
  4. Subject: fileutils-3.4: diffs to add -l (--local) option to df
  5. Message-ID: <9212111848.AA19958@mercury.cs.mun.ca>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Fri, 11 Dec 1992 11:30:04 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 169
  12.  
  13. The following diffs add a -l (--local) flag to df to tell it to only list
  14. local disks.  A disk is `local' if its device is a block or character
  15. special device.  This is useful when you don't want to see (or hang on) lots
  16. of NFS filesystems.
  17.  
  18.  
  19. *** src/df.c.orig    Fri Jul 17 01:08:40 1992
  20. --- src/df.c    Fri Dec 11 15:10:04 1992
  21. ***************
  22. *** 15,27 ****
  23.      along with this program; if not, write to the Free Software
  24.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  25.   
  26. ! /* Usage: df [-aikP] [-t fstype] [--all] [--inodes] [--type fstype]
  27. !    [--kilobytes] [--portability] [path...]
  28.   
  29.      Options:
  30.      -a, --all        List all filesystems, even zero-size ones.
  31.      -i, --inodes        List inode usage information instead of block usage.
  32.      -k, --kilobytes    Print sizes in 1K blocks instead of 512-byte blocks.
  33.      -P, --portability    Use the POSIX output format (one line per filesystem).
  34.      -t, --type fstype    Limit the listing to filesystems of type `fstype'.
  35.               Multiple -t options can be given.
  36. --- 15,29 ----
  37.      along with this program; if not, write to the Free Software
  38.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  39.   
  40. ! /* Usage: df [-aiklP] [-t fstype] [--all] [--inodes] [--type fstype]
  41. !    [--kilobytes] [--local] [--portability] [path...]
  42.   
  43.      Options:
  44.      -a, --all        List all filesystems, even zero-size ones.
  45.      -i, --inodes        List inode usage information instead of block usage.
  46.      -k, --kilobytes    Print sizes in 1K blocks instead of 512-byte blocks.
  47. +    -l, --local        Limit the listing to local filesystems, ie, ones whose
  48. +             disk is a block or character special device.
  49.      -P, --portability    Use the POSIX output format (one line per filesystem).
  50.      -t, --type fstype    Limit the listing to filesystems of type `fstype'.
  51.               Multiple -t options can be given.
  52. ***************
  53. *** 60,65 ****
  54. --- 62,70 ----
  55.   /* If nonzero, use 1K blocks instead of 512-byte blocks. */
  56.   int kilobyte_blocks;
  57.   
  58. + /* If nonzero, report only on local disks.  */
  59. + int show_local_only;
  60.   /* If nonzero, use the POSIX output format.  */
  61.   int posix_format;
  62.   
  63. ***************
  64. *** 98,103 ****
  65. --- 103,109 ----
  66.     {"all", 0, &show_all_fs, 1},
  67.     {"inodes", 0, &inode_format, 1},
  68.     {"kilobytes", 0, &kilobyte_blocks, 1},
  69. +   {"local", 0, &show_local_only, 1},
  70.     {"portability", 0, &posix_format, 1},
  71.     {"type", 1, 0, 't'},
  72.     {NULL, 0, NULL, 0}
  73. ***************
  74. *** 119,125 ****
  75.     posix_format = 0;
  76.     exit_status = 0;
  77.   
  78. !   while ((i = getopt_long (argc, argv, "aikPt:v", long_options, (int *) 0))
  79.        != EOF)
  80.       {
  81.         switch (i)
  82. --- 125,131 ----
  83.     posix_format = 0;
  84.     exit_status = 0;
  85.   
  86. !   while ((i = getopt_long (argc, argv, "aiklPt:v", long_options, (int *) 0))
  87.        != EOF)
  88.       {
  89.         switch (i)
  90. ***************
  91. *** 135,140 ****
  92. --- 141,149 ----
  93.       case 'k':
  94.         kilobyte_blocks = 1;
  95.         break;
  96. +     case 'l':
  97. +       show_local_only = 1;
  98. +       break;
  99.       case 'P':
  100.         posix_format = 1;
  101.         break;
  102. ***************
  103. *** 293,298 ****
  104. --- 302,319 ----
  105.     long inodes_percent_used;
  106.     char *stat_file;
  107.   
  108. +   /* A filesystem is considered local if DISK is a block/char special device.
  109. +      This means /proc and /fd filesystems, as well as NFS filesystems,
  110. +      are not considered local.  */
  111. +   if (show_local_only)
  112. +     {
  113. +       struct stat statb;
  114. +       if (stat (disk, &statb) != 0
  115. +       || !(S_ISBLK(statb.st_mode) || S_ISCHR(statb.st_mode)))
  116. +     return;
  117. +     }
  118.     if (!fs_to_list (fstype))
  119.       return;
  120.   
  121. ***************
  122. *** 391,398 ****
  123.   usage ()
  124.   {
  125.     fprintf (stderr, "\
  126. ! Usage: %s [-aikPv] [-t fstype] [--all] [--inodes] [--type fstype]\n\
  127. !        [--kilobytes] [--portability] [path...]\n",
  128.          program_name);
  129.     exit (1);
  130.   }
  131. --- 412,419 ----
  132.   usage ()
  133.   {
  134.     fprintf (stderr, "\
  135. ! Usage: %s [-aiklPv] [-t fstype] [--all] [--inodes] [--type fstype]\n\
  136. !        [--kilobytes] [--local] [--portability] [path...]\n",
  137.          program_name);
  138.     exit (1);
  139.   }
  140.  
  141.  
  142. *** man/df.1.orig    Fri Jul 17 01:13:12 1992
  143. --- man/df.1    Mon Nov 30 13:49:34 1992
  144. ***************
  145. *** 3,9 ****
  146.   df \- summarize free disk space
  147.   .SH SYNOPSIS
  148.   .B df
  149. ! [\-aikPv] [\-t fstype] [\-\-all] [\-\-inodes] [\-\-type fstype]
  150.   [\-\-kilobytes] [\-\-portability] [path...]
  151.   .SH DESCRIPTION
  152.   This manual page
  153. --- 3,9 ----
  154.   df \- summarize free disk space
  155.   .SH SYNOPSIS
  156.   .B df
  157. ! [\-aiklPv] [\-t fstype] [\-\-all] [\-\-inodes] [\-\-type fstype]
  158.   [\-\-kilobytes] [\-\-local] [\-\-portability] [path...]
  159.   .SH DESCRIPTION
  160.   This manual page
  161. ***************
  162. *** 45,50 ****
  163. --- 45,55 ----
  164.   .I "\-k, \-\-kilobytes"
  165.   Print sizes in 1K blocks instead of 512-byte blocks.  This overrides
  166.   the environment variable POSIXLY_CORRECT.
  167. + .TP
  168. + .I "\-l, \-\-local"
  169. + Limit the listing to `local' filesystems, where a `local' filesystem
  170. + is one that is mounted from block or character device.  This is a
  171. + simple way of not listing filesystems mounted over NFS.
  172.   .TP
  173.   .I "\-P, \-\-portability"
  174.   Use the POSIX output format.  This is like the default format except
  175.  
  176. --
  177. Michael Rendell - Dept. of Comp. Sci., Memorial University of Newfoundland
  178.  
  179.