]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
POSIX-conformance fixes for "expand" and "unexpand".
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Aug 2004 07:36:36 +0000 (07:36 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Aug 2004 07:36:36 +0000 (07:36 +0000)
ChangeLog
NEWS
doc/ChangeLog

index 6c3971f86ab5c6055b5fad3c523640d839575b5c..93fe1186a8a870298136bed10a4cf10fca391318 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       POSIX-conformance fixes for "expand" and "unexpand".
+       Also, consistently use "tab stop" rather than "tabstop".
+       * NEWS: Document fixes.
+       * src/expand.c: Revamp to resemble the new unexpand.c better.
+       (usage): -i does not convert tabs after non-tabs.
+       (add_tab_stop): Renamed from add_tabstop.  All uses changed.
+       (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
+       (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
+       (next_file, main): Check fclose against 0, not EOF.
+       (expand): Remove unnecessary casts.
+       Add another loop nesting level, for lines, so that per-line variables
+       are initialized cleanly.
+       Revamp tab checking.  Check for write error immediately, rather
+       than just once at the end of the program.
+       * src/unexpand.c: Lkewise (for the expand.c changes).
+       (TAB_STOP_SENTINEL): Remove.
+       (tab_size): Now size_t, not uintmax_t, since we need to store
+       the sequences of blanks.
+       (max_column_width): New var.
+       (usage): Say "blank" where POSIX requires this.
+       (add_tab_stop): Calculate maximum column width.
+       (unexpand): Store the pending blanks, instead of merely counting them.
+       Follow POSIX's rules about -a requiring two blanks before a tab stop.
+       Get rid of internal label and goto.
+       * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
+       Add blanks-1 through blanks-13.
+
 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
diff --git a/NEWS b/NEWS
index 4c4f6ca5972e9db57cca696068a3eb900630ab9a..f2cdc009fd241958f26a6c6305dea905fda8bc12 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,11 @@ GNU coreutils NEWS                                    -*- outline -*-
   POSIXLY_CORRECT is set and the first argument is not "-n", echo now
   outputs all option-like arguments instead of treating them as options.
 
+  expand and unexpand now conform to POSIX better.  They check for
+  blanks (which can include characters other than space and tab in
+  non-POSIX locales) instead of spaces and tabs.  Unexpand now
+  preserves some blanks instead of converting them to tabs or spaces.
+
   printf has several changes:
 
     It now uses 'intmax_t' (not 'long int') to format integers, so it
index f36958afc5f0fcd97aad704c0ff0a10465f756a9..7243ecf55d4965e182c13d5797eefb3d3429233c 100644 (file)
@@ -1,3 +1,13 @@
+2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       POSIX-conformance fixes for "expand" and "unexpand".
+       * coreutils.texi: Standardize on "tab stop" (the POSIX usage)
+       rather than "tabstop".
+       (unexpand invocation): Use "blank" rather than "space" when
+       POSIX requires "blank".  Define "blank".  Initial blanks are
+       converted even if there's just one.  For -a, convert two or
+       more blanks only if they occur just before a tab stop.
+
 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * coreutils.texi (chown invocation): Fix synopsis: