unsigned long strtoul(const char *nptr, char **endptr, int base);
quad_t strtoq(const char *nptr, char **endptr, int base);
u_quad_t strtouq(const char *nptr, char **endptr, int base);
-char *strchr(const char *str, int ch);
char *strncat(char *s1, const char *s2, unsigned long n);
}
-/*
- *
- */
-
-char *strchr(const char *str, int ch)
-{
- do {
- if (*str == ch)
- return(__CAST_AWAY_QUALIFIER(str, const, char *));
- } while (*str++);
- return ((char *) 0);
-}
-
/*
*
*/
char *
strncat(char *s1, const char *s2, unsigned long n)
{
- char *os1;
- int i = n;
-
- os1 = s1;
- while (*s1++)
- ;
- --s1;
- while ((*s1++ = *s2++))
- if (--i < 0) {
- *--s1 = '\0';
- break;
- }
- return(os1);
+ if (n != 0) {
+ char *d = s1;
+ const char *s = s2;
+
+ while (*d != 0)
+ d++;
+ do {
+ if ((*d = *s++) == '\0')
+ break;
+ d++;
+ } while (--n != 0);
+ *d = '\0';
+ }
+ return (s1);
}