This link is too long for the commit message, but here is the commit
'du -A' was added to FreeBSD:

https://github.com/freebsd/freebsd-src/commit/fd543f275900cc66a0ce4725699f1e528e526792

-- 8< --

The --apparent-size option to 'du' was added in
coreutils-4.5.8 (2003). FreeBSD 8.0 (2009) added the same functionality
under the short option -A. This long option previously had no short
option, so this patch adds -A to be compatible with FreeBSD.

* NEWS: Mention the new short option.
* doc/coreutils.texi: Document the short option.
* src/du.c (usage): Likewise.
(APPARENT_SIZE_OPTION): Remove definition.
(EXCLUDE_OPTION): Define to CHAR_MAX + 1.
(long_options): Use the -A short option for --apparent-size.
(main): Likewise.
---
 NEWS               |  3 +++
 doc/coreutils.texi |  4 +++-
 src/du.c           | 11 +++++------
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index 019451d32..2319e4517 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   'tail' now accepts the --debug option, which is currently used to
   detail the --follow implementation being used.
 
+  'du' now supports the short option -A corresponding to the existing long
+  option --apparent-size, for compatibility with FreeBSD.
+
 ** Changes in behavior
 
   'timeout' now honors ignored signals and will not propagate them.  E.g.,
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 098fa4761..583686212 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12755,7 +12755,9 @@ @node du invocation
 @opindex --all
 Show counts for all files, not just directories.
 
-@item --apparent-size
+@item -A
+@itemx --apparent-size
+@opindex -A
 @opindex --apparent-size
 Print apparent sizes, rather than file system usage.  The apparent size of a
 file is the number of bytes reported by @code{wc -c} on regular files,
diff --git a/src/du.c b/src/du.c
index 80d0b53d1..14aa0d652 100644
--- a/src/du.c
+++ b/src/du.c
@@ -195,8 +195,7 @@ static struct duinfo tot_dui;
    non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
 {
-  APPARENT_SIZE_OPTION = CHAR_MAX + 1,
-  EXCLUDE_OPTION,
+  EXCLUDE_OPTION = CHAR_MAX + 1,
   FILES0_FROM_OPTION,
   HUMAN_SI_OPTION,
 #if GNULIB_FTS_DEBUG
@@ -210,7 +209,7 @@ enum
 static struct option const long_options[] =
 {
   {"all", no_argument, nullptr, 'a'},
-  {"apparent-size", no_argument, nullptr, APPARENT_SIZE_OPTION},
+  {"apparent-size", no_argument, nullptr, 'A'},
   {"block-size", required_argument, nullptr, 'B'},
   {"bytes", no_argument, nullptr, 'b'},
   {"count-links", no_argument, nullptr, 'l'},
@@ -290,7 +289,7 @@ Summarize device usage of the set of FILEs, recursively for 
directories.\n\
       fputs (_("\
   -0, --null            end each output line with NUL, not newline\n\
   -a, --all             write counts for all files, not just directories\n\
-      --apparent-size   print apparent sizes rather than device usage; 
although\
+  -A, --apparent-size   print apparent sizes rather than device usage; 
although\
 \n\
                           the apparent size is usually smaller, it may be\n\
                           larger due to holes in ('sparse') files, internal\n\
@@ -745,7 +744,7 @@ main (int argc, char **argv)
   while (true)
     {
       int oi = -1;
-      int c = getopt_long (argc, argv, "0abd:chHklmst:xB:DLPSX:",
+      int c = getopt_long (argc, argv, "0aAbd:chHklmst:xB:DLPSX:",
                            long_options, &oi);
       if (c == -1)
         break;
@@ -766,7 +765,7 @@ main (int argc, char **argv)
           opt_all = true;
           break;
 
-        case APPARENT_SIZE_OPTION:
+        case 'A':
           apparent_size = true;
           break;
 
-- 
2.52.0


Reply via email to