]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
dircolors: assume C-locale spaces
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 28 Oct 2023 16:22:09 +0000 (09:22 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 30 Oct 2023 07:58:04 +0000 (00:58 -0700)
* src/dircolors.c: Include c-ctype.h, not ctype.h.
(parse_line): Use c_isspace, not isspace, as the .dircolors
file format (which does not seem to be documented!) appears
to be ASCII.

src/dircolors.c

index f9001de0779be830e6f2b671061b4a3b286d5131..75ea516037edde271f31d6b2f3188155cb88670f 100644 (file)
 
 #include <config.h>
 
-#include <ctype.h>
 #include <sys/types.h>
 #include <fnmatch.h>
 #include <getopt.h>
 
 #include "system.h"
 #include "dircolors.h"
+#include "c-ctype.h"
 #include "c-strcase.h"
 #include "obstack.h"
 #include "quote.h"
@@ -153,7 +153,7 @@ parse_line (char const *line, char **keyword, char **arg)
   *keyword = nullptr;
   *arg = nullptr;
 
-  for (p = line; isspace (to_uchar (*p)); ++p)
+  for (p = line; c_isspace (to_uchar (*p)); ++p)
     continue;
 
   /* Ignore blank lines and shell-style comments.  */
@@ -162,7 +162,7 @@ parse_line (char const *line, char **keyword, char **arg)
 
   keyword_start = p;
 
-  while (!isspace (to_uchar (*p)) && *p != '\0')
+  while (!c_isspace (to_uchar (*p)) && *p != '\0')
     {
       ++p;
     }
@@ -175,7 +175,7 @@ parse_line (char const *line, char **keyword, char **arg)
     {
       ++p;
     }
-  while (isspace (to_uchar (*p)));
+  while (c_isspace (to_uchar (*p)));
 
   if (*p == '\0' || *p == '#')
     return;
@@ -185,7 +185,7 @@ parse_line (char const *line, char **keyword, char **arg)
   while (*p != '\0' && *p != '#')
     ++p;
 
-  for (--p; isspace (to_uchar (*p)); --p)
+  for (--p; c_isspace (to_uchar (*p)); --p)
     continue;
   ++p;