#include "defines.h"
#include "chkname.h"
+#include "string/ctype/strisascii/strisdigit.h"
#include "string/strcmp/streq.h"
*
* Also do not allow fully numeric names or just "." or "..".
*/
- int numeric;
+
+ if (strisdigit(name)) {
+ errno = EINVAL;
+ return false;
+ }
if (streq(name, "") ||
streq(name, ".") ||
return false;
}
- numeric = isdigit(*name);
-
while (!streq(++name, "")) {
if (!((*name >= 'a' && *name <= 'z') ||
(*name >= 'A' && *name <= 'Z') ||
errno = EINVAL;
return false;
}
- numeric &= isdigit(*name);
- }
-
- if (numeric) {
- errno = EINVAL;
- return false;
}
return true;
#include "atoi/str2i/str2s.h"
#include "getdate.h"
#include "prototypes.h"
+#include "string/ctype/strisascii/strisdigit.h"
#include "string/strcmp/streq.h"
#include "string/strspn/stpspn.h"
long strtoday (const char *str)
{
time_t t;
- bool isnum = true;
const char *s = str;
/*
s++;
}
s = stpspn(s, " ");
- while (isnum && !streq(s, "")) {
- if (!isdigit (*s)) {
- isnum = false;
- }
- s++;
- }
- if (isnum) {
+ if (strisdigit(s)) {
long retdate;
+
if (str2sl(&retdate, str) == -1)
return -2;
return retdate;
#include "alloc/realloc.h"
#include "alloc/reallocf.h"
#include "atoi/str2i/str2u.h"
+#include "string/ctype/strisascii/strisdigit.h"
#include "string/sprintf/snprintf.h"
#include "string/strcmp/streq.h"
return count;
}
-static bool all_digits(const char *str)
-{
- int i;
-
- for (i = 0; str[i] != '\0'; i++)
- if (!isdigit(str[i]))
- return false;
- return true;
-}
-
static int append_uids(uid_t **uids, const char *owner, int n)
{
int i;
uid_t owner_uid;
- if (all_digits(owner)) {
+ if (strisdigit(owner)) {
i = sscanf(owner, "%d", &owner_uid);
if (i != 1) {
// should not happen