mirror of
https://repo.or.cz/socat.git
synced 2025-07-04 12:26:32 +00:00
Again ported to NetBSD
This commit is contained in:
parent
b5b9ee0031
commit
2ab4b232fc
6 changed files with 43 additions and 3 deletions
17
utils.c
17
utils.c
|
@ -38,6 +38,23 @@ void *memdup(const void *src, size_t n) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
#if !HAVE_PROTOTYPE_LIB_strndup
|
||||
char *strndup(
|
||||
const char *s,
|
||||
size_t n)
|
||||
{
|
||||
char *m;
|
||||
m = malloc(n+1);
|
||||
if (m == NULL) {
|
||||
return m;
|
||||
}
|
||||
strncpy(m, s, n);
|
||||
m[n] = '\0';
|
||||
return m;
|
||||
}
|
||||
#endif /* !HAVE_PROTOTYPE_LIB_strndup */
|
||||
|
||||
|
||||
/* search the keyword-table for a match of the leading part of name. */
|
||||
/* returns the pointer to the matching field of the keyword or NULL if no
|
||||
keyword was found. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue