/* Copy SRC to DEST. */char *__stpcpy (dest, src) char *dest; const char *src;{ register char *d = dest; register const char *s = src; do *d++ = *s; while (*s++ != '\0'); return d - 1;}
/* Append SRC on the end of DEST. */char *strcat (dest, src) char *dest; const char *src;{ char *s1 = dest; const char *s2 = src; reg_char c; /* Find the end of the string. */ do c = *s1++; while (c != '\0'); /* Make S1 point before the next character, so we can increment it while memory is read (wins on pipelined cpus). */ s1 -= 2; do { c = *s2++; *++s1 = c; } while (c != '\0'); return dest;}
/* Parse S into tokens separated by characters in DELIM. If S is NULL, the last string strtok() was called with is used. For example: char s[] = "-abc-=-def"; x = strtok(s, "-"); // x = "abc" x = strtok(NULL, "-="); // x = "def" x = strtok(NULL, "="); // x = NULL // s = "abc\0=-def\0"*/char *strtok (s, delim) char *s; const char *delim;{ char *token; if (s == NULL) s = olds; /* Scan leading delimiters. */ s += strspn (s, delim); if (*s == '\0') { olds = s; return NULL; } /* Find the end of the token. */ token = s; s = strpbrk (token, delim); if (s == NULL) /* This token finishes the string. */ olds = __rawmemchr (token, '\0'); else { /* Terminate the token and make OLDS point past it. */ *s = '\0'; olds = s + 1; } return token;}