#include <stdio.h>
#include "prototypes.h"
+#include "string/strchr/stpspn.h"
#include "string/strchr/strrspn.h"
#include "string/strtok/stpsep.h"
* entering a space. --marekm
*/
stpcpy(strrspn(newf, " \t\n"), "");
-
- cp = newf;
- while (isspace (*cp)) {
- cp++;
- }
-
+ cp = stpspn(newf, " \t");
strcpy (buf, cp);
}
}
# undef static
#endif
-#include <stdio.h>
#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
#include <time.h>
#include "attr.h"
#include "getdate.h"
+#include "string/strchr/stpspn.h"
-#include <string.h>
/* Some old versions of bison generate parsers that use bcopy.
That loses on systems that don't provide the function, so we have
for (;;)
{
- while (isspace (*yyInput))
- yyInput++;
+ yyInput = stpspn(yyInput, " \t");
if (isdigit (c = *yyInput) || c == '-' || c == '+')
{
#include "atoi/str2i/str2s.h"
#include "atoi/str2i/str2u.h"
#include "string/memset/memzero.h"
+#include "string/strchr/stpspn.h"
#include "typetraits.h"
int retval = 0;
bool reported = false;
- pp = buf;
- /* Skip leading whitespace. */
- while ((' ' == *pp) || ('\t' == *pp)) {
- pp++;
- }
+ pp = stpspn(buf, " \t");
/* The special limit string "-" results in no limit for all known
* limits.
* So, let's skip all digits, "-" and our limited set of
* whitespace.
*/
- while ( isdigit (*pp)
- || ('-' == *pp)
- || (' ' == *pp)
- || ('\t' ==*pp)) {
- pp++;
- }
+ pp = stpspn(pp, "0123456789- \t");
}
return retval;
}
#include "getdef.h"
#include "prototypes.h"
#include "string/memset/memzero.h"
+#include "string/strchr/stpspn.h"
#include "string/strtok/stpsep.h"
* Then copy the rest (up to the end) into the username.
*/
- for (cp = buf; *cp == ' ' || *cp == '\t'; cp++);
+ cp = stpspn(buf, " \t");
for (i = 0; i < namesize - 1 && *cp != '\0'; name[i++] = *cp++);
#include "shadowlog.h"
#include "string/sprintf/snprintf.h"
#include "string/strtok/stpsep.h"
+#include "string/strchr/stpspn.h"
#define NSSWITCH "/etc/nsswitch.conf"
if (strncasecmp(line, "subid:", 6) != 0)
continue;
p = &line[6];
- while (isspace(*p))
- p++;
+ p = stpspn(p, " \t\n");
if (*p != '\0')
break;
p = NULL;
#include "getdef.h"
#include "shadowlog.h"
#include "string/sprintf/xasprintf.h"
+#include "string/strchr/stpspn.h"
#include "string/strdup/xstrdup.h"
#include "string/strtok/stpsep.h"
cp = buf;
/* ignore whitespace and comments */
- while (isspace (*cp)) {
- cp++;
- }
+ cp = stpspn(cp, " \t");
if (('\0' == *cp) || ('#' == *cp)) {
continue;
}
#ident "$Id$"
#include "atoi/str2i/str2s.h"
-#include "prototypes.h"
#include "getdate.h"
+#include "prototypes.h"
+#include "string/strchr/stpspn.h"
/*
if ('-' == *s) {
s++;
}
- while (' ' == *s) {
- s++;
- }
+ s = stpspn(s, " ");
while (isnum && ('\0' != *s)) {
if (!isdigit (*s)) {
isnum = false;