]> git.cameronkatri.com Git - mandoc.git/blobdiff - soelim.c
Revert part of the previous diff to fix a regression (another endless loop)
[mandoc.git] / soelim.c
index 10b1b89deab7cc99c39560cfd248a2aeed4ab820..33d60e4588266a42a0809aa64b626dbb3ca912f6 100644 (file)
--- a/soelim.c
+++ b/soelim.c
@@ -1,4 +1,4 @@
-/*     $Id: soelim.c,v 1.3 2015/05/20 22:57:22 schwarze Exp $  */
+/*     $Id: soelim.c,v 1.6 2021/09/19 18:14:24 schwarze Exp $  */
 /*
  * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
  * All rights reserved.
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -101,16 +104,16 @@ soelim_file(FILE *f, int flag)
                }
 
                walk = line + 3;
-               if (!isspace(*walk) && ((flag & C_OPTION) == 0)) {
+               if (!isspace((unsigned char)*walk) && (flag & C_OPTION) == 0) {
                        printf("%s", line);
                        continue;
                }
 
-               while (isspace(*walk))
+               while (isspace((unsigned char)*walk))
                        walk++;
 
                cp = walk;
-               while (*cp != '\0' && !isspace(*cp))
+               while (*cp != '\0' && !isspace((unsigned char)*cp))
                        cp++;
                *cp = 0;
                if (cp < line + linelen)