diff options
-rw-r--r-- | com32/include/string.h | 1 | ||||
-rw-r--r-- | com32/lib/Makefile | 4 | ||||
-rw-r--r-- | com32/lib/strpcpy.c | 20 |
3 files changed, 23 insertions, 2 deletions
diff --git a/com32/include/string.h b/com32/include/string.h index af9792b6..c964ee3b 100644 --- a/com32/include/string.h +++ b/com32/include/string.h @@ -23,6 +23,7 @@ __extern char *strcat(char *, const char *); __extern char *strchr(const char *, int); __extern int strcmp(const char *, const char *); __extern char *strcpy(char *, const char *); +__extern char *strpcpy(char *, const char *); __extern size_t strcspn(const char *, const char *); __extern char *strdup(const char *); __extern char *strndup(const char *, size_t); diff --git a/com32/lib/Makefile b/com32/lib/Makefile index 6f759e0c..6c137f9d 100644 --- a/com32/lib/Makefile +++ b/com32/lib/Makefile @@ -17,8 +17,8 @@ LIBOBJS = \ exit.o onexit.o \ perror.o printf.o puts.o qsort.o realloc.o seed48.o snprintf.o \ sprintf.o srand48.o sscanf.o stack.o strcasecmp.o strcat.o \ - strchr.o strcmp.o strcpy.o strdup.o strerror.o strlen.o \ - strnlen.o \ + strchr.o strcmp.o strcpy.o strpcpy.o strdup.o strlen.o \ + strerror.o strnlen.o \ strncasecmp.o strncat.o strncmp.o strncpy.o strndup.o \ stpcpy.o stpncpy.o \ strntoimax.o strntoumax.o strrchr.o strsep.o strspn.o strstr.o \ diff --git a/com32/lib/strpcpy.c b/com32/lib/strpcpy.c new file mode 100644 index 00000000..e181e78f --- /dev/null +++ b/com32/lib/strpcpy.c @@ -0,0 +1,20 @@ +/* + * strpcpy.c + * + * strpcpy() - strcpy() which returns a pointer to the final null + */ + +#include <string.h> + +char *strpcpy(char *dst, const char *src) +{ + char *q = dst; + const char *p = src; + char ch; + + do { + *q++ = ch = *p++; + } while ( ch ); + + return q-1; +} |