/* * @author xamidev * @brief String manipulation utilities * @license GPL-3.0-only */ #include char* strcpy(char *dest, const char *src) { char *temp = dest; while((*dest++ = *src++)); return temp; } // https://stackoverflow.com/questions/2488563/strcat-implementation char *strcat(char *dest, const char *src){ size_t i,j; for (i = 0; dest[i] != '\0'; i++) ; for (j = 0; src[j] != '\0'; j++) dest[i+j] = src[j]; dest[i+j] = '\0'; return dest; } // https://stackoverflow.com/questions/14159625/implementation-of-strncpy void strncpy(char* dst, const char* src, size_t n) { size_t i = 0; while(i++ != n && (*dst++ = *src++)); }