/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include #include "str.h" size_t strlcpy(char *dest, const char *src, size_t size) { size_t ret = strlen(src); if (size) { size_t len = (ret >= size) ? size - 1 : ret; memcpy(dest, src, len); dest[len] = '\0'; } return ret; } static inline int vslprintf(char *dst, size_t size, const char *fmt, va_list ap) { int ret; ret = vsnprintf(dst, size, fmt, ap); dst[size - 1] = '\0'; return ret; } int slprintf(char *dst, size_t size, const char *fmt, ...) { int ret; va_list ap; va_start(ap, fmt); ret = vslprintf(dst, size, fmt, ap); va_end(ap); return ret; } int slprintf_nocheck(char *dst, size_t size, const char *fmt, ...) { int ret; va_list ap; va_start(ap, fmt); ret = vslprintf(dst, size, fmt, ap); va_end(ap); return ret; } noinline void *xmemset(void *s, int c, size_t n) { size_t i; uint8_t *ptr = s; for (i = 0; i < n; ++i) ptr[i] = (uint8_t) c; return ptr; } char *strtrim_right(char *p, char c) { char *end; size_t len; len = strlen(p); while (*p && len) { end = p + len - 1; if (c == *end) *end = 0; else break; len = strlen(p); } return p; } ected'>packet-loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 20:48:45 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 20:48:45 -0700
commit2c34ff14bf1d03a705f5400888ecac5b6400e981 (patch)
treedf5ec14776f77122c35b867c3aa539d762caa791 /init
parent07021b43597f506cc525d139ed1a94e79cf184f2 (diff)
parent9a2950fe9cb6882063181673846953d44f32cc3a (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32
Pull avr32 update from Hans-Christian Noren Egtvedt. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32: avr32: migrate exception table users off module.h and onto extable.h
Diffstat (limited to 'init')