diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-15 15:38:07 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-15 15:38:07 -0400 |
commit | 1f4e410fdcff7cc96c5a0c0fb97172871d0ae347 (patch) | |
tree | f2522eb7b3fe9868934abc2c3bbb8a1eab132878 /src/strings | |
parent | 81c9e19e3dfb3f99f7c16167734257aeca9ac922 (diff) |
implement in terms of <string.h> equivalent
Diffstat (limited to 'src/strings')
-rw-r--r-- | src/strings/bcmp.c | 3 | ||||
-rw-r--r-- | src/strings/bcopy.c | 4 | ||||
-rw-r--r-- | src/strings/bzero.c | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/strings/bcmp.c b/src/strings/bcmp.c index 0686ebdf..052beb7c 100644 --- a/src/strings/bcmp.c +++ b/src/strings/bcmp.c @@ -1,8 +1,9 @@ +#include <string.h> #include <strings.h> int bcmp(const void *s1, const void *s2, size_t n) { - return 0; + return memcmp(s1, s2, n); } /* diff --git a/src/strings/bcopy.c b/src/strings/bcopy.c index 0de75234..a464db8e 100644 --- a/src/strings/bcopy.c +++ b/src/strings/bcopy.c @@ -1,8 +1,10 @@ +#include <string.h> #include <strings.h> int bcopy(const void *s1, void *s2, size_t n) { - return 0; + memcpy(s1, s2, n); + return n; } /* diff --git a/src/strings/bzero.c b/src/strings/bzero.c index 3d15579c..383d55c3 100644 --- a/src/strings/bzero.c +++ b/src/strings/bzero.c @@ -1,8 +1,9 @@ +#include <string.h> #include <strings.h> -void bzero(void*s, size_t n) +void bzero(void* s, size_t n) { - return 0; + (void)memset(s, '\0', n); } /* |