Chameleon

Chameleon Commit Details

Date:2014-01-11 22:24:45 (5 years 10 months ago)
Author:Chuck Fry
Commit:2335
Parents: 2334
Message:Implement stpcpy, stpncpy
Changes:
M/branches/chucko/i386/libsa/libsa.h
M/branches/chucko/i386/include/string.h
M/branches/chucko/i386/libsa/string.c

File differences

branches/chucko/i386/include/string.h
108108
109109
110110
111
111112
112113
113114
int strncmp(const char *, const char *, size_t);
char*strncpy(char *, const char *, size_t);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
char*stpncpy(char *, const char *, size_t);
char*strnstr(const char *, const char *, size_t);
#endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
char*strpbrk(const char *, const char *);
branches/chucko/i386/libsa/libsa.h
9494
9595
9696
97
9798
99
98100
99101
100102
extern int strcmp(const char * s1, const char * s2);
extern int strncmp(const char * s1, const char * s2, size_t n);
extern char * strcpy(char * s1, const char * s2);
extern char * stpcpy(char * s1, const char * s2);
extern char * strncpy(char * s1, const char * s2, size_t n);
extern char * strpcpy(char * s1, const char * s2, size_t n);
extern size_t strlcpy(char * s1, const char * s2, size_t n);
extern char * strstr(const char *in, const char *str);
extern int atoi(const char * str);
branches/chucko/i386/libsa/string.c
163163
164164
165165
166
167
168
169
170
171
172
173
166174
167175
168176
169177
170178
171
172
173
179
180
174181
175182
176183
177184
185
186
187
188
189
190
191
192
193
194
178195
179196
180197
}
char *
stpcpy(char * s1, const char * s2)
{
while ((*s1++ = *s2++))
continue;
return --s1;
}
char *
strncpy(char * s1, const char * s2, size_t n)
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
--n;
if (n > 0) {
bzero(s1, n);
}
if (n > 0)
bzero(s1, n);
return ret;
}
char *
stpncpy(char * s1, const char * s2, size_t n)
{
while (n && (*s1++ = *s2++))
--n;
if (n > 0)
bzero(s1, n);
return s1;
}
char *
strstr(const char *in, const char *str)
{
char c;

Archive Download the corresponding diff file

Revision: 2335