autoupdate
[gnulib.git] / lib / argp-fmtstream.c
index 0ba19c5..7e6d9c6 100644 (file)
@@ -3,19 +3,18 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
-   This program is free software; you can redistribute it and/or modify
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* This package emulates glibc `line_wrap_stream' semantics for systems that
    don't have that.  */
@@ -227,7 +226,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
          int i;
 
          p = buf + (r + 1 - fs->point_col);
-         while (p >= buf && !isblank (*p))
+         while (p >= buf && !isblank ((unsigned char) *p))
            --p;
          nextline = p + 1;     /* This will begin the next line.  */
 
@@ -237,7 +236,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
              if (p >= buf)
                do
                  --p;
-               while (p >= buf && isblank (*p));
+               while (p >= buf && isblank ((unsigned char) *p));
              nl = p + 1;       /* The newline will replace the first blank. */
            }
          else
@@ -246,9 +245,10 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
                 Oh well.  Put it on an overlong line by itself.  */
              p = buf + (r + 1 - fs->point_col);
              /* Find the end of the long word.  */
-             do
-               ++p;
-             while (p < nl && !isblank (*p));
+             if (p < nl)
+               do
+                 ++p;
+               while (p < nl && !isblank ((unsigned char) *p));
              if (p == nl)
                {
                  /* It already ends a line.  No fussing required.  */
@@ -261,7 +261,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
              /* Swallow separating blanks.  */
              do
                ++p;
-             while (isblank (*p));
+             while (isblank ((unsigned char) *p));
              /* The next line will start here.  */
              nextline = p;
            }