#include <signal.h>
#include <sys/socket.h>
-extern int errno;
-
#ifdef DEBUGMODE
int writecalls = 0, writeb[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#endif
}
ban = make_ban ();
- bzero ((char *) ban, sizeof (Ban));
+ memset ((char *) ban, 0, sizeof (Ban));
/* ban->flags = CHFL_BAN; They're all bans!! */
ban->next = chptr->banlist;
ban->banstr = (char *) MyMalloc (strlen (banid) + 1);
}
ban = make_ban ();
- bzero ((char *) ban, sizeof (Ban));
+ memset ((char *) ban, 0, sizeof (Ban));
/* ban->flags = CHFL_BAN; They're all bans!! */
ban->next = chptr->exbanlist;
ban->banstr = (char *) MyMalloc (strlen (banid) + 1);
}
ban = make_ban ();
- bzero ((char *) ban, sizeof (Ban));
+ memset ((char *) ban, 0, sizeof (Ban));
/* ban->flags = CHFL_BAN; They're all bans!! */
ban->next = chptr->hostrestrictlist;
ban->banstr = (char *) MyMalloc (strlen (banid) + 1);
char *user;
char *host;
- if ((user = index ((cp = mask), '!')))
+ if ((user = strchr ((cp = mask), '!')))
*user++ = '\0';
- if ((host = rindex (user ? user : cp, '@'))) {
+ if ((host = strrchr (user ? user : cp, '@'))) {
*host++ = '\0';
if (!user)
return make_nick_user_host (NULL, cp, host);
}
- else if (!user && index (cp, '.'))
+ else if (!user && strchr (cp, '.'))
return make_nick_user_host (NULL, NULL, cp);
return make_nick_user_host (cp, user, host);
}
if (parc < 1)
return 0;
mode = &(chptr->mode);
- bcopy ((char *) mode, (char *) &oldm, sizeof (Mode));
+ memcpy ((char *) &oldm, (char *) mode, sizeof (Mode));
/* Mode is accepted when sptr is a channel operator
* but also when the mode is received from a server. --Run
*/
}
*bmbuf++ = 'l';
(void) sprintf (numeric, "%-15d", mode->limit);
- if ((cp = index (numeric, ' ')))
+ if ((cp = strchr (numeric, ' ')))
*cp = '\0';
(void) strcat (bpbuf, numeric);
blen += strlen (numeric);
case MODE_LIMIT:
c = 'l';
(void) sprintf (numeric, "%-15d", nusers);
- if ((cp = index (numeric, ' ')))
+ if ((cp = strchr (numeric, ' ')))
*cp = '\0';
cp = numeric;
break;
bwhatt = MODE_ADD;
}
(void) sprintf (numeric, "%-15d", mode->limit);
- if ((cp = index (numeric, ' ')))
+ if ((cp = strchr (numeric, ' ')))
*cp = '\0';
(void) strcat (bpbuf, numeric);
blen += strlen (numeric);
if (*chname == '&' && IsServer (cptr))
return -1;
- s = rindex (chname, ':');
+ s = strrchr (chname, ':');
if (!s)
return 0;
return (chptr);
if (flag == CREATE) {
chptr = (aChannel *) MyMalloc (sizeof (aChannel) + len);
- bzero ((char *) chptr, sizeof (aChannel));
+ memset ((char *) chptr, 0, sizeof (aChannel));
strncpyzt (chptr->chname, chname, len + 1);
if (channel)
channel->prevch = chptr;
* Changed to default to ignoring channels with only
* 1 person on, to decrease floods... -Donwulff
*/
- bzero (lopt, sizeof (LOpts)); /* To be sure! */
+ memset (lopt, 0, sizeof (LOpts)); /* To be sure! */
lopt->next = (LOpts *) NULL;
lopt->yeslist = lopt->nolist = (Link *) NULL;
lopt->usermin = 0; /* Default */
cptr->flags2 |= FLAGS2_HTC; /* To prevent a dead socket */
if (!BadPtr (para)) {
- s = index (para, ',');
+ s = strchr (para, ',');
if (s) {
parv[1] = ++s;
(void) m_names (cptr, sptr, parc, parv);
for (lp = user->user->channel; lp; lp = lp->next) {
chptr = lp->value.chptr;
- if ((mask = index (chptr->chname, ':')))
+ if ((mask = strchr (chptr->chname, ':')))
if (match (++mask, cptr->name))
continue;
if (*chptr->chname == '&')
#undef free
#define MyMalloc(x) malloc(x)
-#define Reg register
+#define Reg
static void new_class ();
static char *getfield (), confchar ();
aconf->passwd = (char *) NULL;
aconf->name = (char *) NULL;
aconf->class = (aClass *) NULL;
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = 0;
else
while (dgets (fd, c, sizeof (c) - 1))
- if ((tmp = (char *) index (c, '\n'))) {
+ if ((tmp = (char *) strchr (c, '\n'))) {
*tmp = 0;
break;
}
if (!aconf->host)
(void) fprintf (stderr, "\tERROR: %s\n",
"null host field in P-line");
- else if (index (aconf->host, '/'))
+ else if (strchr (aconf->host, '/'))
(void) fprintf (stderr,
"%u:\tWARNING: / present in P-line "
"UNIXPORT configuration no longer supported\n",
goto print_confline;
}
if (aconf->status & CONF_SERVER_MASK &&
- (!aconf->host || index (aconf->host, '*') ||
- index (aconf->host, '?'))) {
+ (!aconf->host || strchr (aconf->host, '*') ||
+ strchr (aconf->host, '?'))) {
(void) fprintf (stderr, "\tERROR: bad host field\n");
continue;
}
continue;
}
if (aconf->status & (CONF_SERVER_MASK | CONF_OPS))
- if (!index (aconf->host, '@')) {
+ if (!strchr (aconf->host, '@')) {
char *newhost;
int len = 3; /* *@\0 = 3 */
return (NULL);
field = line;
- if ((end = (char *) index (line, ':')) == NULL) {
+ if ((end = (char *) strchr (line, ':')) == NULL) {
line = NULL;
- if ((end = (char *) index (field, '\n')) == NULL)
+ if ((end = (char *) strchr (field, '\n')) == NULL)
end = field + strlen (field);
}
else
}
if (chunk > length)
chunk = length;
- bcopy (buf, d->data + off, chunk);
+ memcpy (d->data + off, buf, chunk);
length -= chunk;
buf += chunk;
off = 0;
while (length > 0 && (b = dbuf_map (dyn, &chunk)) != NULL) {
if (chunk > length)
chunk = length;
- bcopy (b, buf, (int) chunk);
+ memcpy (buf, b, (int) chunk);
(void) dbuf_delete (dyn, chunk);
buf += chunk;
length -= chunk;
int dbuf_getmsg (dyn, buf, length)
dbuf *dyn;
char *buf;
- register int length;
+ int length;
{
dbufbuf *d;
- register char *s;
- register int dlen;
- register int i;
+ char *s;
+ int dlen;
+ int i;
int copy;
getmsg_init:
/* Quick & dirty inline version of mycmp for hash-tables -Donwulff */
#define thecmp(str1, str2, where) { \
- register char *st1=str1, *st2=str2; \
+ char *st1=str1, *st2=str2; \
while (tolower(*st1)==tolower(*st2)) \
{ \
if (!*st1) goto where; \
(aHashEntry *) MyMalloc (HASHSIZE * sizeof (aHashEntry));
#endif /* DEBUGMODE */
- bzero ((char *) clientTable, sizeof (aHashEntry) * HASHSIZE);
+ memset ((char *) clientTable, 0, sizeof (aHashEntry) * HASHSIZE);
}
void clear_channel_hash_table ()
channelTable = (aHashEntry *) MyMalloc (CHANNELHASHSIZE *
sizeof (aHashEntry));
#endif /* DEBUGMODE */
- bzero ((char *) channelTable, sizeof (aHashEntry) * CHANNELHASHSIZE);
+ memset ((char *) channelTable, 0, sizeof (aHashEntry) * CHANNELHASHSIZE);
}
void clear_notify_hash_table (void)
{
- bzero ((char *) notifyTable, sizeof (notifyTable));
+ memset ((char *) notifyTable, 0, sizeof (notifyTable));
}
/*
int hashv;
char *serv;
- serv = index (name, '@');
+ serv = strchr (name, '@');
*serv++ = '\0';
hashv = hash_nn_name (name) % HASHSIZE;
c_move_to_top:
chhits++;
if (prv) {
- register aChannel *tmp2;
+ aChannel *tmp2;
tmp2 = (aChannel *) tmp3->list;
tmp3->list = (void *) tmp;
return chptr;
c_move_to_top:
if (prv) {
- register aChannel *tmp2;
+ aChannel *tmp2;
tmp2 = (aChannel *) channelTable[hashv];
channelTable[hashv] = (void *) tmp;
char *parv[];
{
#ifdef DEBUGMODE
- register int l, i;
- register aHashEntry *tab;
+ int l, i;
+ aHashEntry *tab;
int deepest = 0, deeplink = 0, showlist = 0, tothits = 0;
int mosthit = 0, mosthits = 0, used = 0, used_now = 0, totlink = 0;
int link_pop[10], size = HASHSIZE;
case 'V':
case 'v':
{
- register aClient *acptr;
+ aClient *acptr;
int bad = 0, listlength = 0;
for (acptr = client; acptr; acptr = acptr->next) {
int fd;
char buff[20];
if ((fd = open (LUSERS, O_CREAT | O_WRONLY, 0600)) >= 0) {
- bzero (buff, sizeof (buff));
+ memset (buff, 0, sizeof (buff));
(void) sprintf (buff, "%i %i\n", lu_mglobalu, lu_mlu);
if (write (fd, buff, strlen (buff)) == -1)
(void) close (fd);
myargv = argv;
(void) umask (077); /* better safe than sorry --SRB */
- bzero ((char *) &me, sizeof (me));
+ memset ((char *) &me, 0, sizeof (me));
setup_signals ();
initload ();
void initlists ()
{
#ifdef DEBUGMODE
- bzero ((char *) &cloc, sizeof (cloc));
- bzero ((char *) &crem, sizeof (crem));
- bzero ((char *) &users, sizeof (users));
- bzero ((char *) &servs, sizeof (servs));
- bzero ((char *) &links, sizeof (links));
- bzero ((char *) &classs, sizeof (classs));
- bzero ((char *) &aconfs, sizeof (aconfs));
+ memset ((char *) &cloc, 0, sizeof (cloc));
+ memset ((char *) &crem, 0, sizeof (crem));
+ memset ((char *) &users, 0, sizeof (users));
+ memset ((char *) &servs, 0, sizeof (servs));
+ memset ((char *) &links, 0, sizeof (links));
+ memset ((char *) &classs, 0, sizeof (classs));
+ memset ((char *) &aconfs, 0, sizeof (aconfs));
#endif
}
if (!(cptr = (aClient *) MyMalloc (size)))
outofmemory ();
- bzero ((char *) cptr, (int) size);
+ memset ((char *) cptr, 0, (int) size);
#ifdef DEBUGMODE
if (size == CLIENT_LOCAL_SIZE)
#ifdef DEBUGMODE
aconfs.inuse++;
#endif
- bzero ((char *) &aconf->ipnum, sizeof (struct in_addr));
+ memset ((char *) &aconf->ipnum, 0, sizeof (struct in_addr));
aconf->next = NULL;
aconf->host = aconf->passwd = aconf->name = NULL;
aconf->status = CONF_ILLEGAL;
del_queries ((char *) aconf);
MyFree (aconf->host);
if (aconf->passwd)
- bzero (aconf->passwd, strlen (aconf->passwd));
+ memset (aconf->passwd, 0, strlen (aconf->passwd));
MyFree (aconf->passwd);
MyFree (aconf->name);
MyFree ((char *) aconf);
char *buffer;
int length;
{
- register char *ch1;
- register char *ch2;
+ char *ch1;
+ char *ch2;
int zipped = 0;
int unzipped_length = 0;
#endif
while (--length >= 0 && ch2) {
- register char g = (*ch1 = *ch2++);
+ char g = (*ch1 = *ch2++);
/*
* Yuck. Stuck. To make sure we stay backward compatible,
* we must assume that either CR or LF terminates the message
if ((c2ptr = hash_find_server (name, cptr)))
return (c2ptr);
- if (!index (name, '*'))
+ if (!strchr (name, '*'))
return c2ptr;
for (c2ptr = client; c2ptr; c2ptr = c2ptr->next) {
if (!IsServer (c2ptr) && !IsMe (c2ptr))
continue;
if (match (name, c2ptr->name) == 0)
break;
- if (index (c2ptr->name, '*'))
+ if (strchr (c2ptr->name, '*'))
if (match (c2ptr->name, name) == 0)
break;
}
from = find_client (sender, (aClient *) NULL);
if (!from || match (from->name, sender))
from = find_server (sender, (aClient *) NULL);
- else if (!from && index (sender, '@'))
+ else if (!from && strchr (sender, '@'))
from = find_nickserv (sender, (aClient *) NULL);
para[0] = sender;
** numerics must have paramters and thus a space after the command
** code. -avalon
*/
- s = (char *) index (ch, ' '); /* s -> End of the command code */
+ s = (char *) strchr (ch, ' '); /* s -> End of the command code */
len = (s) ? (s - ch) : 0;
if (len == 3 && isdigit (*ch) && isdigit (*(ch + 1))
&& isdigit (*(ch + 2))) {
return (NULL);
field = line;
- if ((end = (char *) index (line, ':')) == NULL) {
+ if ((end = (char *) strchr (line, ':')) == NULL) {
line = NULL;
- if ((end = (char *) index (field, '\n')) == NULL)
+ if ((end = (char *) strchr (field, '\n')) == NULL)
end = field + strlen (field);
}
else
* Do kill if it came from a server because it means there is a ghost
* user on the other server which needs to be removed. -avalon
*/
- if (!index (sender, '.'))
+ if (!strchr (sender, '.'))
sendto_one (cptr, ":%s KILL %s :%s (%s(?) <- %s)",
me.name, sender, me.name, sender,
get_client_name (cptr, FALSE));
#undef DEBUG /* because there is a lot of debug code in here :-) */
-extern int errno, h_errno;
extern int highest_fd;
extern aClient *local[];
int ret = 0;
if (op & RES_INITLIST) {
- bzero ((char *) &reinfo, sizeof (reinfo));
+ memset ((char *) &reinfo, 0, sizeof (reinfo));
first = last = NULL;
}
if (op & RES_CALLINIT) {
_res.options |= RES_DEBUG;
#endif
if (op & RES_INITCACH) {
- bzero ((char *) &cainfo, sizeof (cainfo));
- bzero ((char *) hashtable, sizeof (hashtable));
+ memset ((char *) &cainfo, 0, sizeof (cainfo));
+ memset ((char *) hashtable, 0, sizeof (hashtable));
}
if (op == 0)
ret = resfd;
ResRQ *nreq;
nreq = (ResRQ *) MyMalloc (sizeof (ResRQ));
- bzero ((char *) nreq, sizeof (ResRQ));
+ memset ((char *) nreq, 0, sizeof (ResRQ));
nreq->next = NULL; /* where NULL is non-zero ;) */
nreq->sentat = time (NULL);
nreq->retries = 3;
nreq->resend = 1;
nreq->srch = -1;
if (lp)
- bcopy ((char *) lp, (char *) &nreq->cinfo, sizeof (Link));
+ memcpy ((char *) &nreq->cinfo, (char *) lp, sizeof (Link));
else
- bzero ((char *) &nreq->cinfo, sizeof (Link));
+ memset ((char *) &nreq->cinfo, 0, sizeof (Link));
nreq->timeout = 4; /* start at 4 and exponential inc. */
nreq->he.h_addrtype = AF_INET;
nreq->he.h_name = NULL;
(void) strncpy (hname, name, sizeof (hname) - 1);
len = strlen (hname);
- if (rptr && !index (hname, '.') && _res.options & RES_DEFNAMES) {
+ if (rptr && !strchr (hname, '.') && _res.options & RES_DEFNAMES) {
(void) strncat (hname, dot, sizeof (hname) - len - 1);
len++;
(void) strncat (hname, _res.defdname, sizeof (hname) - len - 1);
rptr = make_request (lp);
rptr->type = T_PTR;
rptr->addr.s_addr = numb->s_addr;
- bcopy ((char *) &numb->s_addr,
- (char *) &rptr->he.h_addr, sizeof (struct in_addr));
+ memcpy ((char *) &rptr->he.h_addr, (char *) &numb->s_addr, sizeof (struct in_addr));
rptr->he.h_length = sizeof (struct in_addr);
}
return (query_name (ipbuf, C_IN, T_PTR, rptr));
HEADER *hptr;
Debug ((DEBUG_DNS, "query_name: na %s cl %d ty %d", name, class, type));
- bzero (buf, sizeof (buf));
+ memset (buf, 0, sizeof (buf));
r = res_mkquery (QUERY, name, class, type, NULL, 0, NULL,
buf, sizeof (buf));
if (r <= 0) {
len = strlen (hostbuf);
/* name server never returns with trailing '.' */
- if (!index (hostbuf, '.') && (_res.options & RES_DEFNAMES)) {
+ if (!strchr (hostbuf, '.') && (_res.options & RES_DEFNAMES)) {
(void) strcat (hostbuf, dot);
len++;
(void) strncat (hostbuf, _res.defdname,
hp->h_length = dlen;
if (ans == 1)
hp->h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC;
- bcopy (cp, (char *) &dr, dlen);
+ memcpy ((char *) &dr, cp, dlen);
adr->s_addr = dr.s_addr;
Debug ((DEBUG_INFO, "got ip # %s for %s",
inetntoa ((char *) adr), hostbuf));
for (a = 0; a < max; a++)
if (!_res.nsaddr_list[a].sin_addr.s_addr ||
- !bcmp ((char *) &sin.sin_addr,
- (char *) &_res.nsaddr_list[a].sin_addr,
- sizeof (struct in_addr)))
+ !memcmp ((char *) &sin.sin_addr, (char *) &_res.nsaddr_list[a].sin_addr, sizeof (struct in_addr)))
break;
if (a == max) {
reinfo.re_unkrep++;
*/
if ((hp2 = gethost_byname (rptr->he.h_name, &rptr->cinfo)))
if (lp)
- bcopy ((char *) &rptr->cinfo, lp, sizeof (Link));
+ memcpy (lp, (char *) &rptr->cinfo, sizeof (Link));
/*
* If name wasn't found, a request has been queued and it will
* be the last one queued. This is rather nasty way to keep
}
if (a > 0) {
if (lp)
- bcopy ((char *) &rptr->cinfo, lp, sizeof (Link));
+ memcpy (lp, (char *) &rptr->cinfo, sizeof (Link));
cp = make_cache (rptr);
#ifdef DEBUG
Debug ((DEBUG_INFO, "get_res:cp=%#x rptr=%#x (made)", cp, rptr));
resend_query (rptr);
}
else if (lp)
- bcopy ((char *) &rptr->cinfo, lp, sizeof (Link));
+ memcpy (lp, (char *) &rptr->cinfo, sizeof (Link));
}
return (struct hostent *) NULL;
}
for (s = (char *) &rptr->he.h_addr.s_addr;
((struct in_addr *) s)->s_addr; s += sizeof (struct in_addr)) {
for (i = 0; (t = cp->he.h_addr_list[i]); i++)
- if (!bcmp (s, t, sizeof (struct in_addr)))
+ if (!memcmp (s, t, sizeof (struct in_addr)))
break;
if (i >= MAXADDRS || addrcount >= MAXADDRS)
break;
t += sizeof (struct in_addr);
}
*base = NULL;
- bcopy (s, *--base, sizeof (struct in_addr));
+ memcpy (*--base, s, sizeof (struct in_addr));
}
}
return;
for (; cp; cp = cp->hnum_next)
for (i = 0; cp->he.h_addr_list[i]; i++)
- if (!bcmp (cp->he.h_addr_list[i], numb, sizeof (struct in_addr))) {
+ if (!memcmp (cp->he.h_addr_list[i], numb, sizeof (struct in_addr))) {
cainfo.ca_nu_hits++;
update_list (rptr, cp);
return cp;
if (hashv == hash_number ((u_char *) cp->he.h_addr_list[0]))
continue;
for (i = 1; cp->he.h_addr_list[i]; i++)
- if (!bcmp (cp->he.h_addr_list[i], numb, sizeof (struct in_addr))) {
+ if (!memcmp (cp->he.h_addr_list[i], numb, sizeof (struct in_addr))) {
cainfo.ca_nu_hits++;
update_list (rptr, cp);
return cp;
** a matching entry wasnt found in the cache so go and make one up.
*/
cp = (aCache *) MyMalloc (sizeof (aCache));
- bzero ((char *) cp, sizeof (aCache));
+ memset ((char *) cp, 0, sizeof (aCache));
hp = &cp->he;
for (i = 0; i < MAXADDRS; i++)
** build two arrays, one for IP#'s, another of pointers to them.
*/
t = hp->h_addr_list = (char **) MyMalloc (sizeof (char *) * (i + 1));
- bzero ((char *) t, sizeof (char *) * (i + 1));
+ memset ((char *) t, 0, sizeof (char *) * (i + 1));
s = (char *) MyMalloc (sizeof (struct in_addr) * i);
- bzero (s, sizeof (struct in_addr) * i);
+ memset (s, 0, sizeof (struct in_addr) * i);
for (n = 0; n < i; n++, s += sizeof (struct in_addr)) {
*t++ = s;
- bcopy ((char *) &(rptr->he.h_addr_list[n].s_addr), s,
- sizeof (struct in_addr));
+ memcpy (s, (char *) &(rptr->he.h_addr_list[n].s_addr), sizeof (struct in_addr));
}
*t = (char *) NULL;
{
#ifdef RES_INIT
/* try to fix up unqualified names */
- if (!index (hname, '.')) {
+ if (!strchr (hname, '.')) {
if (!(_res.options & RES_INIT)) {
Debug ((DEBUG_DNS, "res_init()"));
res_init ();
int fd;
char buff[20];
if ((fd = open (IRCD_PIDFILE, O_CREAT | O_WRONLY, 0600)) >= 0) {
- bzero (buff, sizeof (buff));
+ memset (buff, 0, sizeof (buff));
(void) sprintf (buff, "%5d\n", (int) getpid ());
if (write (fd, buff, strlen (buff)) == -1)
Debug ((DEBUG_NOTICE, "Error writing to pid file %s",
/* If descriptor is a tty, special checking... */
if (isatty (cptr->fd)) {
strncpyzt (sockn, me.sockhost, HOSTLEN);
- bzero ((char *) &sk, sizeof (struct sockaddr_in));
+ memset ((char *) &sk, 0, sizeof (struct sockaddr_in));
}
else if (getpeername (cptr->fd, (struct sockaddr *) &sk, &len) == -1) {
report_error ("connect failure: %s %s", cptr);
cptr->hostp = NULL;
strncpyzt (sockn, me.sockhost, HOSTLEN);
}
- bcopy ((char *) &sk.sin_addr, (char *) &cptr->ip,
- sizeof (struct in_addr));
+ memcpy ((char *) &cptr->ip, (char *) &sk.sin_addr, sizeof (struct in_addr));
cptr->port = (int) ntohs (sk.sin_port);
return 0;
*/
if (hp) {
for (i = 0; hp->h_addr_list[i]; i++)
- if (!bcmp (hp->h_addr_list[i], (char *) &cptr->ip,
- sizeof (struct in_addr)))
+ if (!memcmp (hp->h_addr_list[i], (char *) &cptr->ip, sizeof (struct in_addr)))
break;
if (!hp->h_addr_list[i]) {
sendto_ops ("IP# Mismatch: %s != %s[%08x]",
lin.value.aconf = aconf;
lin.flags = ASYNC_CONF;
nextdnscheck = 1;
- if ((s = index (aconf->host, '@')))
+ if ((s = strchr (aconf->host, '@')))
s++;
else
s = aconf->host;
check_serverback:
if (hp) {
for (i = 0; hp->h_addr_list[i]; i++)
- if (!bcmp (hp->h_addr_list[i], (char *) &cptr->ip,
- sizeof (struct in_addr)))
+ if (!memcmp (hp->h_addr_list[i], (char *) &cptr->ip, sizeof (struct in_addr)))
break;
if (!hp->h_addr_list[i]) {
sendto_ops ("IP# Mismatch: %s != %s[%08x]",
(void) attach_confs (cptr, name, CONF_HUB | CONF_UWORLD);
if ((c_conf->ipnum.s_addr == -1) && !IsUnixSocket (cptr))
- bcopy ((char *) &cptr->ip, (char *) &c_conf->ipnum,
- sizeof (struct in_addr));
+ memcpy ((char *) &c_conf->ipnum, (char *) &cptr->ip, sizeof (struct in_addr));
if (!IsUnixSocket (cptr))
get_sockhost (cptr, c_conf->host);
cptr->fd = -2;
DBufClear (&cptr->sendQ);
DBufClear (&cptr->recvQ);
- bzero (cptr->passwd, sizeof (cptr->passwd));
+ memset (cptr->passwd, 0, sizeof (cptr->passwd));
/*
* clean up extra sockets from P-lines which have been
* discarded.
* have something valid to put into error messages...
*/
get_sockhost (acptr, (char *) inetntoa ((char *) &addr.sin_addr));
- bcopy ((char *) &addr.sin_addr, (char *) &acptr->ip,
- sizeof (struct in_addr));
+ memcpy ((char *) &acptr->ip, (char *) &addr.sin_addr, sizeof (struct in_addr));
/* Check for zaps -- Barubary */
if (find_zap (acptr, 0)) {
set_non_blocking (fd, acptr);
if (aconf2->status == CONF_CONNECT_SERVER &&
(match (inetntoa ((char *) &addr.sin_addr), aconf2->host) == 0
|| match (inetntoa ((char *) &addr.sin_addr),
- index (aconf2->host, '@') + 1) == 0))
+ strchr (aconf2->host, '@') + 1) == 0))
break;
if (!aconf2) {
(match (inetntoa ((char *) &addr.sin_addr), aconf2->host)
== 0
|| match (inetntoa ((char *) &addr.sin_addr),
- index (aconf2->host, '@') + 1) == 0))
+ strchr (aconf2->host, '@') + 1) == 0))
break;
}
lin.flags = ASYNC_CONNECT;
lin.value.aconf = aconf;
nextdnscheck = 1;
- s = (char *) index (aconf->host, '@');
+ s = (char *) strchr (aconf->host, '@');
s++; /* should NEVER be NULL */
if ((aconf->ipnum.s_addr = inet_addr (s)) == -1) {
aconf->ipnum.s_addr = 0;
hp, aconf, aconf->name, s));
if (!hp)
return 0;
- bcopy (hp->h_addr, (char *) &aconf->ipnum,
- sizeof (struct in_addr));
+ memcpy ((char *) &aconf->ipnum, hp->h_addr, sizeof (struct in_addr));
}
}
cptr = make_client (NULL, NULL);
return NULL;
}
mysk.sin_port = 0;
- bzero ((char *) &server, sizeof (server));
+ memset ((char *) &server, 0, sizeof (server));
server.sin_family = AF_INET;
get_sockhost (cptr, aconf->host);
report_error ("error binding to local port for %s:%s", cptr);
return NULL;
}
- bzero ((char *) &server, sizeof (server));
+ memset ((char *) &server, 0, sizeof (server));
server.sin_family = AF_INET;
/*
* By this point we should know the IP# of the host listed in the
Debug ((DEBUG_FATAL, "%s: unknown host", aconf->host));
return NULL;
}
- bcopy (hp->h_addr, (char *) &aconf->ipnum, sizeof (struct in_addr));
+ memcpy ((char *) &aconf->ipnum, hp->h_addr, sizeof (struct in_addr));
}
- bcopy ((char *) &aconf->ipnum, (char *) &server.sin_addr,
- sizeof (struct in_addr));
- bcopy ((char *) &aconf->ipnum, (char *) &cptr->ip,
- sizeof (struct in_addr));
+ memcpy ((char *) &server.sin_addr, (char *) &aconf->ipnum, sizeof (struct in_addr));
+ memcpy ((char *) &cptr->ip, (char *) &aconf->ipnum, sizeof (struct in_addr));
server.sin_port = htons (((aconf->port > 0) ? aconf->port : portnum));
*lenp = sizeof (server);
return (struct sockaddr *) &server;
struct sockaddr_in from;
int on = 1;
- bzero ((char *) &from, sizeof (from));
+ memset ((char *) &from, 0, sizeof (from));
from.sin_addr = me.ip;
from.sin_port = htons (7007);
from.sin_family = AF_INET;
case ASYNC_CONNECT:
aconf = ln.value.aconf;
if (hp && aconf) {
- bcopy (hp->h_addr, (char *) &aconf->ipnum,
- sizeof (struct in_addr));
+ memcpy ((char *) &aconf->ipnum, hp->h_addr, sizeof (struct in_addr));
(void) connect_server (aconf, NULL, hp);
}
else
case ASYNC_CONF:
aconf = ln.value.aconf;
if (hp && aconf)
- bcopy (hp->h_addr, (char *) &aconf->ipnum,
- sizeof (struct in_addr));
+ memcpy ((char *) &aconf->ipnum, hp->h_addr, sizeof (struct in_addr));
break;
case ASYNC_SERVER:
cptr = ln.value.cptr;
(void) strncpy (fullname, hname, sizeof (fullname) - 1);
add_local_domain (fullname, HOSTLEN - strlen (fullname));
Debug ((DEBUG_DNS, "a_il: %s->%s", sockhost, fullname));
- if (index (aconf->name, '@')) {
+ if (strchr (aconf->name, '@')) {
(void) strcpy (uhost, cptr->username);
(void) strcat (uhost, "@");
}
if (!match (aconf->name, uhost))
goto attach_iline;
}
- if (index (aconf->host, '@')) {
+ if (strchr (aconf->host, '@')) {
strncpyzt (uhost, cptr->username, sizeof (uhost));
(void) strcat (uhost, "@");
}
tmp = lp->value.aconf;
if (!(tmp->status & statmask))
continue;
- s = index (tmp->host, '@');
+ s = strchr (tmp->host, '@');
*s = '\0';
if (match (tmp->host, user)) {
*s = '@';
continue;
}
*s = '@';
- if (!bcmp ((char *) &tmp->ipnum, ip, sizeof (struct in_addr)))
+ if (!memcmp ((char *) &tmp->ipnum, ip, sizeof (struct in_addr)))
return tmp;
}
return NULL;
line[i-2] = '\n';
line[i-1] = '\0';
}
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = 0;
else
while (dgets (fd, c, sizeof (c) - 1) > 0)
- if ((tmp = (char *) index (c, '\n'))) {
+ if ((tmp = (char *) strchr (c, '\n'))) {
*tmp = 0;
break;
}
}
if (aconf->status & CONF_SERVER_MASK)
if (ncount > MAXCONFLINKS || ccount > MAXCONFLINKS ||
- !aconf->host || index (aconf->host, '*') ||
- index (aconf->host, '?') || !aconf->name)
+ !aconf->host || strchr (aconf->host, '*') ||
+ strchr (aconf->host, '?') || !aconf->name)
continue;
if (aconf->status & (CONF_SERVER_MASK | CONF_LOCOP | CONF_OPERATOR))
- if (!index (aconf->host, '@') && *aconf->host != '/') {
+ if (!strchr (aconf->host, '@') && *aconf->host != '/') {
char *newhost;
int len = 3; /* *@\0 = 3 */
if (BadPtr (aconf->host) || BadPtr (aconf->name))
goto badlookup;
- if ((s = index (aconf->host, '@')))
+ if ((s = strchr (aconf->host, '@')))
s++;
else
s = aconf->host;
if (isdigit (*s))
aconf->ipnum.s_addr = inet_addr (s);
else if ((hp = gethost_byname (s, &ln)))
- bcopy (hp->h_addr, (char *) &(aconf->ipnum), sizeof (struct in_addr));
+ memcpy ((char *) &(aconf->ipnum), hp->h_addr, sizeof (struct in_addr));
if (aconf->ipnum.s_addr == -1)
goto badlookup;
return 0;
badlookup:
if (aconf->ipnum.s_addr == -1)
- bzero ((char *) &aconf->ipnum, sizeof (struct in_addr));
+ memset ((char *) &aconf->ipnum, 0, sizeof (struct in_addr));
Debug ((DEBUG_ERROR, "Host/server name error: (%s) (%s)",
aconf->host, aconf->name));
return -1;
tm = localtime (&sb.st_mtime);
(void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */
while (dgets (fd, line, sizeof (line) - 1) > 0) {
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = '\0';
- if ((tmp = (char *) index (line, '\r')))
+ if ((tmp = (char *) strchr (line, '\r')))
*tmp = '\0';
sendto_one (sptr, rpl_str (RPL_MOTD), me.name, parv, line);
}
}
/* z-lines don't support user@host format, they only
work with ip addresses and nicks */
- if ((in = index (parv[1], '@')) && (*(in + 1) != '\0')) {
+ if ((in = strchr (parv[1], '@')) && (*(in + 1) != '\0')) {
strcpy (userhost, in + 1);
in = &userhost[0];
while (*in) {
}
/* parse the removal mask the same way so an oper can just use
the same thing to remove it if they specified *@ or something... */
- if ((in = index (parv[1], '@'))) {
+ if ((in = strchr (parv[1], '@'))) {
strcpy (userhost, in + 1);
in = &userhost[0];
while (*in) {
*/
int advanced_check (char *userhost, int ipstat)
{
- register int retval = TRUE;
+ int retval = TRUE;
char *up = NULL, *p, *thisseg;
int numdots = 0, segno = 0, numseg, i = 0;
char *ipseg[10 + 2];
if (ipstat == TRUE)
for (i = 0; i < numseg; i++) {
if (!IP_WILDS_OK (i)
- && (index (ipseg[i], '*') || index (ipseg[i], '?')))
+ && (strchr (ipseg[i], '*') || strchr (ipseg[i], '?')))
retval = FALSE;
MyFree (ipseg[i]);
}
if (i == numseg || (i + 1) == numseg)
wildsok = 0;
if (wildsok == 0
- && (index (ipseg[i], '*') || index (ipseg[i], '?'))) {
+ && (strchr (ipseg[i], '*') || strchr (ipseg[i], '?'))) {
retval = FALSE;
}
MyFree (ipseg[i]);
if (!clock)
time (&clock);
gm = gmtime (&clock);
- bcopy ((char *) gm, (char *) &gmbuf, sizeof (gmbuf));
+ memcpy ((char *) &gmbuf, (char *) gm, sizeof (gmbuf));
gm = &gmbuf;
lt = localtime (&clock);
static char namebuf[NICKLEN + USERLEN + HOSTLEN + 6];
char *s = namebuf;
- bzero (namebuf, sizeof (namebuf));
+ memset (namebuf, 0, sizeof (namebuf));
nick = check_string (nick);
strncpyzt (namebuf, nick, NICKLEN + 1);
s += strlen (s);
char *p;
(void) strcpy (buf, ctime (&value));
- if ((p = (char *) index (buf, '\n')) != NULL)
+ if ((p = (char *) strchr (buf, '\n')) != NULL)
*p = '\0';
return buf;
char *host;
{
char *s;
- if ((s = (char *) index (host, '@')))
+ if ((s = (char *) strchr (host, '@')))
s++;
else
s = host;
aConfItem *aconf;
{
static char namebuf[HOSTLEN];
- register int count = aconf->port;
- register char *start = name;
+ int count = aconf->port;
+ char *start = name;
if (count <= 0 || count > 5)
return start;
while (count-- && name) {
name++;
- name = (char *) index (name, '.');
+ name = (char *) strchr (name, '.');
}
if (!name)
return start;
void initstats ()
{
- bzero ((char *) &ircst, sizeof (ircst));
+ memset ((char *) &ircst, 0, sizeof (ircst));
}
void tstats (cptr, name)
time_t now = time (NULL);
sp = &tmp;
- bcopy ((char *) ircstp, (char *) sp, sizeof (*sp));
+ memcpy ((char *) sp, (char *) ircstp, sizeof (*sp));
for (i = 0; i < MAXCONNECTIONS; i++) {
if (!(acptr = local[i]))
continue;
(void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */
while ((nr = dgets (fd, line, sizeof (line) - 1)) > 0) {
line[nr] = '\0';
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = '\0';
- if ((tmp = (char *) index (line, '\r')))
+ if ((tmp = (char *) strchr (line, '\r')))
*tmp = '\0';
}
if (!(cptr->acpt))
return -1;
- bcopy ((char *) &cptr->ip, (char *) &remote_addr.sin_addr,
- sizeof (struct in_addr));
+ memcpy ((char *) &remote_addr.sin_addr, (char *) &cptr->ip, sizeof (struct in_addr));
remote_addr.sin_port = htons (cptr->port);
remote_addr.sin_family = AF_INET;
struct sockaddr_in remote_addr;
struct timeval tv;
- bcopy ((char *) &cptr->ip, (char *) &remote_addr.sin_addr,
- sizeof (struct in_addr));
+ memcpy ((char *) &remote_addr.sin_addr, (char *) &cptr->ip, sizeof (struct in_addr));
remote_addr.sin_port = htons (cptr->port);
remote_addr.sin_family = AF_INET;
unsigned long int pingtime;
char *s;
- bcopy ((char *) &cptr->ip, (char *) &remote_addr.sin_addr,
- sizeof (struct in_addr));
+ memcpy ((char *) &remote_addr.sin_addr, (char *) &cptr->ip, sizeof (struct in_addr));
remote_addr.sin_port = htons (cptr->port);
remote_addr.sin_family = AF_INET;
lin.flags = ASYNC_PING;
lin.value.cptr = cptr;
nextdnscheck = 1;
- s = (char *) index (cptr->sockhost, '@');
+ s = (char *) strchr (cptr->sockhost, '@');
s++; /* should never be NULL; cptr->sockhost is actually a conf->host */
if ((cptr->ip.s_addr = inet_addr (s)) == -1) {
cptr->ip.s_addr = 0;
Debug ((DEBUG_NOTICE, "ping_sv: hp %x ac %x ho %s", hp, cptr, s));
if (!hp)
return 0;
- bcopy (hp->h_addr, (char *) &cptr->ip, sizeof (struct in_addr));
+ memcpy ((char *) &cptr->ip, hp->h_addr, sizeof (struct in_addr));
}
}
return start_ping (cptr);
for (aconf = conf; aconf; aconf = aconf->next)
if (aconf->status == CONF_CONNECT_SERVER &&
(match (parv[1], aconf->host) == 0 ||
- match (parv[1], index (aconf->host, '@') + 1) == 0))
+ match (parv[1], strchr (aconf->host, '@') + 1) == 0))
break;
if (!aconf) {
sendto_one_notice (sptr, "UPING: Host %s not listed in ircd.conf",
strcpy (cptr->sockhost, aconf->host);
cptr->acpt = sptr;
SetAskedPing (sptr);
- bcopy ((void *) &aconf->ipnum, (void *) &cptr->ip,
- sizeof (struct in_addr));
+ memcpy ((void *) &cptr->ip, (void *) &aconf->ipnum, sizeof (struct in_addr));
strcpy (cptr->name, aconf->name);
cptr->firsttime = 0;
SetPing (cptr);
}
void end_ping (cptr)
- register aClient *cptr;
+ aClient *cptr;
{
Debug ((DEBUG_DEBUG, "end_ping: %x", cptr));
if (cptr->acpt) {
for (i = 1; i < parc; i++) {
strncpy (proto, parv[i], 127);
proto[127] = '\0'; /* Just to be safe... */
- equal = (char *) index (proto, '=');
+ equal = (char *) strchr (proto, '=');
if (equal == NULL)
options = dummyblank;
else {
for (ch = host; *ch; ch++)
if (*ch <= ' ' || *ch > '~')
break;
- if (*ch || !index (host, '.')) {
+ if (*ch || !strchr (host, '.')) {
sendto_one (sptr, "ERROR :Bogus server name (%s)", sptr->name, host);
sendto_ops ("Bogus server name (%s) from %s", host,
get_client_name (cptr, TRUE));
sendto_locfailops ("Access denied (passwd mismatch) %s", inpath);
return exit_client (cptr, cptr, cptr, "Bad Password");
}
- /* bzero(cptr->passwd, sizeof(cptr->passwd)); */
+ /* memset (cptr->passwd, 0, sizeof(cptr->passwd)); */
}
if ((acptr = find_name (host, NULL))) {
aClient *ocptr;
sendto_ops ("Access denied (passwd mismatch) %s", inpath);
return exit_client (cptr, cptr, cptr, "Bad Password");
}
- bzero (cptr->passwd, sizeof (cptr->passwd));
+ memset (cptr->passwd, 0, sizeof (cptr->passwd));
#ifndef HUB
for (i = 0; i <= highest_fd; i++)
}
else {
- s = (char *) index (aconf->host, '@');
+ s = (char *) strchr (aconf->host, '@');
*s = '\0'; /* should never be NULL */
Debug ((DEBUG_INFO, "Check Usernames [%s]vs[%s]",
aconf->host, cptr->username));
}
for (s = (char *) strtoken (&p, *++pav, " "); s;
s = (char *) strtoken (&p, NULL, " ")) {
- if ((user = (char *) index (s, '!')))
+ if ((user = (char *) strchr (s, '!')))
*user++ = '\0'; /* Not used */
/*
doall = 2;
else if (match (name, me.name) == 0)
doall = 1;
- if (index (name, '*') || index (name, '?'))
+ if (strchr (name, '*') || strchr (name, '?'))
wilds = 1;
}
else
break;
case 'u':
{
- register time_t tmpnow;
+ time_t tmpnow;
tmpnow = time (NULL) - me.since;
sendto_one (sptr, rpl_str (RPL_STATSUPTIME), me.name, parv[0],
for (aconf = conf; aconf; aconf = aconf->next)
if (aconf->status == CONF_CONNECT_SERVER &&
(match (parv[1], aconf->host) == 0 ||
- match (parv[1], index (aconf->host, '@') + 1) == 0))
+ match (parv[1], strchr (aconf->host, '@') + 1) == 0))
break;
if (!aconf) {
}
doall = (parv[1] && (parc > 1)) ? !match (tname, me.name) : TRUE;
- wilds = !parv[1] || index (tname, '*') || index (tname, '?');
+ wilds = !parv[1] || strchr (tname, '*') || strchr (tname, '?');
dow = wilds || doall;
for (i = 0; i < MAXCONNECTIONS; i++)
(void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */
while ((nr = dgets (fd, line, sizeof (line) - 1)) > 0) {
line[nr] = '\0';
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = '\0';
- if ((tmp = (char *) index (line, '\r')))
+ if ((tmp = (char *) strchr (line, '\r')))
*tmp = '\0';
sendto_one (sptr, rpl_str (RPL_MOTD), me.name, parv[0], line);
}
(void) dgets (-1, NULL, 0); /* make sure buffer is at empty pos */
while ((nr = dgets (fd, line, sizeof (line) - 1)) > 0) {
line[nr] = '\0';
- if ((tmp = (char *) index (line, '\n')))
+ if ((tmp = (char *) strchr (line, '\n')))
*tmp = '\0';
- if ((tmp = (char *) index (line, '\r')))
+ if ((tmp = (char *) strchr (line, '\r')))
*tmp = '\0';
sendto_one (sptr, rpl_str (RPL_OMOTD), me.name, parv[0], line);
}
static void remove_clone_check (aClient * cptr)
{
- register unsigned char *p = (unsigned char *) &cptr->ip.s_addr;
- register struct aThrottle *ptr =
+ unsigned char *p = (unsigned char *) &cptr->ip.s_addr;
+ struct aThrottle *ptr =
throttles[(p[0] + p[1] + p[2] + p[3]) & 0xff];
if (cptr->ip.s_addr == 0)
char *buffer;
{
static char cbuf[BUFSIZ];
- register char *s, *t, *cp = cbuf;
- register int l = 0;
+ char *s, *t, *cp = cbuf;
+ int l = 0;
char *p = NULL, *p2;
*cp = '\0';
sptr->info);
#endif
if (MyConnect (sptr) && !BadPtr (sptr->passwd))
- bzero (sptr->passwd, sizeof (sptr->passwd));
+ memset (sptr->passwd, 0, sizeof (sptr->passwd));
return 0;
}
sendto_one (sptr, err_str (ERR_NONICKNAMEGIVEN), me.name, parv[0]);
return 0;
}
- if (MyConnect (sptr) && (s = (char *) index (parv[1], '~')))
+ if (MyConnect (sptr) && (s = (char *) strchr (parv[1], '~')))
*s = '\0';
if (MyConnect (sptr) && IsJinxed (sptr))
** Armin, 8Jun90 (gruner@informatik.tu-muenchen.de)
*/
if ((*nick == '$' || *nick == '#') && IsAnOper (sptr)) {
- if (!(s = (char *) rindex (nick, '.'))) {
+ if (!(s = (char *) strrchr (nick, '.'))) {
sendto_one (sptr, err_str (ERR_NOTOPLEVEL), me.name, parv[0],
nick);
continue;
/*
** user[%host]@server addressed?
*/
- if ((server = (char *) index (nick, '@')) &&
+ if ((server = (char *) strchr (nick, '@')) &&
(acptr = find_server (server + 1, NULL))) {
/*
** Not destined for a user on me :-(
cptr->flags2 |= FLAGS2_HTC; /* To prevent a dead socket */
if (!BadPtr (mask)) {
- if ((s = (char *) index (mask, ','))) {
+ if ((s = (char *) strchr (mask, ','))) {
parv[1] = ++s;
(void) m_who (cptr, sptr, parc, parv);
}
found = 0;
(void) collapse (nick);
- wilds = (index (nick, '?') || index (nick, '*'));
+ wilds = (strchr (nick, '?') || strchr (nick, '*'));
if (wilds && IsServer (cptr))
continue;
for (acptr = client; (acptr = next_client (acptr, nick));
if (IsServer (cptr) && !IsUnknown (sptr))
return 0;
- if (parc > 2 && (username = (char *) index (parv[1], '@')))
+ if (parc > 2 && (username = (char *) strchr (parv[1], '@')))
*username = '\0';
if (parc < 5 || *parv[1] == '\0' || *parv[2] == '\0' ||
*parv[3] == '\0' || *parv[4] == '\0') {
strcpy (inpath, oinpath);
- if (IsServer (cptr) && (s = (char *) index (inpath, '.')) != NULL)
+ if (IsServer (cptr) && (s = (char *) strchr (inpath, '.')) != NULL)
*s = '\0'; /* Truncate at first "." */
if (!IsPrivileged (cptr)) {
auser = acptr->user ? acptr->user : &UnknownUser;
- if (index (parv[0], '.'))
+ if (strchr (parv[0], '.'))
sendto_umode (UMODE_KILLS | UMODE_OPER,
"*** Notice -- Received KILL message for %s!%s@%s from %s Path: %s!%s",
acptr->name, auser->username, auser->host, parv[0],
(void) sprintf (buf2, "Local kill by %s (%s)", sptr->name,
BadPtr (parv[2]) ? sptr->name : parv[2]);
else {
- if ((killer = index (path, ' '))) {
+ if ((killer = strchr (path, ' '))) {
while (*killer && *killer != '!')
killer--;
if (!*killer)
sendto_one (sptr, err_str (ERR_NOPRIVILEGES), me.name, parv[0]);
return 0;
}
- if (!index (parv[1], '.')) {
+ if (!strchr (parv[1], '.')) {
if ((acptr = find_client (parv[1], NULL)))
lookhost = acptr->user->host;
else {
int old = (sptr->umodes & ALL_UMODES);
char *s;
- s = index (aconf->host, '@');
+ s = strchr (aconf->host, '@');
*s++ = '\0';
if (!(aconf->port & OFLAG_ISGLOBAL))
SetLocOp (sptr);
len = strlen (buf);
for (s = strtoken (&p, *++pav, " "); s; s = strtoken (&p, NULL, " ")) {
- if ((user = index (s, '!')))
+ if ((user = strchr (s, '!')))
*user++ = '\0';
if ((acptr = find_person (s, NULL))) {
if (user) {
}
lp = make_link ();
- bzero ((char *) lp, sizeof (Link));
+ memset ((char *) lp, 0, sizeof (Link));
lp->next = sptr->user->silence;
lp->value.cp = (char *) MyMalloc (strlen (mask) + 1);
(void) strcpy (lp->value.cp, mask);
c = *cp;
if (c == '-' || c == '+')
cp++;
- else if (!(index (cp, '@') || index (cp, '.') ||
- index (cp, '!') || index (cp, '*'))) {
+ else if (!(strchr (cp, '@') || strchr (cp, '.') ||
+ strchr (cp, '!') || strchr (cp, '*'))) {
sendto_one (sptr, err_str (ERR_NOSUCHNICK), me.name, parv[0],
parv[1]);
return -1;
/* ERR */
}
/* put everything in zipbuf */
- bcopy (cptr->zip->inbuf, zipbuf, cptr->zip->incount);
- bcopy (buffer, zipbuf + cptr->zip->incount, *length);
+ memcpy (zipbuf, cptr->zip->inbuf, cptr->zip->incount);
+ memcpy (zipbuf + cptr->zip->incount, buffer, *length);
zin->next_in = zipbuf;
zin->avail_in = cptr->zip->incount + *length;
case Z_OK:
if (zin->avail_in) {
/* put the leftover in cptr->zip->inbuf */
- bcopy (zin->next_in, cptr->zip->inbuf, zin->avail_in);
+ memcpy (cptr->zip->inbuf, zin->next_in, zin->avail_in);
cptr->zip->incount = zin->avail_in;
}
*length = UNZIP_BUFFER_SIZE - zin->avail_out;
if (buffer) {
/* concatenate buffer in cptr->zip->outbuf */
- bcopy (buffer, cptr->zip->outbuf + cptr->zip->outcount, *length);
+ memcpy (cptr->zip->outbuf + cptr->zip->outcount, buffer, *length);
cptr->zip->outcount += *length;
}
*length = 0;
aClient *acptr;
int i;
- bzero (sentalong, sizeof (sentalong));
+ memset (sentalong, 0, sizeof (sentalong));
for (lp = chptr->members; lp; lp = lp->next) {
acptr = lp->value.cptr;
if (acptr->from == one || (lp->flags & CHFL_ZOMBIE))
aClient *cptr;
Link *lp, *lp2;
- bzero (sentalong, sizeof (sentalong));
+ memset (sentalong, 0, sizeof (sentalong));
sentalong[0] = 1;
for (lp = user->user->channel; lp; lp = lp->next)
for (lp2 = lp->value.chptr->members; lp2; lp2 = lp2->next) {
if (chptr) {
if (*chptr->chname == '&')
return;
- if ((mask = (char *) rindex (chptr->chname, ':')))
+ if ((mask = (char *) strrchr (chptr->chname, ':')))
mask++;
}
else
}
}
/*
- ** flag is used instead of index(sender, '@') for speed and
+ ** flag is used instead of strchr (sender, '@') for speed and
** also since username/nick may have had a '@' in them. -avalon
*/
if (!flag && MyConnect (from) && *user->host) {
#include "sys.h"
#include "h.h"
-extern int errno; /* ...seems that errno.h doesn't define this everywhere */
-
extern void outofmemory ();
#ifndef HAVE_STRTOKEN
if (str)
pos = str; /* new string scan */
- while (pos && *pos && index (fs, *pos) != NULL)
+ while (pos && *pos && strchr (fs, *pos) != NULL)
pos++; /* skip leading separators */
if (!pos || !*pos)
tmp = pos; /* now, keep position of the token */
- while (*pos && index (fs, *pos) == NULL)
+ while (*pos && strchr (fs, *pos) == NULL)
pos++; /* skip content of the token */
if (*pos)
char *MyMalloc (x)
size_t x;
{
- register int i;
- register char **s;
+ int i;
+ char **s;
char *ret;
ret = (char *) malloc (x + (size_t) SZ_EX);
if (!ret) {
outofmemory ();
}
- bzero (ret, (int) x + SZ_EX);
- bcopy ((char *) &ret, ret, SZ_CH);
- bcopy ((char *) &x, ret + SZ_CH, SZ_ST);
- bcopy ("VAVA", ret + SZ_CHST + (int) x, 4);
+ memset (ret, 0, (int) x + SZ_EX);
+ memcpy (ret, (char *) &ret, SZ_CH);
+ memcpy (ret + SZ_CH, (char *) &x, SZ_ST);
+ memcpy (ret + SZ_CHST + (int) x, "VAVA", 4);
Debug ((DEBUG_MALLOC, "MyMalloc(%ld) = %#x", x, ret + 8));
for (i = 0, s = marray; *s && i < mindex; i++, s++);
if (i < 20000) {
char *x;
size_t y;
{
- register int l;
- register char **s;
+ int l;
+ char **s;
char *ret, *cp;
size_t i;
int k;
x -= SZ_CHST;
- bcopy (x, (char *) &cp, SZ_CH);
- bcopy (x + SZ_CH, (char *) &i, SZ_ST);
- bcopy (x + (int) i + SZ_CHST, (char *) &k, 4);
- if (bcmp ((char *) &k, "VAVA", 4) || (x != cp))
+ memcpy ((char *) &cp, x, SZ_CH);
+ memcpy ((char *) &i, x + SZ_CH, SZ_ST);
+ memcpy ((char *) &k, x + (int) i + SZ_CHST, 4);
+ if (memcmp ((char *) &k, "VAVA", 4) || (x != cp))
dumpcore ("MyRealloc %#x %d %d %#x %#x", x, y, i, cp, k);
ret = (char *) realloc (x, y + (size_t) SZ_EX);
if (!ret) {
outofmemory ();
}
- bcopy ((char *) &ret, ret, SZ_CH);
- bcopy ((char *) &y, ret + SZ_CH, SZ_ST);
- bcopy ("VAVA", ret + SZ_CHST + (int) y, 4);
+ memcpy (ret, (char *) &ret, SZ_CH);
+ memcpy (ret + SZ_CH, (char *) &y, SZ_ST);
+ memcpy (ret + SZ_CHST + (int) y, "VAVA", 4);
Debug ((DEBUG_NOTICE, "MyRealloc(%#x,%ld) = %#x", x, y, ret + SZ_CHST));
for (l = 0, s = marray; *s != x && l < mindex; l++, s++);
if (l < mindex)
size_t i;
char *j;
u_char k[4];
- register int l;
- register char **s;
+ int l;
+ char **s;
if (!x)
return;
x -= SZ_CHST;
- bcopy (x, (char *) &j, SZ_CH);
- bcopy (x + SZ_CH, (char *) &i, SZ_ST);
- bcopy (x + SZ_CHST + (int) i, (char *) k, 4);
+ memcpy ((char *) &j, x, SZ_CH);
+ memcpy ((char *) &i, x + SZ_CH, SZ_ST);
+ memcpy ((char *) k, x + SZ_CHST + (int) i, 4);
- if (bcmp ((char *) k, "VAVA", 4) || (j != x))
+ if (memcmp ((char *) k, "VAVA", 4) || (j != x))
dumpcore ("MyFree %#x %ld %#x %#x", x, i, j,
(k[3] << 24) | (k[2] << 16) | (k[1] << 8) | k[0]);
{
static char dgbuf[8192];
static char *head = dgbuf, *tail = dgbuf;
- register char *s, *t;
- register int n, nr;
+ char *s, *t;
+ int n, nr;
/*
** Sanity checks.
** check input buffer for EOL and if present return string.
*/
if (head < tail &&
- ((s = index (head, '\n')) || (s = index (head, '\r'))) && s < tail) {
+ ((s = strchr (head, '\n')) || (s = strchr (head, '\r'))) && s < tail) {
n = MIN (s - head + 1, num); /* at least 1 byte */
dgetsreturnbuf:
- bcopy (head, buf, n);
+ memcpy (buf, head, n);
head += n;
if (head == tail)
head = tail = dgbuf;
}
tail += nr;
*tail = '\0';
- for (t = head; (s = index (t, '\n'));) {
+ for (t = head; (s = strchr (t, '\n'));) {
if ((s > head) && (s > dgbuf)) {
t = s - 1;
for (nr = 0; *t == '\\'; nr++)
void update_load ()
{
static struct timeval now, last;
- register struct load_entry *cur_load_entry;
+ struct load_entry *cur_load_entry;
/* This seems to get polluted on startup by an exit_client()
* before any connections have been recorded.
if (current_load_data.local_count > MAXCONNECTIONS ||
current_load_data.client_count > MAXCONNECTIONS ||
current_load_data.conn_count > MAXCONNECTIONS)
- bzero (¤t_load_data, sizeof (struct current_load_struct));
+ memset (¤t_load_data, 0, sizeof (struct current_load_struct));
memcpy (&last, &now, sizeof (struct timeval));
}
else {
load_list_head = cur_load_entry;
- bzero (cur_load_entry, sizeof (struct load_entry));
+ memset (cur_load_entry, 0, sizeof (struct load_entry));
cur_load_entry->time_incr = 1;
}
cur_load_entry->prev = load_list_tail;
aClient *sptr;
char *parv; /* we only get passed the original parv[0] */
{
- register struct load_entry *cur_load_entry;
+ struct load_entry *cur_load_entry;
struct load_entry *last = NULL;
#ifdef DEBUGMODE
u_long secs = 0, adj_secs, total[4], adj[4]; /*[local,client,conn,cpu] */
u_int times[5][4]; /* [min,hour,day,Yest,YYest][local,client,conn,cpu] */
char what[4][HOSTLEN + 1];
- bzero (total, 4 * sizeof (u_long));
+ memset (total, 0, 4 * sizeof (u_long));
#else
u_long secs = 0, adj_secs, total[3], adj[3]; /*[local,client,conn] */
int i, times[5][3]; /* [min,hour,day,Yest,YYest][local,client,conn] */
char what[3][HOSTLEN + 1];
- bzero (total, 3 * sizeof (u_long));
+ memset (total, 0, 3 * sizeof (u_long));
#endif
current_load_data.entries = 0;
}
#ifdef DEBUGMODE
- bzero (total, 4 * sizeof (u_long));
+ memset (total, 0, 4 * sizeof (u_long));
#else
- bzero (total, 3 * sizeof (u_long));
+ memset (total, 0, 3 * sizeof (u_long));
#endif
for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs +=
}
#ifdef DEBUGMODE
- bzero (total, 4 * sizeof (u_long));
+ memset (total, 0, 4 * sizeof (u_long));
#else
- bzero (total, 3 * sizeof (u_long));
+ memset (total, 0, 3 * sizeof (u_long));
#endif
for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs +=
void initload ()
{
- bzero (¤t_load_data, sizeof (struct current_load_struct));
+ memset (¤t_load_data, 0, sizeof (struct current_load_struct));
update_load (); /* Initialize the load list */
}
free_link (lp);
}
}
- bcopy ((char *) &ntmp, (char *) np2, sizeof (aName));
+ memcpy ((char *) np2, (char *) &ntmp, sizeof (aName));
/*
* Add this whowas entry into the clients history list
int i;
for (i = 0; i < NICKNAMEHISTORYLENGTH; i++)
- bzero ((char *) &was[i], sizeof (aName));
+ memset ((char *) &was[i], 0, sizeof (aName));
return;
}