2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
13 size_t strlcpy(char *dest
, const char *src
, size_t size
)
15 size_t ret
= strlen(src
);
18 size_t len
= (ret
>= size
) ? size
- 1 : ret
;
20 memcpy(dest
, src
, len
);
27 static inline int vslprintf(char *dst
, size_t size
, const char *fmt
, va_list ap
)
31 ret
= vsnprintf(dst
, size
, fmt
, ap
);
37 int slprintf(char *dst
, size_t size
, const char *fmt
, ...)
43 ret
= vslprintf(dst
, size
, fmt
, ap
);
49 int slprintf_nocheck(char *dst
, size_t size
, const char *fmt
, ...)
55 ret
= vslprintf(dst
, size
, fmt
, ap
);
61 noinline
void *xmemset(void *s
, int c
, size_t n
)
66 for (i
= 0; i
< n
; ++i
)
72 char *strtrim_right(char *p
, char c
)