df: reorder default field list of --output option
authorBernhard Voelker <mail@bernhard-voelker.de>
Thu, 22 Nov 2012 14:40:54 +0000 (15:40 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Thu, 22 Nov 2012 14:40:54 +0000 (15:40 +0100)
As the inodes information is usually not so much of interest,
and some file systems including btrfs do not even provide it,
reading of the full df --output is easier when the block
statistic fields come just left of the last field, the mount
point.

* src/df.c (all_args_string): Move the inodes fields before
the block fields.
(usage): Likewise.
* tests/df/df-output.sh: Likewise.
* doc/coreutils.texi (df invocation): Likewise.  Additionally,
explicitly mention the default order of the --output option.

doc/coreutils.texi
src/df.c
tests/df/df-output.sh

index 70e7ca0..cc9df7d 100644 (file)
@@ -10687,7 +10687,8 @@ out of date.  This is the default.
 @itemx @w{@kbd{--output}[=@var{field_list}]}
 @opindex --output
 Use the output format defined by @var{field_list}, or print all fields if
-@var{field_list} is omitted.
+@var{field_list} is omitted.  In the latter case, the order of the columns
+conforms to the order of the field descriptions below.
 
 The use of the @option{--output} together with each of the options @option{-i},
 @option{-P}, and @option{-T} is mutually exclusive.
@@ -10704,15 +10705,6 @@ The source of the mount point, usually a device.
 @item fstype
 File system type.
 
-@item size
-Total number of blocks.
-@item used
-Number of used blocks.
-@item avail
-Number of available blocks.
-@item pcent
-Percentage of @var{used} divided by @var{size}.
-
 @item itotal
 Total number of inodes.
 @item iused
@@ -10722,6 +10714,15 @@ Number of available inodes.
 @item ipcent
 Percentage of @var{iused} divided by @var{itotal}.
 
+@item size
+Total number of blocks.
+@item used
+Number of used blocks.
+@item avail
+Number of available blocks.
+@item pcent
+Percentage of @var{used} divided by @var{size}.
+
 @item target
 The mount point.
 @end table
index c62d16b..cac26b7 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -193,8 +193,8 @@ static struct field_data_t field_data[] = {
     "target", OTHER_FLD, N_("Mounted on"),  0, MBS_ALIGN_LEFT,  false }
 };
 
-static char const *all_args_string = "source,fstype,size,used,avail,pcent,"
-  "itotal,iused,iavail,ipcent,target";
+static char const *all_args_string =
+  "source,fstype,itotal,iused,iavail,ipcent,size,used,avail,pcent,target";
 
 /* Storage for the definition of output columns.  */
 static struct field_data_t **columns;
@@ -1164,8 +1164,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
       emit_size_note ();
       fputs (_("\n\
 FIELD_LIST is a comma-separated list of columns to be included.  Valid\n\
-field names are: 'source', 'fstype', 'size', 'used', 'avail', 'pcent',\n\
-'itotal', 'iused', 'iavail', 'ipcent' and 'target' (see info page).\n\
+field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',\n\
+'size', 'used', 'avail', 'pcent' and 'target' (see info page).\n\
 "), stdout);
       emit_ancillary_info ();
     }
index f586334..960d30e 100644 (file)
@@ -67,11 +67,11 @@ compare exp out || fail=1
 # that --o (without argument) is identical to the full list.
 
 cat <<\EOF > exp || framework_failure_
-Filesystem Type Size Used Avail Use% Inodes IUsed IFree IUse% Mounted on
+Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% Mounted on
 EOF
 
-df -h --o=source,fstype,size,used,avail,pcent \
- --o=itotal,iused,iavail,ipcent,target '.' >out || fail=1
+df -h --o=source,fstype,itotal,iused,iavail,ipcent \
+ --o=size,used,avail,pcent,target '.' >out || fail=1
 sed -e '1 {
           s/ [ ]*/ /g
           q