diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index d7934e57c..b638cf30c 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -741,7 +741,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick) add_to_client_hash(nick, source_p); /* fd_desc is long enough */ - comm_note(client_p->localClient->F->fd, "Nick: %s", nick); + rb_note(client_p->localClient->F->fd, "Nick: %s", nick); if(source_p->flags & FLAGS_SENTUSER) { @@ -850,7 +850,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p, } /* fd_desc is long enough */ - comm_note(client_p->localClient->F->fd, "Nick: %s", nick); + rb_note(client_p->localClient->F->fd, "Nick: %s", nick); return; } diff --git a/modules/m_services.c b/modules/m_services.c index 72250e247..81326bfbd 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -237,7 +237,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p, del_all_accepts(target_p); - comm_note(target_p->localClient->F->fd, "Nick: %s", target_p->name); + rb_note(target_p->localClient->F->fd, "Nick: %s", target_p->name); return 0; } diff --git a/modules/m_signon.c b/modules/m_signon.c index c2220326b..a5efa2ee6 100644 --- a/modules/m_signon.c +++ b/modules/m_signon.c @@ -258,7 +258,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p, else { send_signon(NULL, target_p, nick, user, host, CurrentTime, login); - comm_note(target_p->localClient->F->fd, "Nick: %s", target_p->name); + rb_note(target_p->localClient->F->fd, "Nick: %s", target_p->name); } return 0; diff --git a/modules/m_stats.c b/modules/m_stats.c index f5a41f01d..f7c2c9369 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -139,8 +139,8 @@ static struct StatsStruct stats_cmd_table[] = { {'D', stats_deny, 1, 0, }, {'e', stats_exempt, 1, 0, }, {'E', stats_events, 1, 1, }, - {'f', comm_dump, 1, 1, }, - {'F', comm_dump, 1, 1, }, + {'f', rb_dump, 1, 1, }, + {'F', rb_dump, 1, 1, }, {'g', stats_pending_glines, 1, 0, }, {'G', stats_glines, 1, 0, }, {'h', stats_hubleaf, 0, 0, }, diff --git a/src/blacklist.c b/src/blacklist.c index 766807f05..6e0740a0e 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -44,14 +44,14 @@ #include "s_user.h" #include "blacklist.h" -dlink_list blacklist_list = { NULL, NULL, 0 }; +rb_dlink_list blacklist_list = { NULL, NULL, 0 }; /* private interfaces */ static struct Blacklist *find_blacklist(char *name) { - dlink_node *nptr; + rb_dlink_node *nptr; - DLINK_FOREACH(nptr, blacklist_list.head) + RB_DLINK_FOREACH(nptr, blacklist_list.head) { struct Blacklist *blptr = (struct Blacklist *) nptr->data; @@ -102,10 +102,10 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply) else unref_blacklist(blcptr->blacklist); - dlinkDelete(&blcptr->node, &blcptr->client_p->preClient->dnsbl_queries); + rb_dlinkDelete(&blcptr->node, &blcptr->client_p->preClient->dnsbl_queries); /* yes, it can probably happen... */ - if (dlink_list_length(&blcptr->client_p->preClient->dnsbl_queries) == 0 && blcptr->client_p->flags & FLAGS_SENTUSER && !EmptyString(blcptr->client_p->name)) + if (rb_dlink_list_length(&blcptr->client_p->preClient->dnsbl_queries) == 0 && blcptr->client_p->flags & FLAGS_SENTUSER && !EmptyString(blcptr->client_p->name)) { char buf[USERLEN + 1]; strlcpy(buf, blcptr->client_p->username, sizeof buf); @@ -132,11 +132,11 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * sscanf(client_p->sockhost, "%d.%d.%d.%d", &ip[3], &ip[2], &ip[1], &ip[0]); /* becomes 2.0.0.127.torbl.ahbl.org or whatever */ - ircsnprintf(buf, IRCD_BUFSIZE, "%d.%d.%d.%d.%s", ip[0], ip[1], ip[2], ip[3], blptr->host); + rb_snprintf(buf, IRCD_BUFSIZE, "%d.%d.%d.%d.%s", ip[0], ip[1], ip[2], ip[3], blptr->host); gethost_byname_type(buf, &blcptr->dns_query, T_A); - dlinkAdd(blcptr, &blcptr->node, &client_p->preClient->dnsbl_queries); + rb_dlinkAdd(blcptr, &blcptr->node, &client_p->preClient->dnsbl_queries); blptr->refcount++; } @@ -152,7 +152,7 @@ struct Blacklist *new_blacklist(char *name, char *reject_reason) if (blptr == NULL) { blptr = MyMalloc(sizeof(struct Blacklist)); - dlinkAddAlloc(blptr, &blacklist_list); + rb_dlinkAddAlloc(blptr, &blacklist_list); } else blptr->status &= ~CONF_ILLEGAL; @@ -168,20 +168,20 @@ void unref_blacklist(struct Blacklist *blptr) blptr->refcount--; if (blptr->status & CONF_ILLEGAL && blptr->refcount <= 0) { - dlinkFindDestroy(blptr, &blacklist_list); + rb_dlinkFindDestroy(blptr, &blacklist_list); MyFree(blptr); } } void lookup_blacklists(struct Client *client_p) { - dlink_node *nptr; + rb_dlink_node *nptr; /* We don't do IPv6 right now, sorry! */ if (client_p->localClient->ip.ss_family == AF_INET6) return; - DLINK_FOREACH(nptr, blacklist_list.head) + RB_DLINK_FOREACH(nptr, blacklist_list.head) { struct Blacklist *blptr = (struct Blacklist *) nptr->data; @@ -192,15 +192,15 @@ void lookup_blacklists(struct Client *client_p) void abort_blacklist_queries(struct Client *client_p) { - dlink_node *ptr, *next_ptr; + rb_dlink_node *ptr, *next_ptr; struct BlacklistClient *blcptr; if (client_p->preClient == NULL) return; - DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->preClient->dnsbl_queries.head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->preClient->dnsbl_queries.head) { blcptr = ptr->data; - dlinkDelete(&blcptr->node, &client_p->preClient->dnsbl_queries); + rb_dlinkDelete(&blcptr->node, &client_p->preClient->dnsbl_queries); unref_blacklist(blcptr->blacklist); delete_resolver_queries(&blcptr->dns_query); MyFree(blcptr); @@ -209,10 +209,10 @@ void abort_blacklist_queries(struct Client *client_p) void destroy_blacklists(void) { - dlink_node *ptr, *next_ptr; + rb_dlink_node *ptr, *next_ptr; struct Blacklist *blptr; - DLINK_FOREACH_SAFE(ptr, next_ptr, blacklist_list.head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, blacklist_list.head) { blptr = ptr->data; blptr->hits = 0; /* keep it simple and consistent */ @@ -221,7 +221,7 @@ void destroy_blacklists(void) else { MyFree(ptr->data); - dlinkDestroy(ptr, &blacklist_list); + rb_dlinkDestroy(ptr, &blacklist_list); } } } diff --git a/src/cache.c b/src/cache.c index a7cdb86e1..f34675304 100644 --- a/src/cache.c +++ b/src/cache.c @@ -106,7 +106,7 @@ cache_file(const char *filename, const char *shortname, int flags) local_tm = localtime(&sb.st_mtime); if(local_tm != NULL) - ircsnprintf(user_motd_changed, sizeof(user_motd_changed), + rb_snprintf(user_motd_changed, sizeof(user_motd_changed), "%d/%d/%d %d:%d", local_tm->tm_mday, local_tm->tm_mon + 1, 1900 + local_tm->tm_year, local_tm->tm_hour, @@ -193,7 +193,7 @@ load_help(void) while((ldirent = readdir(helpfile_dir)) != NULL) { - ircsnprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); + rb_snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER); irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr); } @@ -206,7 +206,7 @@ load_help(void) while((ldirent = readdir(helpfile_dir)) != NULL) { - ircsnprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); + rb_snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); cacheptr = cache_file(filename, ldirent->d_name, HELP_USER); irc_dictionary_add(help_dict_user, cacheptr->name, cacheptr); diff --git a/src/channel.c b/src/channel.c index 757524d09..d3faad4ca 100644 --- a/src/channel.c +++ b/src/channel.c @@ -434,7 +434,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo { is_member = IsMember(client_p, chptr); - cur_len = mlen = ircsprintf(lbuf, form_str(RPL_NAMREPLY), + cur_len = mlen = rb_sprintf(lbuf, form_str(RPL_NAMREPLY), me.name, client_p->name, channel_pub_or_secret(chptr), chptr->chname); @@ -457,7 +457,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo t = lbuf + mlen; } - tlen = ircsprintf(t, "%s%s ", find_channel_status(msptr, stack), + tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack), target_p->name); cur_len += tlen; @@ -521,8 +521,8 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr, /* if the buffers havent been built, do it here */ if(s == NULL) { - ircsprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); - ircsprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); + rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); + rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); s = src_host; s2 = src_iphost; @@ -532,14 +532,14 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr, /* if host mangling mode enabled, also check their real host */ if(!strcmp(who->host, who->localClient->mangledhost)) { - ircsprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); + rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); s3 = src_althost; } /* if host mangling mode not enabled and no other spoof, * also check the mangled form of their host */ else if (!IsDynSpoof(who)) { - ircsprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); + rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); s3 = src_althost; } } @@ -627,8 +627,8 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr, /* if the buffers havent been built, do it here */ if(s == NULL) { - ircsprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); - ircsprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); + rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); + rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); s = src_host; s2 = src_iphost; @@ -638,14 +638,14 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr, /* if host mangling mode enabled, also check their real host */ if(!strcmp(who->host, who->localClient->mangledhost)) { - ircsprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); + rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); s3 = src_althost; } /* if host mangling mode not enabled and no other spoof, * also check the mangled form of their host */ else if (!IsDynSpoof(who)) { - ircsprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); + rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); s3 = src_althost; } } @@ -729,21 +729,21 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key) s_assert(source_p->localClient != NULL); - ircsprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host); - ircsprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost); + rb_sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host); + rb_sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost); if(source_p->localClient->mangledhost != NULL) { /* if host mangling mode enabled, also check their real host */ if(!strcmp(source_p->host, source_p->localClient->mangledhost)) { - ircsprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost); + rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost); use_althost = 1; } /* if host mangling mode not enabled and no other spoof, * also check the mangled form of their host */ else if (!IsDynSpoof(source_p)) { - ircsprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost); + rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost); use_althost = 1; } } @@ -886,8 +886,8 @@ find_bannickchange_channel(struct Client *client_p) if (!MyClient(client_p)) return NULL; - ircsprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); - ircsprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost); + rb_sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); + rb_sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost); DLINK_FOREACH(ptr, client_p->user->channel.head) { @@ -1134,7 +1134,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'l'; if(!IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += ircsprintf(pbuf, " %d", chptr->mode.limit); + pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit); } if(*chptr->mode.key) @@ -1142,7 +1142,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'k'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += ircsprintf(pbuf, " %s", chptr->mode.key); + pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key); } if(chptr->mode.join_num) @@ -1150,7 +1150,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'j'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += ircsprintf(pbuf, " %d:%d", chptr->mode.join_num, + pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num, chptr->mode.join_time); } @@ -1159,7 +1159,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'f'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += ircsprintf(pbuf, " %s", chptr->mode.forward); + pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward); } *mbuf = '\0'; @@ -1309,11 +1309,11 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, nocap = chcap_combos[j].cap_no; if(cap & CAP_TS6) - mbl = preflen = ircsprintf(modebuf, ":%s TMODE %ld %s ", + mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ", use_id(source_p), (long) chptr->channelts, chptr->chname); else - mbl = preflen = ircsprintf(modebuf, ":%s MODE %s ", + mbl = preflen = rb_sprintf(modebuf, ":%s MODE %s ", source_p->name, chptr->chname); /* loop the list of - modes we have */ @@ -1377,7 +1377,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, if(arg != NULL) { - len = ircsprintf(pbuf, "%s ", arg); + len = rb_sprintf(pbuf, "%s ", arg); pbuf += len; pbl += len; mc++; diff --git a/src/chmode.c b/src/chmode.c index 4e733bc42..9bf11c3a5 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -128,7 +128,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, if(IsPerson(source_p)) - ircsprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); + rb_sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); else strlcpy(who, source_p->name, sizeof(who)); @@ -239,7 +239,7 @@ pretty_mask(const char *idmask) if (*mask == '$') { - mask_pos += ircsprintf(mask_buf + mask_pos, "%s", mask) + 1; + mask_pos += rb_sprintf(mask_buf + mask_pos, "%s", mask) + 1; t = mask_buf + old_mask_pos + 1; if (*t == '!') *t = '~'; @@ -309,7 +309,7 @@ pretty_mask(const char *idmask) host[HOSTLEN] = '\0'; } - mask_pos += ircsprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1; + mask_pos += rb_sprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1; /* restore mask, since we may need to use it again later */ if(at) @@ -868,7 +868,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr, if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0) return; - ircsprintf(limitstr, "%d", limit); + rb_sprintf(limitstr, "%d", limit); mode_changes[mode_count].letter = c; mode_changes[mode_count].dir = MODE_ADD; @@ -1515,9 +1515,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, return; if(IsServer(source_p)) - mlen = ircsprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); + mlen = rb_sprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); else - mlen = ircsprintf(modebuf, ":%s!%s@%s MODE %s ", + mlen = rb_sprintf(modebuf, ":%s!%s@%s MODE %s ", source_p->name, source_p->username, source_p->host, chptr->chname); @@ -1581,7 +1581,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, if(mode_changes[i].arg != NULL) { paracount++; - len = ircsprintf(pbuf, "%s ", mode_changes[i].arg); + len = rb_sprintf(pbuf, "%s ", mode_changes[i].arg); pbuf += len; paralen += len; } diff --git a/src/client.c b/src/client.c index e9631c400..da798f735 100644 --- a/src/client.c +++ b/src/client.c @@ -223,7 +223,7 @@ free_local_client(struct Client *client_p) } if(client_p->localClient->F) - comm_close(client_p->localClient->F->fd); + rb_close(client_p->localClient->F->fd); if(client_p->localClient->passwd) { @@ -327,7 +327,7 @@ check_pings_list(dlink_list * list) "No response from %s, closing link", log_client_name(client_p, HIDE_IP)); } - (void) ircsnprintf(scratch, sizeof(scratch), + (void) rb_snprintf(scratch, sizeof(scratch), "Ping timeout: %d seconds", (int) (CurrentTime - client_p->localClient->lasttime)); @@ -941,16 +941,16 @@ get_client_name(struct Client *client, int showip) switch (showip) { case SHOW_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", client->name, client->username, client->sockhost); break; case MASK_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", client->name, client->username); break; default: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", client->name, client->username, client->host); } return nbuf; @@ -976,7 +976,7 @@ get_server_name(struct Client *target_p, int showip) #ifdef HIDE_SERVERS_IPS if(EmptyString(target_p->name)) { - ircsnprintf(nbuf, sizeof(nbuf), "[%s@255.255.255.255]", + rb_snprintf(nbuf, sizeof(nbuf), "[%s@255.255.255.255]", target_p->username); return nbuf; } @@ -987,17 +987,17 @@ get_server_name(struct Client *target_p, int showip) switch (showip) { case SHOW_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->sockhost); break; case MASK_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", target_p->name, target_p->username); default: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->host); } @@ -1026,16 +1026,16 @@ log_client_name(struct Client *target_p, int showip) switch (showip) { case SHOW_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->sockhost); break; case MASK_IP: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", target_p->name, target_p->username); default: - ircsnprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, + rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->host); } @@ -1312,7 +1312,7 @@ dead_link(struct Client *client_p) if(client_p->flags & FLAGS_SENDQEX) strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice)); else - ircsnprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); + rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); abt->client = client_p; SetIOError(client_p); @@ -1445,7 +1445,7 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie strcat(comment1, source_p->name); } if (IsPerson(from)) - ircsnprintf(newcomment, sizeof(newcomment), "by %s: %s", + rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s", from->name, comment); if(source_p->serv != NULL) @@ -1527,7 +1527,7 @@ exit_local_server(struct Client *client_p, struct Client *source_p, struct Clien /* Always show source here, so the server notices show * which side initiated the split -- jilles */ - ircsnprintf(newcomment, sizeof(newcomment), "by %s: %s", + rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s", from == source_p ? me.name : from->name, comment); if (!IsIOError(source_p)) sendto_one(source_p, "SQUIT %s :%s", use_id(source_p), @@ -2076,13 +2076,13 @@ close_connection(struct Client *client_p) if(!IsIOError(client_p)) send_queued_write(client_p->localClient->F->fd, client_p); - comm_close(client_p->localClient->F->fd); + rb_close(client_p->localClient->F->fd); client_p->localClient->F = NULL; } if(-1 < client_p->localClient->ctrlfd) { - comm_close(client_p->localClient->ctrlfd); + rb_close(client_p->localClient->ctrlfd); client_p->localClient->ctrlfd = -1; } @@ -2113,7 +2113,7 @@ error_exit_client(struct Client *client_p, int error) * for reading even though it ends up being an EOF. -avalon */ char errmsg[255]; - int current_error = comm_get_sockerr(client_p->localClient->F->fd); + int current_error = rb_get_sockerr(client_p->localClient->F->fd); SetIOError(client_p); @@ -2141,7 +2141,7 @@ error_exit_client(struct Client *client_p, int error) if(error == 0) strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg)); else - ircsnprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error)); + rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error)); exit_client(client_p, client_p, &me, errmsg); } diff --git a/src/gnutls.c b/src/gnutls.c index 470e0d154..d47ec7750 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -87,7 +87,7 @@ irc_tls_handshake(int fd, gnutls_session_t session) ret = gnutls_handshake(session); if (ret < 0) { - comm_close(fd); + rb_close(fd); gnutls_deinit(session); return -1; } diff --git a/src/irc_string.c b/src/irc_string.c index 26dbfca78..d1d8e2089 100644 --- a/src/irc_string.c +++ b/src/irc_string.c @@ -392,7 +392,7 @@ inetntoa(const char *in) * SOFTWARE. */ -#define SPRINTF(x) ((size_t)ircsprintf x) +#define SPRINTF(x) ((size_t)rb_sprintf x) /* * WARNING: Don't even consider trying to compile this on a system where @@ -811,7 +811,7 @@ inetpton(af, src, dst) if(inet_pton4(src, dst)) { char tmp[HOSTIPLEN]; - ircsprintf(tmp, "::ffff:%s", src); + rb_sprintf(tmp, "::ffff:%s", src); return (inet_pton6(tmp, dst)); } else diff --git a/src/ircd.c b/src/ircd.c index ff675e7ca..e3b981288 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -300,7 +300,7 @@ charybdis_io_loop(void) eventRun(); - comm_select(250); + rb_select(250); } } @@ -382,7 +382,7 @@ write_pidfile(const char *filename) { unsigned int pid = (unsigned int) getpid(); - ircsnprintf(buff, sizeof(buff), "%u\n", pid); + rb_snprintf(buff, sizeof(buff), "%u\n", pid); if((fputs(buff, fb) == -1)) { ilog(L_MAIN, "Error writing %u to pid file %s (%s)", @@ -567,7 +567,7 @@ main(int argc, char *argv[]) fdlist_init(); if(!server_state_foreground) { - comm_close_all(); + rb_close_all(); } init_main_logfile(); @@ -673,7 +673,7 @@ main(int argc, char *argv[]) eventAddIsh("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME); /* Setup the timeout check. I'll shift it later :) -- adrian */ - eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1); + eventAddIsh("rb_checktimeouts", rb_checktimeouts, NULL, 1); eventAdd("check_rehash", check_rehash, NULL, 1); diff --git a/src/kdparse.c b/src/kdparse.c index 7a1501357..6d3b5dee0 100644 --- a/src/kdparse.c +++ b/src/kdparse.c @@ -53,7 +53,7 @@ conf_add_fields(struct ConfItem *aconf, const char *host_field, if(!EmptyString(date_field)) { aconf->passwd = MyMalloc(strlen(pass_field) + strlen(date_field) + 4); - ircsprintf(aconf->passwd, "%s (%s)", pass_field, date_field); + rb_sprintf(aconf->passwd, "%s (%s)", pass_field, date_field); } else DupString(aconf->passwd, pass_field); diff --git a/src/listener.c b/src/listener.c index 2333680bf..78fd876cb 100644 --- a/src/listener.c +++ b/src/listener.c @@ -121,7 +121,7 @@ get_listener_name(const listener_t *listener) #endif port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port); - ircsnprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port); + rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port); return buf; } @@ -174,7 +174,7 @@ inetport(listener_t *listener) * At first, open a new socket */ - fd = comm_socket(listener->addr.ss_family, SOCK_STREAM, 0, "Listener socket"); + fd = rb_socket(listener->addr.ss_family, SOCK_STREAM, 0, "Listener socket"); #ifdef IPV6 if(listener->addr.ss_family == AF_INET6) @@ -218,7 +218,7 @@ inetport(listener_t *listener) report_error("setting SO_REUSEADDR for listener %s:%s", get_listener_name(listener), get_listener_name(listener), errno); - comm_close(fd); + rb_close(fd); return 0; } @@ -232,7 +232,7 @@ inetport(listener_t *listener) report_error("binding listener socket %s:%s", get_listener_name(listener), get_listener_name(listener), errno); - comm_close(fd); + rb_close(fd); return 0; } @@ -241,7 +241,7 @@ inetport(listener_t *listener) report_error("listen failed for %s:%s", get_listener_name(listener), get_listener_name(listener), errno); - comm_close(fd); + rb_close(fd); return 0; } @@ -403,7 +403,7 @@ close_listener(listener_t *listener) return; if(listener->fd >= 0) { - comm_close(listener->fd); + rb_close(listener->fd); listener->fd = -1; } @@ -465,7 +465,7 @@ add_connection(listener_t *listener, int fd, struct sockaddr *sai, int exempt) strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host)); - new_client->localClient->F = comm_add_fd(fd); + new_client->localClient->F = rb_add_fd(fd); new_client->localClient->listener = listener; ++listener->ref_count; @@ -508,11 +508,11 @@ accept_connection(int pfd, void *data) * be accepted until some old is closed first. */ - fd = comm_accept(listener->fd, (struct sockaddr *)&sai, &addrlen); + fd = rb_accept(listener->fd, (struct sockaddr *)&sai, &addrlen); if(fd < 0) { /* Re-register a new IO request for the next accept .. */ - comm_setselect(listener->fd, FDLIST_SERVICE, + rb_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ, accept_connection, listener, 0); return; } @@ -524,7 +524,7 @@ accept_connection(int pfd, void *data) * check for connection limit * TBD: this is stupid... either we have a socket or we don't. -nenolod */ - if((comm_get_maxconnections() - 10) < fd) + if((rb_get_maxconnections() - 10) < fd) { ++ServerStats->is_ref; /* @@ -539,9 +539,9 @@ accept_connection(int pfd, void *data) } write(fd, "ERROR :All connections in use\r\n", 32); - comm_close(fd); + rb_close(fd); /* Re-register a new IO request for the next accept .. */ - comm_setselect(listener->fd, FDLIST_SERVICE, + rb_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ, accept_connection, listener, 0); return; } @@ -556,7 +556,7 @@ accept_connection(int pfd, void *data) if(ConfigFileEntry.dline_with_reason) { - if (ircsnprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1)) + if (rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1)) { buf[sizeof(buf) - 3] = '\r'; buf[sizeof(buf) - 2] = '\n'; @@ -564,13 +564,13 @@ accept_connection(int pfd, void *data) } } else - ircsprintf(buf, "ERROR :You have been D-lined.\r\n"); + rb_sprintf(buf, "ERROR :You have been D-lined.\r\n"); write(fd, buf, strlen(buf)); - comm_close(fd); + rb_close(fd); /* Re-register a new IO request for the next accept .. */ - comm_setselect(listener->fd, FDLIST_SERVICE, + rb_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ, accept_connection, listener, 0); return; } @@ -579,6 +579,6 @@ accept_connection(int pfd, void *data) add_connection(listener, fd, (struct sockaddr *)&sai, aconf ? 1 : 0); /* Re-register a new IO request for the next accept .. */ - comm_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ, + rb_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ, accept_connection, listener, 0); } diff --git a/src/modules.c b/src/modules.c index 0d0836f69..2838487a7 100644 --- a/src/modules.c +++ b/src/modules.c @@ -267,7 +267,7 @@ load_all_modules(int warn) len = strlen(ldirent->d_name); if((len > 3) && !strcmp(ldirent->d_name+len-3, SHARED_SUFFIX)) { - (void) ircsnprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); + (void) rb_snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); (void) load_a_module(module_fq_name, warn, 0); } @@ -290,7 +290,7 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - ircsnprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, + rb_snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, core_module_table[i], SHARED_SUFFIX); if(load_a_module(module_name, warn, 1) == -1) @@ -325,7 +325,7 @@ load_one_module(const char *path, int coremodule) { mpath = pathst->data; - ircsnprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path); + rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path); if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) { if(stat(modpath, &statbuf) == 0) diff --git a/src/monitor.c b/src/monitor.c index 8456d6f55..35a36ec3e 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -103,7 +103,7 @@ monitor_signon(struct Client *client_p) if(monptr == NULL) return; - ircsnprintf(buf, sizeof(buf), "%s!%s@%s", + rb_snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host); sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf); diff --git a/src/packet.c b/src/packet.c index f7c47b4f9..98bace1b0 100644 --- a/src/packet.c +++ b/src/packet.c @@ -204,7 +204,7 @@ flood_recalc(int fd, void *data) return; /* and finally, reset the flood check */ - comm_setflush(fd, 1000, flood_recalc, client_p); + rb_setflush(fd, 1000, flood_recalc, client_p); } /* @@ -330,7 +330,7 @@ read_ctrl_packet(int fd, void *data) nodata: /* If we get here, we need to register for another COMM_SELECT_READ */ - comm_setselect(fd, FDLIST_SERVER, COMM_SELECT_READ, read_ctrl_packet, server, 0); + rb_setselect(fd, FDLIST_SERVER, COMM_SELECT_READ, read_ctrl_packet, server, 0); } /* @@ -362,7 +362,7 @@ read_packet(int fd, void *data) { if((length == -1) && ignoreErrno(errno)) { - comm_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT, + rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT, COMM_SELECT_READ, read_packet, client_p, 0); return; } @@ -416,12 +416,12 @@ read_packet(int fd, void *data) /* If we get here, we need to register for another COMM_SELECT_READ */ if(PARSE_AS_SERVER(client_p)) { - comm_setselect(client_p->localClient->F->fd, FDLIST_SERVER, COMM_SELECT_READ, + rb_setselect(client_p->localClient->F->fd, FDLIST_SERVER, COMM_SELECT_READ, read_packet, client_p, 0); } else { - comm_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT, + rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT, COMM_SELECT_READ, read_packet, client_p, 0); } } diff --git a/src/parse.c b/src/parse.c index 7e3ebecc7..3b5cd273f 100644 --- a/src/parse.c +++ b/src/parse.c @@ -600,10 +600,10 @@ do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int int tl; /* current length of presently being built string in t */ for (i = 2; i < (parc - 1); i++) { - tl = ircsprintf(t, " %s", parv[i]); + tl = rb_sprintf(t, " %s", parv[i]); t += tl; } - ircsprintf(t, " :%s", parv[parc - 1]); + rb_sprintf(t, " :%s", parv[parc - 1]); } if((target_p = find_client(parv[1])) != NULL) diff --git a/src/reject.c b/src/reject.c index f763c41d3..ac0171579 100644 --- a/src/reject.c +++ b/src/reject.c @@ -179,7 +179,7 @@ check_reject(struct Client *client_p) { ServerStats->is_rej++; SetReject(client_p); - comm_setselect(client_p->localClient->F->fd, FDLIST_NONE, COMM_SELECT_WRITE | COMM_SELECT_READ, NULL, NULL, 0); + rb_setselect(client_p->localClient->F->fd, FDLIST_NONE, COMM_SELECT_WRITE | COMM_SELECT_READ, NULL, NULL, 0); SetClosing(client_p); dlinkMoveNode(&client_p->localClient->tnode, &unknown_list, &delay_exit); return 1; @@ -277,7 +277,7 @@ add_unknown_ip(struct Client *client_p) { SetExUnknown(client_p); SetReject(client_p); - comm_setselect(client_p->localClient->F->fd, FDLIST_NONE, COMM_SELECT_WRITE | COMM_SELECT_READ, NULL, NULL, 0); + rb_setselect(client_p->localClient->F->fd, FDLIST_NONE, COMM_SELECT_WRITE | COMM_SELECT_READ, NULL, NULL, 0); SetClosing(client_p); dlinkMoveNode(&client_p->localClient->tnode, &unknown_list, &delay_exit); return 1; diff --git a/src/res.c b/src/res.c index a04b9735b..f0e9a4910 100644 --- a/src/res.c +++ b/src/res.c @@ -228,12 +228,12 @@ static void start_resolver(void) if (res_fd <= 0) /* there isn't any such thing as fd 0, that's just a myth. */ { - if ((res_fd = comm_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0, + if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0, "UDP resolver socket")) == -1) return; /* At the moment, the resolver FD data is global .. */ - comm_setselect(res_fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0); + rb_setselect(res_fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0); eventAdd("timeout_resolver", timeout_resolver, NULL, 1); } } @@ -254,7 +254,7 @@ void init_resolver(void) */ void restart_resolver(void) { - comm_close(res_fd); + rb_close(res_fd); res_fd = -1; eventDelete(timeout_resolver, NULL); /* -ddosen */ start_resolver(); @@ -444,7 +444,7 @@ static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_st struct sockaddr_in *v4 = (struct sockaddr_in *)addr; cp = (const unsigned char *)&v4->sin_addr.s_addr; - ircsprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), + rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), (unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0])); } #ifdef IPV6 @@ -745,7 +745,7 @@ static void res_readreply(int fd, void *data) /* Re-schedule a read *after* recvfrom, or we'll be registering * interest where it'll instantly be ready for read :-) -- adrian */ - comm_setselect(fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0); + rb_setselect(fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0); /* Better to cast the sizeof instead of rc */ if (rc <= (int)(sizeof(HEADER))) return; diff --git a/src/restart.c b/src/restart.c index 147b5dc3f..bcfeebfa6 100644 --- a/src/restart.c +++ b/src/restart.c @@ -55,7 +55,7 @@ void server_reboot(void) { int i; - int maxconn = comm_get_maxconnections(); + int maxconn = rb_get_maxconnections(); sendto_realops_snomask(SNO_GENERAL, L_ALL, "Restarting server..."); @@ -63,7 +63,7 @@ server_reboot(void) /* * XXX we used to call flush_connections() here. But since this routine * doesn't exist anymore, we won't be flushing. This is ok, since - * when close handlers come into existance, comm_close() will be called + * when close handlers come into existance, rb_close() will be called * below, and the data flushing will be implicit. * -- adrian * diff --git a/src/s_auth.c b/src/s_auth.c index 5c57ed2f3..7f89f86ee 100644 --- a/src/s_auth.c +++ b/src/s_auth.c @@ -158,7 +158,7 @@ release_auth_client(struct AuthRequest *auth) * -- adrian */ client->localClient->allow_read = MAX_FLOOD; - comm_setflush(client->localClient->F->fd, 1000, flood_recalc, client); + rb_setflush(client->localClient->F->fd, 1000, flood_recalc, client); dlinkAddTail(client, &client->node, &global_client_list); read_packet(client->localClient->F->fd, client); } @@ -249,7 +249,7 @@ auth_error(struct AuthRequest *auth) { ++ServerStats->is_abad; - comm_close(auth->fd); + rb_close(auth->fd); auth->fd = -1; ClearAuth(auth); @@ -278,7 +278,7 @@ start_auth_query(struct AuthRequest *auth) return 0; family = auth->client->localClient->ip.ss_family; - if((fd = comm_socket(family, SOCK_STREAM, 0, "ident")) == -1) + if((fd = rb_socket(family, SOCK_STREAM, 0, "ident")) == -1) { report_error("creating auth stream socket %s:%s", get_client_name(auth->client, SHOW_IP), @@ -290,12 +290,12 @@ start_auth_query(struct AuthRequest *auth) /* * TBD: this is a pointless arbitrary limit .. we either have a socket or not. -nenolod */ - if((comm_get_maxconnections() - 10) < fd) + if((rb_get_maxconnections() - 10) < fd) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Can't allocate fd for auth on %s", get_client_name(auth->client, SHOW_IP)); - comm_close(fd); + rb_close(fd); return 0; } @@ -324,7 +324,7 @@ start_auth_query(struct AuthRequest *auth) auth->fd = fd; SetAuthConnect(auth); - comm_connect_tcp(fd, auth->client->sockhost, 113, + rb_connect_tcp(fd, auth->client->sockhost, 113, (struct sockaddr *) &localaddr, GET_SS_LEN(localaddr), auth_connect_callback, auth, localaddr.ss_family, GlobalSetOptions.ident_timeout); @@ -440,7 +440,7 @@ timeout_auth_queries_event(void *notused) if(auth->timeout < CurrentTime) { if(auth->fd >= 0) - comm_close(auth->fd); + rb_close(auth->fd); if(IsDoingAuth(auth)) { @@ -463,7 +463,7 @@ timeout_auth_queries_event(void *notused) } /* - * auth_connect_callback() - deal with the result of comm_connect_tcp() + * auth_connect_callback() - deal with the result of rb_connect_tcp() * * If the connection failed, we simply close the auth fd and report * a failure. If the connection suceeded send the ident server a query @@ -502,7 +502,7 @@ auth_connect_callback(int fd, int error, void *data) auth_error(auth); return; } - ircsnprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", + rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", (unsigned int) ntohs(them.sin_port), (unsigned int) ntohs(us.sin_port)); if(write(auth->fd, authbuf, strlen(authbuf)) == -1) @@ -538,7 +538,7 @@ read_auth_reply(int fd, void *data) if(len < 0 && ignoreErrno(errno)) { - comm_setselect(fd, FDLIST_IDLECLIENT, COMM_SELECT_READ, read_auth_reply, auth, 0); + rb_setselect(fd, FDLIST_IDLECLIENT, COMM_SELECT_READ, read_auth_reply, auth, 0); return; } @@ -569,7 +569,7 @@ read_auth_reply(int fd, void *data) } } - comm_close(auth->fd); + rb_close(auth->fd); auth->fd = -1; ClearAuth(auth); @@ -611,7 +611,7 @@ delete_auth_queries(struct Client *target_p) delete_resolver_queries(&auth->dns_query); if(auth->fd >= 0) - comm_close(auth->fd); + rb_close(auth->fd); dlinkDelete(&auth->node, &auth_poll_list); free_auth_request(auth); diff --git a/src/s_conf.c b/src/s_conf.c index 1d6abd031..247ae6827 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -844,7 +844,7 @@ set_default_conf(void) ConfigFileEntry.reject_duration = 120; ConfigFileEntry.max_unknown_ip = 2; - ServerInfo.max_clients = comm_get_maxconnections() - MAX_BUFFER; + ServerInfo.max_clients = rb_get_maxconnections() - MAX_BUFFER; } #undef YES @@ -1082,13 +1082,13 @@ get_oper_name(struct Client *client_p) if(MyOper(client_p)) { - ircsnprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", + rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, client_p->localClient->opername); return buffer; } - ircsnprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", + rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, client_p->servptr->name); return buffer; @@ -1379,20 +1379,20 @@ write_confitem(KlineType type, struct Client *source_p, char *user, if(type == KLINE_TYPE) { - ircsnprintf(buffer, sizeof(buffer), + rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n", user, host, reason, oper_reason, current_date, get_oper_name(source_p), CurrentTime); } else if(type == DLINE_TYPE) { - ircsnprintf(buffer, sizeof(buffer), + rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n", host, reason, oper_reason, current_date, get_oper_name(source_p), CurrentTime); } else if(type == RESV_TYPE) { - ircsnprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",%ld\n", + rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",%ld\n", host, reason, get_oper_name(source_p), CurrentTime); } diff --git a/src/s_log.c b/src/s_log.c index 4e81dcd69..680b8b926 100644 --- a/src/s_log.c +++ b/src/s_log.c @@ -121,7 +121,7 @@ ilog(ilogfile dest, const char *format, ...) ircvsnprintf(buf, sizeof(buf), format, args); va_end(args); - ircsnprintf(buf2, sizeof(buf2), "%s %s\n", smalldate(), buf); + rb_snprintf(buf2, sizeof(buf2), "%s %s\n", smalldate(), buf); if(fputs(buf2, logfile) < 0) { @@ -214,7 +214,7 @@ smalldate(void) lt = localtime(<ime); - ircsnprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", + rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min); diff --git a/src/s_serv.c b/src/s_serv.c index 7662ae7e2..8b205992c 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -415,7 +415,7 @@ try_connections(void *unused) /* * We used to only print this if serv_connect() actually - * suceeded, but since comm_tcp_connect() can call the callback + * suceeded, but since rb_tcp_connect() can call the callback * immediately if there is an error, we were getting error messages * in the wrong order. SO, we just print out the activated line, * and let serv_connect() / serv_connect_callback() print an @@ -529,7 +529,7 @@ send_capabilities(struct Client *client_p, int cap_can_send) { if(cap->cap & cap_can_send) { - tl = ircsprintf(t, "%s ", cap->name); + tl = rb_sprintf(t, "%s ", cap->name); t += tl; } } @@ -560,7 +560,7 @@ burst_modes_TS5(struct Client *client_p, char *chname, dlink_list *list, char fl char *pp; int count = 0; - mlen = ircsprintf(buf, ":%s MODE %s +", me.name, chname); + mlen = rb_sprintf(buf, ":%s MODE %s +", me.name, chname); cur_len = mlen; mp = mbuf; @@ -587,7 +587,7 @@ burst_modes_TS5(struct Client *client_p, char *chname, dlink_list *list, char fl *mp++ = flag; *mp = '\0'; - pp += ircsprintf(pp, "%s ", banptr->banstr); + pp += rb_sprintf(pp, "%s ", banptr->banstr); cur_len += tlen; count++; } @@ -613,7 +613,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, int mlen; int cur_len; - cur_len = mlen = ircsprintf(buf, ":%s BMASK %ld %s %c :", + cur_len = mlen = rb_sprintf(buf, ":%s BMASK %ld %s %c :", me.id, (long) chptr->channelts, chptr->chname, flag); t = buf + mlen; @@ -640,7 +640,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, t = buf + mlen; } - ircsprintf(t, "%s ", banptr->banstr); + rb_sprintf(t, "%s ", banptr->banstr); t += tlen; cur_len += tlen; } @@ -719,7 +719,7 @@ burst_TS5(struct Client *client_p) if(*chptr->chname != '#') continue; - cur_len = mlen = ircsprintf(buf, ":%s SJOIN %ld %s %s :", me.name, + cur_len = mlen = rb_sprintf(buf, ":%s SJOIN %ld %s %s :", me.name, (long) chptr->channelts, chptr->chname, channel_modes(chptr, client_p)); @@ -744,7 +744,7 @@ burst_TS5(struct Client *client_p) t = buf + mlen; } - ircsprintf(t, "%s%s ", find_channel_status(msptr, 1), + rb_sprintf(t, "%s%s ", find_channel_status(msptr, 1), msptr->client_p->name); cur_len += tlen; @@ -877,7 +877,7 @@ burst_TS6(struct Client *client_p) if(*chptr->chname != '#') continue; - cur_len = mlen = ircsprintf(buf, ":%s SJOIN %ld %s %s :", me.id, + cur_len = mlen = rb_sprintf(buf, ":%s SJOIN %ld %s %s :", me.id, (long) chptr->channelts, chptr->chname, channel_modes(chptr, client_p)); @@ -901,7 +901,7 @@ burst_TS6(struct Client *client_p) t = buf + mlen; } - ircsprintf(t, "%s%s ", find_channel_status(msptr, 1), + rb_sprintf(t, "%s%s ", find_channel_status(msptr, 1), use_id(msptr->client_p)); cur_len += tlen; @@ -960,7 +960,7 @@ show_capabilities(struct Client *target_p) int tl; t = msgbuf; - tl = ircsprintf(msgbuf, "TS "); + tl = rb_sprintf(msgbuf, "TS "); t += tl; if(!IsServer(target_p) || !target_p->serv->caps) /* short circuit if no caps */ @@ -973,7 +973,7 @@ show_capabilities(struct Client *target_p) { if(cap->cap & target_p->serv->caps) { - tl = ircsprintf(t, "%s ", cap->name); + tl = rb_sprintf(t, "%s ", cap->name); t += tl; } } @@ -1063,7 +1063,7 @@ server_estab(struct Client *client_p) (me.info[0]) ? (me.info) : "IRCers United"); } - if(!comm_set_buffers(client_p->localClient->F->fd, READBUF_SIZE)) + if(!rb_set_buffers(client_p->localClient->F->fd, READBUF_SIZE)) report_error(SETBUF_ERROR_MSG, get_server_name(client_p, SHOW_IP), log_client_name(client_p, SHOW_IP), errno); @@ -1143,11 +1143,11 @@ server_estab(struct Client *client_p) /* we won't overflow FD_DESC_SZ here, as it can hold * client_p->name + 64 */ - comm_note(client_p->localClient->F->fd, "slink data: %s", client_p->name); - comm_note(client_p->localClient->ctrlfd, "slink ctrl: %s", client_p->name); + rb_note(client_p->localClient->F->fd, "slink data: %s", client_p->name); + rb_note(client_p->localClient->ctrlfd, "slink ctrl: %s", client_p->name); } else - comm_note(client_p->localClient->F->fd, "Server: %s", client_p->name); + rb_note(client_p->localClient->F->fd, "Server: %s", client_p->name); /* ** Old sendto_serv_but_one() call removed because we now @@ -1364,7 +1364,7 @@ fork_server(struct Client *server) goto fork_error; else if(ret == 0) { - int maxconn = comm_get_maxconnections(); + int maxconn = rb_get_maxconnections(); /* set our fds as non blocking and close everything else */ for (i = 0; i < maxconn; i++) @@ -1373,7 +1373,7 @@ fork_server(struct Client *server) if((i == ctrl_fds[1]) || (i == data_fds[1]) || (i == server->localClient->F->fd)) { - comm_set_nb(i); + rb_set_nb(i); } else { @@ -1384,9 +1384,9 @@ fork_server(struct Client *server) } } - ircsnprintf(fd_str[0], sizeof(fd_str[0]), "%d", ctrl_fds[1]); - ircsnprintf(fd_str[1], sizeof(fd_str[1]), "%d", data_fds[1]); - ircsnprintf(fd_str[2], sizeof(fd_str[2]), "%d", server->localClient->F->fd); + rb_snprintf(fd_str[0], sizeof(fd_str[0]), "%d", ctrl_fds[1]); + rb_snprintf(fd_str[1], sizeof(fd_str[1]), "%d", data_fds[1]); + rb_snprintf(fd_str[2], sizeof(fd_str[2]), "%d", server->localClient->F->fd); kid_argv[0] = slink; kid_argv[1] = fd_str[0]; kid_argv[2] = fd_str[1]; @@ -1401,7 +1401,7 @@ fork_server(struct Client *server) } else { - comm_close(server->localClient->F->fd); + rb_close(server->localClient->F->fd); /* close the childs end of the pipes */ close(ctrl_fds[1]); @@ -1409,9 +1409,9 @@ fork_server(struct Client *server) s_assert(server->localClient); server->localClient->ctrlfd = ctrl_fds[0]; - server->localClient->F = comm_add_fd(data_fds[0]); + server->localClient->F = rb_add_fd(data_fds[0]); - if(!comm_set_nb(server->localClient->F->fd)) + if(!rb_set_nb(server->localClient->F->fd)) { report_error(NONB_ERROR_MSG, get_server_name(server, SHOW_IP), @@ -1419,7 +1419,7 @@ fork_server(struct Client *server) errno); } - if(!comm_set_nb(server->localClient->ctrlfd)) + if(!rb_set_nb(server->localClient->ctrlfd)) { report_error(NONB_ERROR_MSG, get_server_name(server, SHOW_IP), @@ -1427,8 +1427,8 @@ fork_server(struct Client *server) errno); } - comm_open(server->localClient->ctrlfd, FD_SOCKET, NULL); - comm_open(server->localClient->F->fd, FD_SOCKET, NULL); + rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL); + rb_open(server->localClient->F->fd, FD_SOCKET, NULL); read_ctrl_packet(server->localClient->ctrlfd, server); read_packet(server->localClient->F->fd, server); @@ -1463,7 +1463,7 @@ fork_server(struct Client *server) * This code initiates a connection to a server. It first checks to make * sure the given server exists. If this is the case, it creates a socket, * creates a client, saves the socket information in the client, and - * initiates a connection to the server through comm_connect_tcp(). The + * initiates a connection to the server through rb_connect_tcp(). The * completion of this goes through serv_completed_connection(). * * We return 1 if the connection is attempted, since we don't know whether @@ -1496,7 +1496,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) } /* create a socket for the server connection */ - if((fd = comm_socket(server_p->aftype, SOCK_STREAM, 0, NULL)) < 0) + if((fd = rb_socket(server_p->aftype, SOCK_STREAM, 0, NULL)) < 0) { /* Eek, failure to create the socket */ report_error("opening stream socket to %s: %s", @@ -1505,7 +1505,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) } /* servernames are always guaranteed under HOSTLEN chars */ - comm_note(fd, "Server: %s", server_p->name); + rb_note(fd, "Server: %s", server_p->name); /* Create a local client */ client_p = make_client(NULL); @@ -1517,7 +1517,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) strlcpy(client_p->name, server_p->name, sizeof(client_p->name)); strlcpy(client_p->host, server_p->host, sizeof(client_p->host)); strlcpy(client_p->sockhost, server_p->host, sizeof(client_p->sockhost)); - client_p->localClient->F = comm_add_fd(fd); + client_p->localClient->F = rb_add_fd(fd); /* * Set up the initial server evilness, ripped straight from @@ -1525,7 +1525,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) * -- adrian */ - if(!comm_set_buffers(client_p->localClient->F->fd, READBUF_SIZE)) + if(!rb_set_buffers(client_p->localClient->F->fd, READBUF_SIZE)) { report_error(SETBUF_ERROR_MSG, get_server_name(client_p, SHOW_IP), @@ -1598,7 +1598,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) #endif (server_p->aftype == AF_INET ? "IPv4" : "?")); - comm_connect_tcp(client_p->localClient->F->fd, server_p->host, + rb_connect_tcp(client_p->localClient->F->fd, server_p->host, server_p->port, NULL, 0, serv_connect_callback, client_p, server_p->aftype, ConfigFileEntry.connect_timeout); @@ -1614,7 +1614,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) (server_p->aftype == AF_INET ? "IPv4" : "?"), vhoststr); - comm_connect_tcp(client_p->localClient->F->fd, server_p->host, + rb_connect_tcp(client_p->localClient->F->fd, server_p->host, server_p->port, (struct sockaddr *) &myipnum, GET_SS_LEN(myipnum), serv_connect_callback, client_p, myipnum.ss_family, ConfigFileEntry.connect_timeout); @@ -1637,7 +1637,7 @@ serv_connect_callback(int fd, int status, void *data) struct Client *client_p = data; struct server_conf *server_p; char *errstr; - fde_t *F = comm_locate_fd(fd); + fde_t *F = rb_locate_fd(fd); /* First, make sure its a real client! */ s_assert(client_p != NULL); @@ -1677,14 +1677,14 @@ serv_connect_callback(int fd, int status, void *data) #else client_p->host, #endif - comm_errstr(status)); + rb_errstr(status)); ilog(L_SERVER, "Error connecting to %s[%s]: %s", client_p->name, client_p->sockhost, - comm_errstr(status)); + rb_errstr(status)); } else { - errstr = strerror(comm_get_sockerr(fd)); + errstr = strerror(rb_get_sockerr(fd)); sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL, "Error connecting to %s[%s]: %s (%s)", client_p->name, @@ -1693,13 +1693,13 @@ serv_connect_callback(int fd, int status, void *data) #else client_p->host, #endif - comm_errstr(status), errstr); + rb_errstr(status), errstr); ilog(L_SERVER, "Error connecting to %s[%s]: %s (%s)", client_p->name, client_p->sockhost, - comm_errstr(status), errstr); + rb_errstr(status), errstr); } - exit_client(client_p, client_p, &me, comm_errstr(status)); + exit_client(client_p, client_p, &me, rb_errstr(status)); return; } diff --git a/src/s_user.c b/src/s_user.c index 3ef38c8e4..fcb854437 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -296,7 +296,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char del_from_client_hash(source_p->name, source_p); strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1); add_to_client_hash(source_p->name, source_p); - comm_note(source_p->localClient->F->fd, "Nick: %s", source_p->name); + rb_note(source_p->localClient->F->fd, "Nick: %s", source_p->name); } if(!valid_hostname(source_p->host)) @@ -461,7 +461,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char ServerStats->is_ref++; sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains " "only alphanumeric characters."); - ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username); + rb_sprintf(tmpstr2, "Invalid username [%s]", source_p->username); exit_client(client_p, source_p, &me, tmpstr2); return (CLIENT_EXITED); } diff --git a/src/send.c b/src/send.c index d33e16ce8..26abee249 100644 --- a/src/send.c +++ b/src/send.c @@ -145,7 +145,7 @@ send_queued_write(int fd, void *data) #ifdef USE_IODEBUG_HOOKS hook_data_int hd; #endif - fde_t *F = comm_locate_fd(to->localClient->F->fd); + fde_t *F = rb_locate_fd(to->localClient->F->fd); if (!F) return; @@ -202,7 +202,7 @@ send_queued_write(int fd, void *data) else flags = COMM_SELECT_WRITE; if(linebuf_len(&to->localClient->buf_sendq)) - comm_setselect(fd, FDLIST_IDLECLIENT, flags, + rb_setselect(fd, FDLIST_IDLECLIENT, flags, send_queued_write, to, 0); } @@ -265,7 +265,7 @@ send_queued_slink_write(int fd, void *data) /* if we have any more data, reschedule a write */ if(to->localClient->slinkq_len) - comm_setselect(to->localClient->ctrlfd, FDLIST_IDLECLIENT, + rb_setselect(to->localClient->ctrlfd, FDLIST_IDLECLIENT, COMM_SELECT_WRITE|COMM_SELECT_RETRY, send_queued_slink_write, to, 0); } diff --git a/src/supported.c b/src/supported.c index da3a2f215..3a0b3e2fc 100644 --- a/src/supported.c +++ b/src/supported.c @@ -181,7 +181,7 @@ const char * isupport_intptr(const void *ptr) { static char buf[15]; - ircsnprintf(buf, sizeof buf, "%d", *(const int *)ptr); + rb_snprintf(buf, sizeof buf, "%d", *(const int *)ptr); return buf; } @@ -210,7 +210,7 @@ isupport_chanmodes(const void *ptr) { static char result[80]; - ircsnprintf(result, sizeof result, "%s%sbq,k,%slj,imnpst%scgzLP%s", + rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,imnpst%scgzLP%s", ConfigChannel.use_except ? "e" : "", ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_forward ? "f" : "", @@ -224,7 +224,7 @@ isupport_chanlimit(const void *ptr) { static char result[30]; - ircsnprintf(result, sizeof result, "&#:%i", ConfigChannel.max_chans_per_user); + rb_snprintf(result, sizeof result, "&#:%i", ConfigChannel.max_chans_per_user); return result; } @@ -233,7 +233,7 @@ isupport_maxlist(const void *ptr) { static char result[30]; - ircsnprintf(result, sizeof result, "bq%s%s:%i", + rb_snprintf(result, sizeof result, "bq%s%s:%i", ConfigChannel.use_except ? "e" : "", ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans); @@ -245,7 +245,7 @@ isupport_targmax(const void *ptr) { static char result[200]; - ircsnprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:", + rb_snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:", ConfigFileEntry.max_targets, ConfigFileEntry.max_targets); return result; @@ -260,7 +260,7 @@ isupport_extban(const void *ptr) p = get_extban_string(); if (EmptyString(p)) return NULL; - ircsnprintf(result, sizeof result, "$,%s", p); + rb_snprintf(result, sizeof result, "$,%s", p); return result; }