* `BSTRING', as far as I know, and neither of them use this code. */
#if HAVE_STRING_H || STDC_HEADERS
#include <string.h>
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
#else
#include <strings.h>
#endif
if (done)
return;
- bzero(re_syntax_table, sizeof re_syntax_table);
+ memset(re_syntax_table, 0, sizeof re_syntax_table);
for (c = 'a'; c <= 'z'; c++)
re_syntax_table[c] = Sword;
/* Assumes a `char *destination' variable. */
#define REGEX_REALLOCATE(source, osize, nsize) \
(destination = (char *) alloca (nsize), \
- bcopy (source, destination, osize), \
+ xmemcpy (destination, source, osize), \
destination)
#endif /* not REGEX_MALLOC */
BUF_PUSH((1 << BYTEWIDTH) / BYTEWIDTH);
/* Clear the whole map. */
- bzero(b, (1 << BYTEWIDTH) / BYTEWIDTH);
+ memset(b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
/* charset_not matches newline according to a syntax bit. */
if ((re_opcode_t) b[-2] == charset_not
assert(fastmap != NULL && p != NULL);
INIT_FAIL_STACK();
- bzero(fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
+ memset(fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */
bufp->fastmap_accurate = 1; /* It will be when we're done. */
bufp->can_be_null = 0;
* past them. */
if (translate
? bcmp_translate(d, d2, mcnt, translate)
- : bcmp(d, d2, mcnt))
+ : memcmp(d, d2, mcnt))
goto fail;
d += mcnt, d2 += mcnt;
}
/*
- * $Id: rfc1123.c,v 1.10 1997/12/30 02:50:36 wessels Exp $
+ * $Id: rfc1123.c,v 1.11 1998/01/02 22:39:15 kostas Exp $
*
* DEBUG:
* AUTHOR: Harvest Derived
day_offset = 1;
len = strftime(buf, 127 - 5, "%d/%b/%Y:%H:%M:%S ", lt);
- sprintf(buf + len, "%+03d%02d",
+ snprintf(buf + len, 128-len, "%+03d%02d",
(min_offset / 60) % 24,
min_offset % 60);
#else /* USE_GMT */
return 0;
if (a4 < 0 || a4 > 255)
return 0;
- sprintf(addrbuf, "%d.%d.%d.%d", a1, a2, a3, a4);
+ snprintf(addrbuf,32, "%d.%d.%d.%d", a1, a2, a3, a4);
A.s_addr = inet_addr(addrbuf);
if (addr)
addr->s_addr = A.s_addr;
/*
- * $Id: util.c,v 1.36 1997/12/02 00:17:27 wessels Exp $
+ * $Id: util.c,v 1.37 1998/01/02 22:39:17 kostas Exp $
*
* DEBUG:
* AUTHOR: Harvest Derived
break;
}
if (I == DBG_ARRY_SZ) {
- sprintf(msg, "xfree: ERROR: s=%p not found!", s);
+ snprintf(msg, 128, "xfree: ERROR: s=%p not found!", s);
(*failure_notify) (msg);
}
}
continue;
Q = P + malloc_size[B][I];
if (P <= p && p < Q) {
- sprintf(msg, "xmalloc: ERROR: p=%p falls in P=%p+%d",
+ snprintf(msg, 128, "xmalloc: ERROR: p=%p falls in P=%p+%d",
p, P, malloc_size[B][I]);
(*failure_notify) (msg);
}
sz = 1;
if ((p = malloc(sz)) == NULL) {
if (failure_notify) {
- sprintf(msg, "xmalloc: Unable to allocate %d bytes!\n",
+ snprintf(msg, 128, "xmalloc: Unable to allocate %d bytes!\n",
(int) sz);
(*failure_notify) (msg);
} else {
sz = 1;
if ((p = realloc(s, sz)) == NULL) {
if (failure_notify) {
- sprintf(msg, "xrealloc: Unable to reallocate %d bytes!\n",
+ snprintf(msg, 128, "xrealloc: Unable to reallocate %d bytes!\n",
(int) sz);
(*failure_notify) (msg);
} else {
sz = 1;
if ((p = calloc(n, sz)) == NULL) {
if (failure_notify) {
- sprintf(msg, "xcalloc: Unable to allocate %d blocks of %d bytes!\n",
+ snprintf(msg, 128, "xcalloc: Unable to allocate %d blocks of %d bytes!\n",
(int) n, (int) sz);
(*failure_notify) (msg);
} else {
static char xstrerror_buf[BUFSIZ];
if (errno < 0 || errno >= sys_nerr)
return ("Unknown");
- sprintf(xstrerror_buf, "(%d) %s", errno, strerror(errno));
+ snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", errno, strerror(errno));
return xstrerror_buf;
}
static char xbstrerror_buf[BUFSIZ];
if (err < 0 || err >= sys_nerr)
return ("Unknown");
- sprintf(xbstrerror_buf, "(%d) %s", err, strerror(err));
+ snprintf(xbstrerror_buf, BUFSIZ, "(%d) %s", err, strerror(err));
return xbstrerror_buf;
}
#endif