extern size_t strlen(const char *Str);
extern char *strcpy(char *__dest, const char *__src);
extern char *strncpy(char *__dest, const char *__src, size_t max);
+extern char *strcat(char *__dest, const char *__src);
+extern char *strncat(char *__dest, const char *__src, size_t n);
extern int strcmp(const char *__str1, const char *__str2);
extern int strncmp(const char *Str1, const char *Str2, size_t num);
extern int strucmp(const char *Str1, const char *Str2);
EXPORT(strlen);
EXPORT(strcpy);
EXPORT(strncpy);
+EXPORT(strcat);
+EXPORT(strncat);
EXPORT(strcmp);
EXPORT(strncmp);
//EXPORT(strdup);
}
/**
- * \fn char *strcpy(char *__str1, const char *__str2)
* \brief Copy a string to a new location
*/
char *strcpy(char *__str1, const char *__str2)
}
/**
- * \fn char *strncpy(char *__str1, const char *__str2, size_t max)
* \brief Copy a string to a new location
+ * \note Copies at most `max` chars
*/
char *strncpy(char *__str1, const char *__str2, size_t max)
{
return __str1;
}
+/**
+ * \brief Append a string to another
+ */
+char *strcat(char *__dest, const char *__src)
+{
+ while(*__dest++);
+ while(*__src)
+ *__dest++ = *__src++;
+ *__dest = '\0';
+ return __dest;
+}
+
+/**
+ * \brief Append at most \a n chars to a string from another
+ * \note At most n+1 chars are written (the dest is always zero terminated)
+ */
+char *strncat(char *__dest, const char *__src, size_t n)
+{
+ while(*__dest++);
+ while(*__src && n-- >= 1)
+ *__dest++ = *__src++;
+ *__dest = '\0';
+ return __dest;
+}
+
/**
* \fn int strcmp(const char *str1, const char *str2)
* \brief Compare two strings return the difference between