|| streq(name, "..")
|| strspn(name, "-")
|| strpbrk(name, " \"#',/:;")
- || strchriscntrl(name)
- || strisdigit(name))
+ || strchriscntrl_c(name)
+ || strisdigit_c(name))
{
errno = EINVAL;
return false;
if (strpbrk(field, illegal))
return -1;
- if (strchriscntrl(field))
+ if (strchriscntrl_c(field))
return -1;
- if (strisprint(field))
+ if (strisprint_c(field))
return 0;
if (streq(field, ""))
return 0;
#include <stdbool.h>
-extern inline bool strchriscntrl(const char *s);
+extern inline bool strchriscntrl_c(const char *s);
#include "string/strcmp/streq.h"
-inline bool strchriscntrl(const char *s);
+inline bool strchriscntrl_c(const char *s);
-// strchriscntrl - string character is [:cntrl:]
+// strchriscntrl_c - string character is [:cntrl:] C-locale
inline bool
-strchriscntrl(const char *s)
+strchriscntrl_c(const char *s)
{
for (; !streq(s, ""); s++) {
unsigned char c = *s;
-// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <stdbool.h>
-extern inline bool strisdigit(const char *s);
-extern inline bool strisprint(const char *s);
+extern inline bool strisdigit_c(const char *s);
+extern inline bool strisprint_c(const char *s);
#include "string/strspn/stpspn.h"
-inline bool strisdigit(const char *s); // strisdigit - string is [:digit:]
-inline bool strisprint(const char *s); // strisprint - string is [:print:]
+inline bool strisdigit_c(const char *s); // strisdigit - string is [:digit:] C-locale
+inline bool strisprint_c(const char *s); // strisprint - string is [:print:] C-locale
inline bool
-strisdigit(const char *s)
+strisdigit_c(const char *s)
{
return !streq(s, "") && streq(stpspn(s, CTYPE_DIGIT_C), "");
}
inline bool
-strisprint(const char *s)
+strisprint_c(const char *s)
{
return !streq(s, "") && streq(stpspn(s, CTYPE_PRINT_C), "");
}
int i;
uid_t owner_uid;
- if (strisdigit(owner)) {
+ if (strisdigit_c(owner)) {
i = sscanf(owner, "%d", &owner_uid);
if (i != 1) {
// should not happen