-/* $OpenBSD: commands.c,v 1.64 2014/07/20 09:31:25 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.65 2014/07/20 09:59:42 guenther Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
{
static char lsr[44];
char *cp, *cp2, *lsrp, *lsrep;
- struct in_addr sin_addr;
+ struct in_addr addr;
struct hostent *host = 0;
char c;
cp++;
- sin_addr.s_addr = 0;
+ addr.s_addr = 0;
for (c = 0;;) {
if (c == ':')
if (!c)
cp2 = 0;
- if ((sin_addr.s_addr = inet_addr(cp)) != INADDR_NONE) {
- } else if ((host = gethostbyname(cp))) {
- memmove((caddr_t)&sin_addr,
- host->h_addr_list[0],
- sizeof(sin_addr));
- } else {
- *cpp = cp;
- return(0);
+ if ((addr.s_addr = inet_addr(cp)) == INADDR_NONE) {
+ if ((host = gethostbyname(cp)) == NULL) {
+ *cpp = cp;
+ return(0);
+ }
+ memcpy(&addr, host->h_addr_list[0], sizeof addr);
}
- memmove(lsrp, (char *)&sin_addr, 4);
+ memcpy(lsrp, &addr, 4);
lsrp += 4;
if (cp2)
cp = cp2;
}
*lsrp++ = IPOPT_NOP; /* 32 bit word align it */
*lenp = lsrp - *cpp;
- return(sin_addr.s_addr);
+ return(addr.s_addr);
}
-/* $OpenBSD: ring.c,v 1.8 2014/07/20 08:12:46 guenther Exp $ */
+/* $OpenBSD: ring.c,v 1.9 2014/07/20 09:59:42 guenther Exp $ */
/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */
/*
*/
/* Internal macros */
-
-#if !defined(MIN)
-#define MIN(a,b) (((a)<(b))? (a):(b))
-#endif /* !defined(MIN) */
-
#define ring_subtract(d,a,b) (((a)-(b) >= 0)? \
(a)-(b): (((a)-(b))+(d)->size))
int i;
while (count) {
- i = MIN(count, ring_empty_consecutive(ring));
- memmove(ring->supply, buffer, i);
+ i = ring_empty_consecutive(ring);
+ if (i > count)
+ i = count;
+ memcpy(ring->supply, buffer, i);
ring_supplied(ring, i);
count -= i;
buffer += i;
-/* $OpenBSD: sys_bsd.c,v 1.22 2014/07/20 09:31:25 guenther Exp $ */
+/* $OpenBSD: sys_bsd.c,v 1.23 2014/07/20 09:59:42 guenther Exp $ */
/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
/*
void
TerminalDefaultChars()
{
- memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
+ memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
# ifndef VDISCARD
termFlushChar = CONTROL('O');
# endif