Skip to content

Commit

Permalink
Merge pull request #260 from VisorFolks/dev/akashkollipara/libc
Browse files Browse the repository at this point in the history
Add support for strcpy
  • Loading branch information
akashkollipara authored Dec 20, 2023
2 parents c6d5791 + b54bcff commit 5f9c8a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/libc/include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,10 @@ size_t strnlen(const char *i, size_t size);
* ret = pointer to first occurance
*/
char *strchr_rev(const char *i, int r);

/*
* Strcpy
* i = destination address
* j = source address
*/
size_t strcpy(char *i, const char *j);
5 changes: 5 additions & 0 deletions src/lib/libc/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,8 @@ char *strchr_rev(const char *i, int r)
}
return ret;
}

size_t strcpy(char *i, const char *j)
{
return strlcpy(i, j, strlen(j));
}

0 comments on commit 5f9c8a3

Please sign in to comment.