Merge linewrap changes
authorMiles Bader <miles@gnu.org>
Wed, 17 Jul 1996 18:46:54 +0000 (18:46 +0000)
committerMiles Bader <miles@gnu.org>
Wed, 17 Jul 1996 18:46:54 +0000 (18:46 +0000)
Wed Jul 17 11:29:26 1996  Miles Bader  <miles@gnu.ai.mit.edu>

* stdio/linewrap.c (lwupdate): Fix boundary condition where a
  word extends right up to rmargin.

* stdio/linewrap.c (lwupdate): When we've done a word wrap and
output the wrap margin, set point_col to wmargin.
Use negative point_col to deal with a wmargin of 0.
(line_wrap_point): Return 0 for a negative point_col.
(line_wrap_stream): Make wmargin ssize_t.
* stdio/linewrap.h (struct line_wrap_data): Make wmargin &
  point_col ssize_t.
(line_wrap_stream): Make wmargin ssize_t.
(line_wrap_point): Return 0 for a negative point_col.

Tue Jul 16 00:18:19 1996  Miles Bader  <miles@gnu.ai.mit.edu>

* stdio/linewrap.c (__line_wrap_update): Add hackery from flshfp
  to fiddle __put_limit in conjunction with __linebuf_active.

ChangeLog
stdio/linewrap.c
stdio/linewrap.h

index 3959781..2a14f9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Wed Jul 17 11:29:26 1996  Miles Bader  <miles@gnu.ai.mit.edu>
+
+       * stdio/linewrap.c (lwupdate): Fix boundary condition where a
+       word extends right up to rmargin.
+
+       * stdio/linewrap.c (lwupdate): When we've done a word wrap and
+       output the wrap margin, set point_col to wmargin.
+       Use negative point_col to deal with a wmargin of 0.
+       (line_wrap_point): Return 0 for a negative point_col.
+       (line_wrap_stream): Make wmargin ssize_t.
+       * stdio/linewrap.h (struct line_wrap_data): Make wmargin &
+       point_col ssize_t.
+       (line_wrap_stream): Make wmargin ssize_t.
+       (line_wrap_point): Return 0 for a negative point_col.
+
+Tue Jul 16 00:18:19 1996  Miles Bader  <miles@gnu.ai.mit.edu>
+
+       * stdio/linewrap.c (__line_wrap_update): Add hackery from flshfp
+       to fiddle __put_limit in conjunction with __linebuf_active.
+
 Tue Jul 16 16:43:58 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
 
        * elf/dl-lookup.c (_dl_lookup_symbol): Avoid sizeof dynamic auto array
index 82b6a32..37780d2 100644 (file)
@@ -327,7 +327,7 @@ __line_wrap_output (FILE *stream, int c)
    simply dropped until a newline.  Returns STREAM after modifying it, or
    NULL if there was an error.  */
 FILE *
-line_wrap_stream (FILE *stream, size_t lmargin, size_t rmargin, size_t wmargin)
+line_wrap_stream (FILE *stream, size_t lmargin, size_t rmargin, ssize_t wmargin)
 {
   struct line_wrap_data *d = malloc (sizeof *d);
 
index c569238..aba9398 100644 (file)
@@ -34,13 +34,13 @@ __BEGIN_DECLS
 struct line_wrap_data
   {
     size_t lmargin, rmargin;   /* Left and right margins.  */
-    size_t wmargin;            /* Margin to wrap to, or -1 to truncate.  */
+    ssize_t wmargin;           /* Margin to wrap to, or -1 to truncate.  */
 
     /* Point in stdio buffer to which we've processed for wrapping, but
        not output.  */
     size_t point_offs;
-    /* Output column at POINT_OFFS.  */
-    size_t point_col;
+    /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin.  */
+    ssize_t point_col;
 
     /* Original cookie and hooks from the stream.  */
     void *cookie;
@@ -57,7 +57,7 @@ struct line_wrap_data
    simply dropped until a newline.  Returns STREAM after modifying it, or
    NULL if there was an error.  */
 FILE *line_wrap_stream (FILE *stream,
-                       size_t lmargin, size_t rmargin, size_t wmargin);
+                       size_t lmargin, size_t rmargin, ssize_t wmargin);
 
 /* Remove the hooks placed in STREAM by `line_wrap_stream'.  */
 void line_unwrap_stream (FILE *stream);
@@ -190,7 +190,7 @@ extern inline size_t
 line_wrap_point (FILE *stream)
 {
   struct line_wrap_data *d = __line_wrap_update (stream);
-  return d ? d->point_col : -1;
+  return d ? (d->point_col >= 0 ? d->point_col : 0) : -1;
 }
 
 #endif /* Optimizing.  */