diff options
Diffstat (limited to 'usr.sbin/ppp/defs.c')
-rw-r--r-- | usr.sbin/ppp/defs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index 0e61f8841b80..78ef1dc0f5f4 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -387,3 +387,20 @@ zerofdset(fd_set *s) { memset(s, '\0', howmany(getdtablesize(), NFDBITS) * sizeof (fd_mask)); } + +void +Concatinate(char *buf, size_t sz, int argc, const char *const *argv) +{ + int i, n, pos; + + *buf = '\0'; + for (pos = i = 0; i < argc; i++) { + n = snprintf(buf + pos, sz - pos, "%s%s", i ? " " : "", argv[i]); + if (n < 0) { + buf[pos] = '\0'; + break; + } + if ((pos += n) >= sz) + break; + } +} |