diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-07-06 19:16:46 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-07-06 19:16:46 +0000 |
commit | b3bbcf5fcb95fdeddc3df57ff9537e59f900a405 (patch) | |
tree | 6e497b4281c4d8676afea7d67332db5fa13521b0 /usr.bin | |
parent | 6debbc103d5288094dc750c81d09d0f56d72c82c (diff) |
no need to redefine strlcpy here; millert@ ok
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/grep/util.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 9b0b0aee45d..992079266dd 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.12 2003/07/01 00:09:23 millert Exp $ */ +/* $OpenBSD: util.c,v 1.13 2003/07/06 19:16:45 avsm Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -525,29 +525,3 @@ printline(str_t *line, int sep) fwrite(line->dat, line->len, 1, stdout); putchar('\n'); } - -size_t -strlcpy(char *dst, const char *src, size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} |