diff --git a/Makefile.in b/Makefile.in index b372c89d..2a3b0656 100644 --- a/Makefile.in +++ b/Makefile.in @@ -172,7 +172,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/libltdl/config/config.sub \ $(top_srcdir)/libltdl/config/install-sh \ $(top_srcdir)/libltdl/config/ltmain.sh \ - $(top_srcdir)/libltdl/config/missing INSTALL TODO install-sh \ + $(top_srcdir)/libltdl/config/missing INSTALL install-sh \ libltdl/config/ar-lib libltdl/config/compile \ libltdl/config/config.guess libltdl/config/config.sub \ libltdl/config/depcomp libltdl/config/install-sh \ diff --git a/authd/Makefile.in b/authd/Makefile.in index a50e2586..e0d6401b 100644 --- a/authd/Makefile.in +++ b/authd/Makefile.in @@ -372,9 +372,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu authd/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign authd/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu authd/Makefile + $(AUTOMAKE) --foreign authd/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/authd/res.c b/authd/res.c index acfb71a3..59071b3f 100644 --- a/authd/res.c +++ b/authd/res.c @@ -557,7 +557,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr; cp = (const unsigned char *)&v4->sin_addr.s_addr; - rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), + 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 RB_IPV6 diff --git a/bandb/Makefile.in b/bandb/Makefile.in index 63bfdfc5..85e943fb 100644 --- a/bandb/Makefile.in +++ b/bandb/Makefile.in @@ -384,9 +384,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bandb/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bandb/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu bandb/Makefile + $(AUTOMAKE) --foreign bandb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/bandb/bandb.c b/bandb/bandb.c index 3b3ab8cc..6731136b 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -161,11 +161,11 @@ list_bans(void) for(j = 0; j < table.row_count; j++) { if(i == BANDB_KLINE) - rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s", + snprintf(buf, sizeof(buf), "%c %s %s %s :%s", bandb_letter[i], table.row[j][0], table.row[j][1], table.row[j][2], table.row[j][3]); else - rb_snprintf(buf, sizeof(buf), "%c %s %s :%s", + snprintf(buf, sizeof(buf), "%c %s %s :%s", bandb_letter[i], table.row[j][0], table.row[j][2], table.row[j][3]); @@ -288,7 +288,7 @@ static void db_error_cb(const char *errstr) { char buf[256]; - rb_snprintf(buf, sizeof(buf), "! :%s", errstr); + snprintf(buf, sizeof(buf), "! :%s", errstr); rb_helper_write(bandb_helper, "%s", buf); rb_sleep(2 << 30, 0); exit(1); diff --git a/bandb/bantool.c b/bandb/bantool.c index 3bebb596..e9bf4541 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -236,7 +236,7 @@ main(int argc, char *argv[]) /* checking for our files to import or export */ for(i = 0; i < LAST_BANDB_TYPE; i++) { - rb_snprintf(conf, sizeof(conf), "%s/%s.conf%s", + snprintf(conf, sizeof(conf), "%s/%s.conf%s", etc, bandb_table[i], bandb_suffix[i]); if(flag.import && flag.pretend == NO) @@ -297,11 +297,11 @@ export_config(const char *conf, int id) return; if(strstr(conf, ".perm") != 0) - rb_snprintf(sql, sizeof(sql), + snprintf(sql, sizeof(sql), "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time", bandb_table[id]); else - rb_snprintf(sql, sizeof(sql), + snprintf(sql, sizeof(sql), "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time", bandb_table[id]); @@ -330,7 +330,7 @@ export_config(const char *conf, int id) { case BANDB_DLINE: case BANDB_DLINE_PERM: - rb_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", table.row[j][mask1], mangle_reason(table.row[j][reason]), @@ -340,7 +340,7 @@ export_config(const char *conf, int id) case BANDB_XLINE: case BANDB_XLINE_PERM: - rb_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "\"%s\",\"0\",\"%s\",\"%s\",%s\n", escape_quotes(table.row[j][mask1]), mangle_reason(table.row[j][reason]), @@ -349,7 +349,7 @@ export_config(const char *conf, int id) case BANDB_RESV: case BANDB_RESV_PERM: - rb_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "\"%s\",\"%s\",\"%s\",%s\n", table.row[j][mask1], mangle_reason(table.row[j][reason]), @@ -358,7 +358,7 @@ export_config(const char *conf, int id) default: /* Klines */ - rb_snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", table.row[j][mask1], table.row[j][mask2], mangle_reason(table.row[j][reason]), @@ -497,9 +497,9 @@ import_config(const char *conf, int id) /* append operreason_field to reason_field */ if(!EmptyString(f_oreason)) - rb_snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason); + snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason); else - rb_snprintf(newreason, sizeof(newreason), "%s", f_reason); + snprintf(newreason, sizeof(newreason), "%s", f_reason); if(flag.pretend == NO) { @@ -859,7 +859,7 @@ bt_smalldate(const char *string) lt = gmtime(&t); if(lt == NULL) return NULL; - rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", + 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); return buf; } diff --git a/bandb/rsdb_sqlite3.c b/bandb/rsdb_sqlite3.c index 77898e82..df7e2e57 100644 --- a/bandb/rsdb_sqlite3.c +++ b/bandb/rsdb_sqlite3.c @@ -47,7 +47,7 @@ mlog(const char *errstr, ...) char buf[256]; va_list ap; va_start(ap, errstr); - rb_vsnprintf(buf, sizeof(buf), errstr, ap); + vsnprintf(buf, sizeof(buf), errstr, ap); va_end(ap); error_cb(buf); } @@ -73,14 +73,14 @@ rsdb_init(rsdb_error_cb * ecb) if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) { - rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s", + snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s", sqlite3_errmsg(rb_bandb)); mlog(errbuf); return -1; } if(access(dbpath, W_OK)) { - rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno)); + snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno)); mlog(errbuf); return -1; } diff --git a/configure b/configure index cd23742c..88dbc18b 100755 --- a/configure +++ b/configure @@ -15407,7 +15407,7 @@ _ACEOF fi -for ac_func in socketpair vsnprintf mmap gettimeofday strdup strndup +for ac_func in snprintf vsnprintf socketpair mmap gettimeofday strdup strndup do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 4c6406d3..3f406ea7 100644 --- a/configure.ac +++ b/configure.ac @@ -212,7 +212,7 @@ AC_CHECK_TYPE([sa_family_t], [], AC_CHECK_TYPES([uintptr_t]) dnl check for various functions... -AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ]) +AC_CHECK_FUNCS([snprintf vsnprintf socketpair mmap gettimeofday strdup strndup ]) AC_FUNC_ALLOCA diff --git a/doc/Makefile.in b/doc/Makefile.in index 8d7a6a76..4ed7d322 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -321,9 +321,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/Makefile + $(AUTOMAKE) --foreign doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/extensions/Makefile.in b/extensions/Makefile.in index f601935f..a71a2a72 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -683,9 +683,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extensions/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign extensions/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu extensions/Makefile + $(AUTOMAKE) --foreign extensions/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/extensions/extb_extgecos.c b/extensions/extb_extgecos.c index c3a311f2..6060044e 100644 --- a/extensions/extb_extgecos.c +++ b/extensions/extb_extgecos.c @@ -42,14 +42,14 @@ static int eb_extended(const char *data, struct Client *client_p, if (data == NULL) return EXTBAN_INVALID; - rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s", + snprintf(buf, BUFSIZE, "%s!%s@%s#%s", client_p->name, client_p->username, client_p->host, client_p->info); ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) { - rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s", + snprintf(buf, BUFSIZE, "%s!%s@%s#%s", client_p->name, client_p->username, client_p->orighost, client_p->info); ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; diff --git a/extensions/extb_hostmask.c b/extensions/extb_hostmask.c index bd513ea7..f376ffc6 100644 --- a/extensions/extb_hostmask.c +++ b/extensions/extb_hostmask.c @@ -38,16 +38,16 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, struct sockaddr_in ip4; char *s = src_host, *s2 = src_iphost, *s3 = NULL, *s4 = NULL; - 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); + sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); + sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost); /* handle hostmangling if necessary */ if (client_p->localClient->mangledhost != NULL) { if (!strcmp(client_p->host, client_p->localClient->mangledhost)) - rb_sprintf(src_althost, "%s!%s@%s", client_p->name, client_p->username, client_p->orighost); + sprintf(src_althost, "%s!%s@%s", client_p->name, client_p->username, client_p->orighost); else if (!IsDynSpoof(client_p)) - rb_sprintf(src_althost, "%s!%s@%s", client_p->name, client_p->username, client_p->localClient->mangledhost); + sprintf(src_althost, "%s!%s@%s", client_p->name, client_p->username, client_p->localClient->mangledhost); s3 = src_althost; } @@ -56,7 +56,7 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, /* handle Teredo if necessary */ if (client_p->localClient->ip.ss_family == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4)) { - rb_sprintf(src_ip4host, "%s!%s@", client_p->name, client_p->username); + sprintf(src_ip4host, "%s!%s@", client_p->name, client_p->username); s4 = src_ip4host + strlen(src_ip4host); rb_inet_ntop_sock((struct sockaddr *)&ip4, s4, src_ip4host + sizeof src_ip4host - s4); @@ -66,4 +66,3 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, return match(banstr, s) || match(banstr, s2) || (s3 != NULL && match(banstr, s3)) || (s4 != NULL && match(banstr, s4)) ? EXTBAN_MATCH : EXTBAN_NOMATCH; } - diff --git a/extensions/ip_cloaking_3.0.c b/extensions/ip_cloaking_3.0.c index 627bd366..e378a72f 100644 --- a/extensions/ip_cloaking_3.0.c +++ b/extensions/ip_cloaking_3.0.c @@ -124,11 +124,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf) if(ipv6) { - rb_snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum); + snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum); } else { - rb_snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum); + snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum); } } diff --git a/extensions/ip_cloaking_old.c b/extensions/ip_cloaking_old.c index 80b6807d..e27db589 100644 --- a/extensions/ip_cloaking_old.c +++ b/extensions/ip_cloaking_old.c @@ -93,7 +93,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask) if (ipmask == 0) { - rb_snprintf(outbuf, HOSTLEN, "%s-%X%X", + snprintf(outbuf, HOSTLEN, "%s-%X%X", ServerInfo.network_name, hosthash2, hosthash); len1 = strlen(outbuf); rest = strchr(inbuf, '.'); @@ -105,7 +105,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask) rb_strlcat(outbuf, rest, HOSTLEN); } else - rb_snprintf(outbuf, HOSTLEN, "%X%X.%s", + snprintf(outbuf, HOSTLEN, "%X%X.%s", hosthash2, hosthash, ServerInfo.network_name); } diff --git a/extensions/m_roleplay.c b/extensions/m_roleplay.c index 0d439b0e..73ae6218 100644 --- a/extensions/m_roleplay.c +++ b/extensions/m_roleplay.c @@ -186,9 +186,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac } if(underline) - rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3)); + snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3)); else - rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3)); + snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3)); /* don't allow nicks to be empty after stripping * this prevents nastiness like fake factions, etc. */ @@ -198,12 +198,12 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac return 0; } - rb_snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name); + snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name); if(action) - rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3); + snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3); else - rb_snprintf(text2, sizeof(text2), "%s", text3); + snprintf(text2, sizeof(text2), "%s", text3); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2); sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s", diff --git a/ircd/bandbi.c b/ircd/bandbi.c index 1e713220..8a2aa97c 100644 --- a/ircd/bandbi.c +++ b/ircd/bandbi.c @@ -85,11 +85,11 @@ start_bandb(void) rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1); if(bandb_path == NULL) { - rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix); if(access(fullpath, X_OK) == -1) { - rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s", + snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s", ConfigFileEntry.dpath, suffix); if(access(fullpath, X_OK) == -1) @@ -127,7 +127,7 @@ bandb_add(bandb_type type, struct Client *source_p, const char *mask1, static char buf[BUFSIZE]; - rb_snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1); + snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1); if(!EmptyString(mask2)) rb_snprintf_append(buf, sizeof(buf), "%s ", mask2); diff --git a/ircd/blacklist.c b/ircd/blacklist.c index 45ea5d09..a5317104 100644 --- a/ircd/blacklist.c +++ b/ircd/blacklist.c @@ -161,7 +161,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr; /* becomes 2.0.0.127.torbl.ahbl.org or whatever */ - rb_snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s", + snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s", (unsigned int) ip[3], (unsigned int) ip[2], (unsigned int) ip[1], @@ -190,7 +190,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * uint8_t lo = ip[i] & 0x0F; /* One part... (why 5? rb_snprintf adds \0) */ - rb_snprintf(bufptr, 5, "%1x.%1x.", + snprintf(bufptr, 5, "%1x.%1x.", (unsigned int) lo, /* Remember, backwards */ (unsigned int) hi); diff --git a/ircd/cache.c b/ircd/cache.c index 08e58b4a..43ffdb4d 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -188,7 +188,7 @@ cache_links(void *unused) /* if the below is ever modified, change LINKSLINELEN */ links_line = rb_malloc(LINKSLINELEN); - rb_snprintf(links_line, LINKSLINELEN, "%s %s :1 %s", + snprintf(links_line, LINKSLINELEN, "%s %s :1 %s", target_p->name, me.name, target_p->info[0] ? target_p->info : "(Unknown Location)"); @@ -265,7 +265,7 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - rb_snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); + 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); } @@ -280,7 +280,7 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - rb_snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); + snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); #if defined(S_ISLNK) && defined(HAVE_LSTAT) if(lstat(filename, &sb) < 0) @@ -350,7 +350,7 @@ cache_user_motd(void) if(local_tm != NULL) { - rb_snprintf(user_motd_changed, sizeof(user_motd_changed), + 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, diff --git a/ircd/capability.c b/ircd/capability.c index 075c0d41..71950212 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -179,7 +179,7 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) { if ((1 << entry->value) & cap_mask) { - tl = rb_sprintf(t, "%s ", entry->cap); + tl = sprintf(t, "%s ", entry->cap); t += tl; } } @@ -238,20 +238,20 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd struct DictionaryIter iter; struct CapabilityEntry *entry; - rb_snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); + snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); cb(buf, privdata); DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) { - rb_snprintf(buf, sizeof buf, "bit %d: '%s'", entry->value, entry->cap); + snprintf(buf, sizeof buf, "bit %d: '%s'", entry->value, entry->cap); cb(buf, privdata); } - rb_snprintf(buf, sizeof buf, "'%s': remaining bits - %u", idx->name, + snprintf(buf, sizeof buf, "'%s': remaining bits - %u", idx->name, (unsigned int)((sizeof(unsigned int) * 8) - (idx->highest_bit - 1))); cb(buf, privdata); } - rb_snprintf(buf, sizeof buf, "%ld capability indexes", rb_dlink_list_length(&capability_indexes)); + snprintf(buf, sizeof buf, "%ld capability indexes", rb_dlink_list_length(&capability_indexes)); cb(buf, privdata); } diff --git a/ircd/channel.c b/ircd/channel.c index 9bc684b4..f2836ba5 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -451,7 +451,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo { is_member = IsMember(client_p, chptr); - cur_len = mlen = rb_sprintf(lbuf, form_str(RPL_NAMREPLY), + cur_len = mlen = sprintf(lbuf, form_str(RPL_NAMREPLY), me.name, client_p->name, channel_pub_or_secret(chptr), chptr->chname); @@ -476,7 +476,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo t = lbuf + mlen; } - tlen = rb_sprintf(t, "%s%s!%s@%s ", find_channel_status(msptr, stack), + tlen = sprintf(t, "%s%s!%s@%s ", find_channel_status(msptr, stack), target_p->name, target_p->username, target_p->host); } else @@ -490,7 +490,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo t = lbuf + mlen; } - tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack), + tlen = sprintf(t, "%s%s ", find_channel_status(msptr, stack), target_p->name); } @@ -560,8 +560,8 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, /* if the buffers havent been built, do it here */ if(s == NULL) { - 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); + sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); + sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); s = src_host; s2 = src_iphost; @@ -571,14 +571,14 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, /* if host mangling mode enabled, also check their real host */ if(!strcmp(who->host, who->localClient->mangledhost)) { - rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); + 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)) { - rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); + sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); s3 = src_althost; } } @@ -586,7 +586,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, if(who->localClient->ip.ss_family == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4)) { - rb_sprintf(src_ip4host, "%s!%s@", who->name, who->username); + sprintf(src_ip4host, "%s!%s@", who->name, who->username); s4 = src_ip4host + strlen(src_ip4host); rb_inet_ntop_sock((struct sockaddr *)&ip4, s4, src_ip4host + sizeof src_ip4host - s4); @@ -736,21 +736,21 @@ can_join(struct Client *source_p, struct Channel *chptr, const char *key, const moduledata.chptr = chptr; moduledata.approved = 0; - 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); + sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host); + 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)) { - rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost); + 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)) { - rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost); + sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost); use_althost = 1; } } @@ -971,8 +971,8 @@ find_bannickchange_channel(struct Client *client_p) if (!MyClient(client_p)) return NULL; - 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); + sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); + sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost); RB_DLINK_FOREACH(ptr, client_p->user->channel.head) { @@ -1202,7 +1202,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'l'; if(!IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit); + pbuf += sprintf(pbuf, " %d", chptr->mode.limit); } if(*chptr->mode.key) @@ -1210,7 +1210,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'k'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key); + pbuf += sprintf(pbuf, " %s", chptr->mode.key); } if(chptr->mode.join_num) @@ -1218,7 +1218,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'j'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num, + pbuf += sprintf(pbuf, " %d:%d", chptr->mode.join_num, chptr->mode.join_time); } @@ -1228,7 +1228,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = 'f'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward); + pbuf += sprintf(pbuf, " %s", chptr->mode.forward); } *mbuf = '\0'; @@ -1273,7 +1273,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, pbuf = parabuf; dir = MODE_QUERY; - mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ", + mbl = preflen = sprintf(modebuf, ":%s TMODE %ld %s ", use_id(source_p), (long) chptr->channelts, chptr->chname); @@ -1336,7 +1336,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, if(arg != NULL) { - len = rb_sprintf(pbuf, "%s ", arg); + len = sprintf(pbuf, "%s ", arg); pbuf += len; pbl += len; mc++; diff --git a/ircd/chmode.c b/ircd/chmode.c index 4759d318..47d8034f 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -283,7 +283,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const if(IsPerson(source_p)) - rb_sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); + sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); else rb_strlcpy(who, source_p->name, sizeof(who)); @@ -851,7 +851,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, char buf[BANLEN]; banptr = ptr->data; if(banptr->forward) - rb_snprintf(buf, sizeof(buf), "%s$%s", banptr->banstr, banptr->forward); + snprintf(buf, sizeof(buf), "%s$%s", banptr->banstr, banptr->forward); else rb_strlcpy(buf, banptr->banstr, sizeof(buf)); @@ -981,7 +981,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, } if(removed && removed->forward) - removed_mask_pos += rb_snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1; + removed_mask_pos += snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1; else removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1; if(removed) @@ -1166,7 +1166,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr, if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0) return; - rb_sprintf(limitstr, "%d", limit); + sprintf(limitstr, "%d", limit); mode_changes[mode_count].letter = c; mode_changes[mode_count].dir = MODE_ADD; @@ -1741,9 +1741,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, return; if(IsServer(source_p)) - mlen = rb_sprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); + mlen = sprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); else - mlen = rb_sprintf(modebuf, ":%s!%s@%s MODE %s ", + mlen = sprintf(modebuf, ":%s!%s@%s MODE %s ", source_p->name, source_p->username, source_p->host, chptr->chname); @@ -1808,7 +1808,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, if(mode_changes[i].arg != NULL) { paracount++; - len = rb_sprintf(pbuf, "%s ", mode_changes[i].arg); + len = sprintf(pbuf, "%s ", mode_changes[i].arg); pbuf += len; paralen += len; } diff --git a/ircd/client.c b/ircd/client.c index 1948e995..dff08cd3 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -350,7 +350,7 @@ check_pings_list(rb_dlink_list * list) "No response from %s, closing link", log_client_name(client_p, HIDE_IP)); } - (void) rb_snprintf(scratch, sizeof(scratch), + (void) snprintf(scratch, sizeof(scratch), "Ping timeout: %d seconds", (int) (rb_current_time() - client_p->localClient->lasttime)); @@ -696,7 +696,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time) rb_dlinkDestroy(ptr, &client_p->on_allow_list); } - rb_snprintf(note, sizeof(note), "Nick: %s", nick); + snprintf(note, sizeof(note), "Nick: %s", nick); rb_note(client_p->localClient->F, note); } } @@ -926,16 +926,16 @@ get_client_name(struct Client *client, int showip) switch (showip) { case SHOW_IP: - rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", client->name, client->username, client->sockhost); break; case MASK_IP: - rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", + snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", client->name, client->username); break; default: - rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", + snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", client->name, client->username, client->host); } return nbuf; @@ -968,12 +968,12 @@ log_client_name(struct Client *target_p, int showip) switch (showip) { case SHOW_IP: - rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, + snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->sockhost); break; default: - rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, + snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, target_p->username, target_p->host); } @@ -1209,7 +1209,7 @@ dead_link(struct Client *client_p, int sendqex) if(sendqex) rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice)); else - rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); + snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); abt->client = client_p; SetIOError(client_p); @@ -1339,7 +1339,7 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie strcat(comment1, source_p->name); } if (IsPerson(from)) - rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s", + snprintf(newcomment, sizeof(newcomment), "by %s: %s", from->name, comment); if(source_p->serv != NULL) @@ -1417,7 +1417,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 */ - rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s", + 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), @@ -2010,7 +2010,7 @@ error_exit_client(struct Client *client_p, int error) if(error == 0) rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg)); else - rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error)); + snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error)); exit_client(client_p, client_p, &me, errmsg); } diff --git a/ircd/ircd.c b/ircd/ircd.c index b55ce238..668e9120 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -377,7 +377,7 @@ write_pidfile(const char *filename) { unsigned int pid = (unsigned int) getpid(); - rb_snprintf(buff, sizeof(buff), "%u\n", pid); + snprintf(buff, sizeof(buff), "%u\n", pid); if((fputs(buff, fb) == -1)) { ilog(L_MAIN, "Error writing %u to pid file %s (%s)", diff --git a/ircd/listener.c b/ircd/listener.c index caea7d39..7da77b7f 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -128,7 +128,7 @@ get_listener_name(const struct Listener *listener) if(listener == NULL) return NULL; - rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", + snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, get_listener_port(listener)); return buf; } @@ -562,7 +562,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi if(ConfigFileEntry.dline_with_reason) { - len = rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf)); + len = snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf)); if (len >= (int)(sizeof(buf)-1)) { buf[sizeof(buf) - 3] = '\r'; diff --git a/ircd/logger.c b/ircd/logger.c index e7f14f61..da895440 100644 --- a/ircd/logger.c +++ b/ircd/logger.c @@ -84,7 +84,7 @@ verify_logfile_access(const char *filename) if(access(dirname, F_OK) == -1) { - rb_snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname); + snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname); if(testing_conf || server_state_foreground) fprintf(stderr, "%s\n", buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf); @@ -95,7 +95,7 @@ verify_logfile_access(const char *filename) { if(access(dirname, W_OK) == -1) { - rb_snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - access to parent directory %s failed: %s", + snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - access to parent directory %s failed: %s", filename, dirname, strerror(errno)); if(testing_conf || server_state_foreground) fprintf(stderr, "%s\n", buf); @@ -106,7 +106,7 @@ verify_logfile_access(const char *filename) if(access(filename, W_OK) == -1) { - rb_snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno)); + snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno)); if(testing_conf || server_state_foreground) fprintf(stderr, "%s\n", buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf); @@ -177,10 +177,10 @@ ilog(ilogfile dest, const char *format, ...) return; va_start(args, format); - rb_vsnprintf(buf, sizeof(buf), format, args); + vsnprintf(buf, sizeof(buf), format, args); va_end(args); - rb_snprintf(buf2, sizeof(buf2), "%s %s\n", + snprintf(buf2, sizeof(buf2), "%s %s\n", smalldate(rb_current_time()), buf); if(fputs(buf2, logfile) < 0) @@ -209,7 +209,7 @@ inotice(const char *format, ...) va_list args; va_start(args, format); - rb_vsnprintf(buf, sizeof(buf), format, args); + vsnprintf(buf, sizeof(buf), format, args); va_end(args); _iprint("notice", buf); @@ -224,7 +224,7 @@ iwarn(const char *format, ...) va_list args; va_start(args, format); - rb_vsnprintf(buf, sizeof(buf), format, args); + vsnprintf(buf, sizeof(buf), format, args); va_end(args); _iprint("warning", buf); @@ -239,7 +239,7 @@ ierror(const char *format, ...) va_list args; va_start(args, format); - rb_vsnprintf(buf, sizeof(buf), format, args); + vsnprintf(buf, sizeof(buf), format, args); va_end(args); _iprint("error", buf); @@ -274,7 +274,7 @@ smalldate(time_t ltime) lt = localtime(<ime); - rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", + 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/ircd/modules.c b/ircd/modules.c index d2191b3f..03d5139c 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -240,12 +240,12 @@ load_all_modules(int warn) while ((ldirent = readdir(system_module_dir)) != NULL) { - len = strlen(ldirent->d_name); + len = strlen(ldirent->d_name); if((len > 3) && !strcmp(ldirent->d_name+len-3, ".la")) - { - (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); - } + { + (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); + (void) load_a_module(module_fq_name, warn, 0); + } } (void) closedir(system_module_dir); @@ -266,7 +266,7 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - rb_snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, + snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, core_module_table[i], ".la"); if(load_a_module(module_name, warn, 1) == -1) @@ -301,7 +301,7 @@ load_one_module(const char *path, int coremodule) { mpath = pathst->data; - rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath, path); + snprintf(modpath, sizeof(modpath), "%s/%s", mpath, path); if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) { if(stat(modpath, &statbuf) == 0) diff --git a/ircd/monitor.c b/ircd/monitor.c index 1c1aa77d..bab371ed 100644 --- a/ircd/monitor.c +++ b/ircd/monitor.c @@ -95,7 +95,7 @@ monitor_signon(struct Client *client_p) if(monptr == NULL) return; - rb_snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host); + 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/ircd/newconf.c b/ircd/newconf.c index 32ba83e3..2ffb756b 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -2034,7 +2034,7 @@ conf_report_error(const char *fmt, ...) char msg[IRCD_BUFSIZE + 1] = { 0 }; va_start(ap, fmt); - rb_vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); + vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); va_end(ap); if (testing_conf) diff --git a/ircd/parse.c b/ircd/parse.c index 9ddd73b7..b9c50d3c 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -373,7 +373,7 @@ handle_command(struct Message *mptr, struct Client *client_p, ilog(L_SERVER, "Insufficient parameters (%d < %d) for command '%s' from %s.", i, ehandler.min_para, mptr->cmd, client_p->name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Insufficient parameters (%d < %d) for command '%s'", i, ehandler.min_para, mptr->cmd); exit_client(client_p, client_p, client_p, squitreason); @@ -618,10 +618,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 = rb_sprintf(t, " %s", parv[i]); + tl = sprintf(t, " %s", parv[i]); t += tl; } - rb_sprintf(t, " :%s", parv[parc - 1]); + sprintf(t, " :%s", parv[parc - 1]); } if((target_p = find_client(parv[1])) != NULL) diff --git a/ircd/restart.c b/ircd/restart.c index 5bf39f56..9cb81255 100644 --- a/ircd/restart.c +++ b/ircd/restart.c @@ -77,7 +77,7 @@ server_reboot(void) execv(SPATH, (void *)myargv); /* use this if execv of SPATH fails */ - rb_snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath); + snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath); execv(path, (void *)myargv); exit(-1); diff --git a/ircd/s_auth.c b/ircd/s_auth.c index cbde97b0..d0bde66c 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -492,7 +492,7 @@ auth_connect_callback(rb_fde_t *F, int error, void *data) return; } - rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", + snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", auth->rport, auth->lport); authlen = strlen(authbuf); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 6c825ffc..03776789 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1269,13 +1269,13 @@ get_oper_name(struct Client *client_p) if(MyOper(client_p)) { - rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", + snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, client_p->localClient->opername); return buffer; } - rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", + snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, client_p->servptr->name); return buffer; @@ -1319,7 +1319,7 @@ get_user_ban_reason(struct ConfItem *aconf) if (aconf->flags & CONF_FLAGS_TEMPORARY && (aconf->status == CONF_KILL || aconf->status == CONF_DLINE)) - rb_snprintf(reasonbuf, sizeof reasonbuf, + snprintf(reasonbuf, sizeof reasonbuf, "Temporary %c-line %d min. - ", aconf->status == CONF_DLINE ? 'D' : 'K', (int)((aconf->hold - aconf->created) / 60)); @@ -1355,7 +1355,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf, *oper_reason = NULL; else { - rb_snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)", + snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)", EmptyString(aconf->spasswd) ? "" : aconf->spasswd, EmptyString(aconf->spasswd) ? "" : " ", aconf->info.oper); diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index 5099487b..7231d13e 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -209,7 +209,7 @@ propagate_generic(struct Client *source_p, const char *command, va_list args; va_start(args, format); - rb_vsnprintf(buffer, sizeof(buffer), format, args); + vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); sendto_match_servs(source_p, target, cap, NOCAPS, @@ -230,7 +230,7 @@ cluster_generic(struct Client *source_p, const char *command, rb_dlink_node *ptr; va_start(args, format); - rb_vsnprintf(buffer, sizeof(buffer), format, args); + vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); RB_DLINK_FOREACH(ptr, cluster_conf_list.head) @@ -827,4 +827,3 @@ find_tgchange(const char *host) return NULL; } - diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 20dd4ddd..f3e59389 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -503,7 +503,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, int mlen; int cur_len; - cur_len = mlen = rb_sprintf(buf, ":%s BMASK %ld %s %c :", + cur_len = mlen = sprintf(buf, ":%s BMASK %ld %s %c :", me.id, (long) chptr->channelts, chptr->chname, flag); t = buf + mlen; @@ -531,9 +531,9 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, } if (banptr->forward) - rb_sprintf(t, "%s$%s ", banptr->banstr, banptr->forward); + sprintf(t, "%s$%s ", banptr->banstr, banptr->forward); else - rb_sprintf(t, "%s ", banptr->banstr); + sprintf(t, "%s ", banptr->banstr); t += tlen; cur_len += tlen; } @@ -634,7 +634,7 @@ burst_TS6(struct Client *client_p) if(*chptr->chname != '#') continue; - cur_len = mlen = rb_sprintf(buf, ":%s SJOIN %ld %s %s :", me.id, + cur_len = mlen = sprintf(buf, ":%s SJOIN %ld %s %s :", me.id, (long) chptr->channelts, chptr->chname, channel_modes(chptr, client_p)); @@ -658,7 +658,7 @@ burst_TS6(struct Client *client_p) t = buf + mlen; } - rb_sprintf(t, "%s%s ", find_channel_status(msptr, 1), + sprintf(t, "%s%s ", find_channel_status(msptr, 1), use_id(msptr->client_p)); cur_len += tlen; @@ -868,7 +868,7 @@ server_estab(struct Client *client_p) hdata.target = client_p; call_hook(h_server_introduced, &hdata); - rb_snprintf(note, sizeof(note), "Server: %s", client_p->name); + snprintf(note, sizeof(note), "Server: %s", client_p->name); rb_note(client_p->localClient->F, note); /* @@ -973,7 +973,7 @@ server_estab(struct Client *client_p) /* * serv_connect() - initiate a server connection * - * inputs - pointer to conf + * inputs - pointer to conf * - pointer to client doing the connet * output - * side effects - @@ -1025,7 +1025,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) } /* servernames are always guaranteed under HOSTLEN chars */ - rb_snprintf(note, sizeof(note), "Server: %s", server_p->name); + snprintf(note, sizeof(note), "Server: %s", server_p->name); rb_note(F, note); /* Create a local client */ diff --git a/ircd/s_user.c b/ircd/s_user.c index b2e3829c..2f65e2af 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -295,7 +295,7 @@ register_local_user(struct Client *client_p, struct Client *source_p) rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1); add_to_client_hash(source_p->name, source_p); - rb_snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name); + snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name); rb_note(source_p->localClient->F, note); } @@ -477,7 +477,7 @@ register_local_user(struct Client *client_p, struct Client *source_p) ServerStats.is_ref++; sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains " "only alphanumeric characters."); - rb_sprintf(tmpstr2, "Invalid username [%s]", source_p->username); + sprintf(tmpstr2, "Invalid username [%s]", source_p->username); exit_client(client_p, source_p, &me, tmpstr2); return (CLIENT_EXITED); } diff --git a/ircd/send.c b/ircd/send.c index a2a62217..f41355d9 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -478,7 +478,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p, current_serial++; va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); if(IsServer(source_p)) @@ -921,7 +921,7 @@ sendto_match_butone(struct Client *one, struct Client *source_p, rb_linebuf_newbuf(&rb_linebuf_id); va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); if(IsServer(source_p)) @@ -991,7 +991,7 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap, rb_linebuf_newbuf(&rb_linebuf_id); va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, @@ -1166,7 +1166,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...) { /* rather a lot of copying around, oh well -- jilles */ va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); rb_linebuf_putmsg(&linebuf, pattern, NULL, ":%s NOTICE * :*** Notice -- %s", me.name, buf); @@ -1180,7 +1180,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...) { /* rather a lot of copying around, oh well -- jilles */ va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); rb_linebuf_putmsg(&linebuf, pattern, NULL, ":%s NOTICE * :*** Notice -- %s", me.name, buf); @@ -1343,7 +1343,7 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char rb_linebuf_newbuf(&rb_linebuf_id); va_start(args, pattern); - rb_vsnprintf(buf, sizeof(buf), pattern, args); + vsnprintf(buf, sizeof(buf), pattern, args); va_end(args); rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s", diff --git a/ircd/sslproc.c b/ircd/sslproc.c index c82a8613..3cb93186 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -246,11 +246,11 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co if(ssld_path == NULL) { - rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix); if(access(fullpath, X_OK) == -1) { - rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s", + snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s", ConfigFileEntry.dpath, suffix); if(access(fullpath, X_OK) == -1) { @@ -277,16 +277,16 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co rb_set_buffers(F1, READBUF_SIZE); rb_set_buffers(F2, READBUF_SIZE); - rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2)); + snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2)); rb_setenv("CTL_FD", fdarg, 1); if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1) { ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno)); return started; } - rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1)); + snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1)); rb_setenv("CTL_PIPE", fdarg, 1); - rb_snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid()); + snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid()); rb_setenv("CTL_PPID", s_pid, 1); #ifdef _WIN32 SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1); @@ -434,7 +434,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf) rb_free(client_p->certfp); certfp_string = rb_malloc(len * 2 + 1); for(i = 0; i < len; i++) - rb_snprintf(certfp_string + 2 * i, 3, "%02x", + snprintf(certfp_string + 2 * i, 3, "%02x", certfp[i]); client_p->certfp = certfp_string; } @@ -630,7 +630,7 @@ send_new_ssl_certs_one(ssl_ctl_t * ctl, const char *ssl_cert, const char *ssl_pr len, sizeof(tmpbuf)); return; } - len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c%s%c", nul, ssl_cert, nul, + len = snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c%s%c", nul, ssl_cert, nul, ssl_private_key, nul, ssl_dh_params, nul, ssl_cipher_list != NULL ? ssl_cipher_list : "", nul); ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len); @@ -660,7 +660,7 @@ send_init_prng(ssl_ctl_t * ctl, prng_seed_t seedtype, const char *path) return; } - len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul); + len = snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul); ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len); } diff --git a/ircd/supported.c b/ircd/supported.c index 69a95d62..2f83df53 100644 --- a/ircd/supported.c +++ b/ircd/supported.c @@ -201,7 +201,7 @@ const char * isupport_intptr(const void *ptr) { static char buf[15]; - rb_snprintf(buf, sizeof buf, "%d", *(const int *)ptr); + snprintf(buf, sizeof buf, "%d", *(const int *)ptr); return buf; } @@ -240,7 +240,7 @@ isupport_chanmodes(const void *ptr) { static char result[80]; - rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,%s", + snprintf(result, sizeof result, "%s%sbq,k,%slj,%s", ConfigChannel.use_except ? "e" : "", ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_forward ? "f" : "", @@ -259,7 +259,7 @@ isupport_chanlimit(const void *ptr) { static char result[30]; - rb_snprintf(result, sizeof result, "%s:%i", + snprintf(result, sizeof result, "%s:%i", ConfigChannel.disable_local_channels ? "#" : "&#", ConfigChannel.max_chans_per_user); return result; } @@ -269,7 +269,7 @@ isupport_maxlist(const void *ptr) { static char result[30]; - rb_snprintf(result, sizeof result, "bq%s%s:%i", + snprintf(result, sizeof result, "bq%s%s:%i", ConfigChannel.use_except ? "e" : "", ConfigChannel.use_invex ? "I" : "", ConfigChannel.max_bans); @@ -281,7 +281,7 @@ isupport_targmax(const void *ptr) { static char result[200]; - rb_snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:", + 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; @@ -296,7 +296,7 @@ isupport_extban(const void *ptr) p = get_extban_string(); if (EmptyString(p)) return NULL; - rb_snprintf(result, sizeof result, "$,%s", p); + snprintf(result, sizeof result, "$,%s", p); return result; } @@ -305,7 +305,7 @@ isupport_nicklen(const void *ptr) { static char result[200]; - rb_snprintf(result, sizeof result, "%u", ConfigFileEntry.nicklen - 1); + snprintf(result, sizeof result, "%u", ConfigFileEntry.nicklen - 1); return result; } diff --git a/libratbox/configure b/libratbox/configure index f405a39a..14d1e660 100755 --- a/libratbox/configure +++ b/libratbox/configure @@ -13954,7 +13954,7 @@ fi -for ac_func in socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create +for ac_func in snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17914,4 +17914,3 @@ echo "IPv6 support ................... $have_v6" echo "Assert debugging ............... $assert" echo "SSL Type........................ $SSL_TYPE" echo - diff --git a/libratbox/configure.ac b/libratbox/configure.ac index 4168bde4..c2bbf773 100644 --- a/libratbox/configure.ac +++ b/libratbox/configure.ac @@ -24,7 +24,7 @@ AC_PROG_CC_C99 if test x"$ac_cv_prog_cc_c99" = "xno"; then AC_ERROR([ircd-ratbox requires a C99 capable compiler]) fi - + AC_PROG_INSTALL AC_PROG_EGREP @@ -192,7 +192,7 @@ RB_PROTO_INET6([], [ ]) fi -fi +fi AC_CHECK_TYPES([struct sockaddr_storage],[ rb_have_sockaddr_storage=yes @@ -200,7 +200,7 @@ AC_CHECK_TYPES([struct sockaddr_storage],[ #include #include ]) - + dnl Check for stdarg.h - if we cant find it, halt configure AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - libratbox will not compile without it **])]) @@ -212,7 +212,7 @@ AC_CHECK_TYPE([sa_family_t], [], dnl check for various functions... -AC_CHECK_FUNCS([socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) +AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) @@ -228,7 +228,7 @@ if test -c "/dev/poll"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll]) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi @@ -327,14 +327,14 @@ fi if test "$cf_enable_openssl" != no; then CPPFLAGS="$CPPFLAGS $SSL_LIBS" - AC_CHECK_LIB(crypto, RAND_status, + AC_CHECK_LIB(crypto, RAND_status, [cf_enable_openssl=yes], [cf_enable_openssl=no]) fi if test "$cf_enable_openssl" != no; then CPPFLAGS="$CPPFLAGS $SSL_LIBS" - AC_CHECK_LIB(ssl, SSL_read, + AC_CHECK_LIB(ssl, SSL_read, [SSL_LIBS="$SSL_LIBS -lssl -lcrypto"], [cf_enable_openssl=no], [-lcrypto]) fi @@ -364,11 +364,11 @@ AC_ARG_ENABLE(gnutls, AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])], [cf_enable_gnutls=$enableval], [cf_enable_gnutls="auto"]) - + if test "$cf_enable_gnutls" != no; then PKG_CHECK_MODULES(GNUTLS, [gnutls], [ - cf_enable_gnutls="yes" - ], [cf_enable_gnutls="no"]) + cf_enable_gnutls="yes" + ], [cf_enable_gnutls="no"]) fi dnl mbed TLS is given highest preference when no specified TLS library is provided @@ -390,10 +390,10 @@ if test x"$cf_enable_openssl" != xno; then elif test x"$cf_enable_mbedtls" != xno; then AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS]) SSL_LIBS="" - SSL_CFLAGS="" + SSL_CFLAGS="" GNUTLS_CFLAGS="" GNUTLS_LIBS="" - SSL_TYPE="mbedtls" + SSL_TYPE="mbedtls" elif test x"$cf_enable_gnutls" != xno; then AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS]) SSL_LIBS="" @@ -462,7 +462,7 @@ AC_SUBST(GNUTLS_LIBS) AC_SUBST(MBEDTLS_CFLAGS) AC_SUBST(MBEDTLS_LIBS) -if test "$prefix" = "NONE"; then +if test "$prefix" = "NONE"; then AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where libratbox is installed.]) else @@ -472,7 +472,7 @@ dnl a custom prefix with a trailing slash prefix=`echo $prefix | sed 's/\/$//'` AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where libratbox is installed.]) - + fi AC_SUBST(RB_PREFIX) @@ -481,14 +481,14 @@ AC_CONFIG_COMMANDS([include/librb-config.h], [ outfile=include/librb-config.h.tmp cat > $outfile <<\_______EOF -/* +/* * librb-config.h: libratbox config file. Please modify configure.ac */ - + #ifndef __LIBRB_CONFIG_H #define __LIBRB_CONFIG_H -_______EOF +_______EOF if test "x$rb_have_ipv6" = "xyes"; then echo "#define RB_IPV6 1" >> $outfile @@ -651,18 +651,18 @@ fi rb_socklen_t=$rb_socklen_t if test "x$rb_have_sockaddr_storage" = "xyes"; then - rb_sockaddr_storage="yes" + rb_sockaddr_storage="yes" else rb_sockaddr_storage="no" fi - + rb_have_ipv6="$have_v6" - + rb_mv="$MV" rb_rm="$RM" - + ] - + ) @@ -687,4 +687,3 @@ echo "IPv6 support ................... $have_v6" echo "Assert debugging ............... $assert" echo "SSL Type........................ $SSL_TYPE" echo - diff --git a/libratbox/include/ratbox_lib.h b/libratbox/include/ratbox_lib.h index b2d4af91..d99a229c 100644 --- a/libratbox/include/ratbox_lib.h +++ b/libratbox/include/ratbox_lib.h @@ -220,7 +220,6 @@ pid_t rb_getpid(void); #include #include #include -#include #include #include #include diff --git a/libratbox/include/rb_snprintf.h b/libratbox/include/rb_snprintf.h deleted file mode 100644 index b9979b09..00000000 --- a/libratbox/include/rb_snprintf.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * ircd-ratbox: A slightly useful ircd. - * sprintf_rb_.h: The irc sprintf header. - * - * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2002-2005 ircd-ratbox development team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - * - * $Id: rb_snprintf.h 26092 2008-09-19 15:13:52Z androsyn $ - */ - -#ifndef RB_LIB_H -# error "Do not use snprintf.h directly" -#endif - -#ifndef SPRINTF_IRC -#define SPRINTF_IRC - -/*============================================================================= - * Proto types - */ - - -/* - * rb_sprintf - optimized sprintf - */ -#ifdef __GNUC__ -int -rb_sprintf(char *str, const char *fmt, ...) -__attribute((format(printf, 2, 3))); - int rb_snprintf(char *str, const size_t size, const char *, ...) - __attribute__ ((format(printf, 3, 4))); - int rb_sprintf_append(char *str, const char *format, ...) __attribute((format(printf, 2, 3))); - int rb_snprintf_append(char *str, size_t len, const char *format, ...) - __attribute__ ((format(printf, 3, 4))); -#else -int rb_sprintf(char *str, const char *format, ...); -int rb_snprintf(char *str, const size_t size, const char *, ...); -int rb_sprintf_append(char *str, const char *format, ...); -int rb_snprintf_append(char *str, const size_t size, const char *, ...); - -#endif - -int rb_vsnprintf(char *str, const size_t size, const char *fmt, va_list args); -int rb_vsprintf(char *str, const char *fmt, va_list args); -int rb_vsnprintf_append(char *str, const size_t size, const char *fmt, va_list args); -int rb_vsprintf_append(char *str, const char *fmt, va_list args); - -#endif /* SPRINTF_IRC */ diff --git a/libratbox/include/rb_tools.h b/libratbox/include/rb_tools.h index 4806c99f..9a2e2949 100644 --- a/libratbox/include/rb_tools.h +++ b/libratbox/include/rb_tools.h @@ -34,6 +34,14 @@ size_t rb_strlcpy(char *dst, const char *src, size_t siz); size_t rb_strlcat(char *dst, const char *src, size_t siz); size_t rb_strnlen(const char *s, size_t count); + +#ifdef __GNUC__ +int rb_snprintf_append(char *str, size_t len, const char *format, ...) + __attribute__ ((format(printf, 3, 4))); +#else +int rb_snprintf_append(char *str, const size_t size, const char *, ...); +#endif + char *rb_basename(const char *); char *rb_dirname(const char *); diff --git a/libratbox/src/Makefile.am b/libratbox/src/Makefile.am index e930334e..13284355 100644 --- a/libratbox/src/Makefile.am +++ b/libratbox/src/Makefile.am @@ -27,7 +27,6 @@ libratbox_la_SOURCES = \ ratbox_lib.c \ rb_memory.c \ linebuf.c \ - snprintf.c \ tools.c \ helper.c \ devpoll.c \ @@ -41,8 +40,7 @@ libratbox_la_SOURCES = \ patricia.c \ arc4random.c \ version.c - + libratbox_la_LDFLAGS = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt libratbox_la_LIBADD = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ lib_LTLIBRARIES = libratbox.la - diff --git a/libratbox/src/Makefile.in b/libratbox/src/Makefile.in index 915291b0..da86268f 100644 --- a/libratbox/src/Makefile.in +++ b/libratbox/src/Makefile.in @@ -133,10 +133,9 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libratbox_la_DEPENDENCIES = am_libratbox_la_OBJECTS = unix.lo win32.lo crypt.lo balloc.lo \ commio.lo mbedtls.lo openssl.lo gnutls.lo nossl.lo event.lo \ - ratbox_lib.lo rb_memory.lo linebuf.lo snprintf.lo tools.lo \ - helper.lo devpoll.lo epoll.lo poll.lo ports.lo sigio.lo \ - select.lo kqueue.lo rawbuf.lo patricia.lo arc4random.lo \ - version.lo + ratbox_lib.lo rb_memory.lo linebuf.lo tools.lo helper.lo \ + devpoll.lo epoll.lo poll.lo ports.lo sigio.lo select.lo \ + kqueue.lo rawbuf.lo patricia.lo arc4random.lo version.lo libratbox_la_OBJECTS = $(am_libratbox_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -359,7 +358,6 @@ libratbox_la_SOURCES = \ ratbox_lib.c \ rb_memory.c \ linebuf.c \ - snprintf.c \ tools.c \ helper.c \ devpoll.c \ @@ -478,7 +476,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rb_memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ diff --git a/libratbox/src/commio.c b/libratbox/src/commio.c index 4c40aab0..35cf809b 100644 --- a/libratbox/src/commio.c +++ b/libratbox/src/commio.c @@ -1174,26 +1174,6 @@ inetntoa(const char *in) return buf; } - -/* - * Copyright (c) 1996-1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#define SPRINTF(x) ((size_t)rb_sprintf x) - /* * WARNING: Don't even consider trying to compile this on a system where * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. @@ -1317,7 +1297,7 @@ inet_ntop6(const unsigned char *src, char *dst, unsigned int size) tp += strlen(tp); break; } - tp += SPRINTF((tp, "%x", words[i])); + tp += sprintf(tp, "%x", words[i]); } /* Was it a trailing run of 0x00's? */ if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) @@ -1607,7 +1587,7 @@ rb_inet_pton(int af, const char *src, void *dst) if(inet_pton4(src, dst)) { char tmp[HOSTIPLEN]; - rb_sprintf(tmp, "::ffff:%s", src); + sprintf(tmp, "::ffff:%s", src); return (inet_pton6(tmp, dst)); } else diff --git a/libratbox/src/epoll.c b/libratbox/src/epoll.c index 4f6b13e3..b45b61b1 100644 --- a/libratbox/src/epoll.c +++ b/libratbox/src/epoll.c @@ -485,7 +485,7 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when) close(fd); return 0; } - rb_snprintf(buf, sizeof(buf), "timerfd: %s", event->name); + snprintf(buf, sizeof(buf), "timerfd: %s", event->name); F = rb_open(fd, RB_FD_UNKNOWN, buf); rb_set_nb(F); event->comm_ptr = F; diff --git a/libratbox/src/event.c b/libratbox/src/event.c index 1ee74672..c9733718 100644 --- a/libratbox/src/event.c +++ b/libratbox/src/event.c @@ -293,7 +293,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr) struct ev_entry *ev; len = sizeof(buf); - rb_snprintf(buf, len, "Last event to run: %s", last_event_ran); + snprintf(buf, len, "Last event to run: %s", last_event_ran); func(buf, ptr); rb_strlcpy(buf, "Operation Next Execution", len); @@ -302,7 +302,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr) RB_DLINK_FOREACH(dptr, event_list.head) { ev = dptr->data; - rb_snprintf(buf, len, "%-28s %-4ld seconds", ev->name, + snprintf(buf, len, "%-28s %-4ld seconds", ev->name, ev->when - (long)rb_current_time()); func(buf, ptr); } diff --git a/libratbox/src/export-syms.txt b/libratbox/src/export-syms.txt index 2450b051..1999eac8 100644 --- a/libratbox/src/export-syms.txt +++ b/libratbox/src/export-syms.txt @@ -124,14 +124,7 @@ rb_rawbuf_flush rb_rawbuf_get rb_rawbuf_length rb_outofmemory -rb_snprintf rb_snprintf_append -rb_sprintf -rb_sprintf_append -rb_vsnprintf -rb_vsnprintf_append -rb_vsprintf -rb_vsprintf_append rb_free_rb_dlink_node rb_init_rb_dlink_nodes rb_make_rb_dlink_node diff --git a/libratbox/src/gnutls.c b/libratbox/src/gnutls.c index 9f274b58..b5096084 100644 --- a/libratbox/src/gnutls.c +++ b/libratbox/src/gnutls.c @@ -664,7 +664,7 @@ rb_supports_ssl(void) void rb_get_ssl_info(char *buf, size_t len) { - rb_snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)", + snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)", LIBGNUTLS_VERSION, gnutls_check_version(NULL)); } @@ -673,7 +673,7 @@ rb_ssl_get_cipher(rb_fde_t *F) { static char buf[1024]; - rb_snprintf(buf, sizeof(buf), "%s-%s-%s-%s", + snprintf(buf, sizeof(buf), "%s-%s-%s-%s", gnutls_protocol_get_name(gnutls_protocol_get_version(SSL_P(F))), gnutls_kx_get_name(gnutls_kx_get(SSL_P(F))), gnutls_cipher_get_name(gnutls_cipher_get(SSL_P(F))), diff --git a/libratbox/src/helper.c b/libratbox/src/helper.c index 5e9c98c4..62fe55a4 100644 --- a/libratbox/src/helper.c +++ b/libratbox/src/helper.c @@ -119,21 +119,21 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb, helper = rb_malloc(sizeof(rb_helper)); - rb_snprintf(buf, sizeof(buf), "%s helper - read", name); + snprintf(buf, sizeof(buf), "%s helper - read", name); if(rb_pipe(&in_f[0], &in_f[1], buf) < 0) { rb_free(helper); return NULL; } - rb_snprintf(buf, sizeof(buf), "%s helper - write", name); + snprintf(buf, sizeof(buf), "%s helper - write", name); if(rb_pipe(&out_f[0], &out_f[1], buf) < 0) { rb_free(helper); return NULL; } - rb_snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1])); - rb_snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0])); + snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1])); + snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0])); rb_set_nb(in_f[0]); rb_set_nb(in_f[1]); @@ -144,7 +144,7 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb, rb_setenv("OFD", fx, 1); rb_setenv("MAXFD", "256", 1); - rb_snprintf(buf, sizeof(buf), "-ircd %s daemon", name); + snprintf(buf, sizeof(buf), "-ircd %s daemon", name); parv[0] = buf; parv[1] = NULL; diff --git a/libratbox/src/linebuf.c b/libratbox/src/linebuf.c index ca3440ba..239644a3 100644 --- a/libratbox/src/linebuf.c +++ b/libratbox/src/linebuf.c @@ -526,13 +526,13 @@ rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args, if(prefixfmt != NULL) { va_start(prefix_args, prefixfmt); - len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args); + len = vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args); va_end(prefix_args); } if(va_args != NULL) { - len += rb_vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args); + len += vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args); } bufline->terminated = 1; @@ -644,7 +644,7 @@ rb_linebuf_put(buf_head_t * bufhead, const char *format, ...) if(rb_unlikely(format != NULL)) { va_start(args, format); - len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args); + len = vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args); va_end(args); } diff --git a/libratbox/src/mbedtls.c b/libratbox/src/mbedtls.c index 6feab1bd..2d928195 100644 --- a/libratbox/src/mbedtls.c +++ b/libratbox/src/mbedtls.c @@ -593,7 +593,7 @@ rb_get_ssl_info(char *buf, size_t len) char version_str[512]; mbedtls_version_get_string(version_str); - rb_snprintf(buf, len, "MBEDTLS: compiled (%s), library(%s)", + snprintf(buf, len, "MBEDTLS: compiled (%s), library(%s)", MBEDTLS_VERSION_STRING, version_str); } diff --git a/libratbox/src/nossl.c b/libratbox/src/nossl.c index 6164bbe7..fd6e085b 100644 --- a/libratbox/src/nossl.c +++ b/libratbox/src/nossl.c @@ -165,7 +165,7 @@ rb_ssl_clear_handshake_count(rb_fde_t *F) void rb_get_ssl_info(char *buf, size_t len) { - rb_snprintf(buf, len, "Not compiled with SSL support"); + snprintf(buf, len, "Not compiled with SSL support"); } int diff --git a/libratbox/src/openssl.c b/libratbox/src/openssl.c index ab3e3400..48ae2f8c 100644 --- a/libratbox/src/openssl.c +++ b/libratbox/src/openssl.c @@ -746,7 +746,7 @@ rb_supports_ssl(void) void rb_get_ssl_info(char *buf, size_t len) { - rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx", + snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx", SSLeay_version(SSLEAY_VERSION), (long)OPENSSL_VERSION_NUMBER, SSLeay()); } diff --git a/libratbox/src/patricia.c b/libratbox/src/patricia.c index cf0dd31e..3b577020 100644 --- a/libratbox/src/patricia.c +++ b/libratbox/src/patricia.c @@ -78,7 +78,7 @@ prefix_toa2x(rb_prefix_t *prefix, char *buf, int buf_len, int with_len) inet_ntop(prefix->family, &prefix->add.sin, buf, buf_len); if(with_len) { - rb_snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen); + snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen); strcat(buf, tmp); } return (buf); diff --git a/libratbox/src/ratbox_lib.c b/libratbox/src/ratbox_lib.c index 2a8af723..099107e2 100644 --- a/libratbox/src/ratbox_lib.c +++ b/libratbox/src/ratbox_lib.c @@ -87,7 +87,7 @@ rb_ctime(const time_t t, char *buf, size_t len) return (p); } - rb_snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d", + snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d", s_weekdays[tp->tm_wday], s_month[tp->tm_mon], tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900); return (p); @@ -112,7 +112,7 @@ rb_date(const time_t t, char *buf, size_t len) return (buf); } - rb_snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00", + snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00", weekdays[gm->tm_wday], months[gm->tm_mon], gm->tm_mday, gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec); return (buf); @@ -137,7 +137,7 @@ rb_lib_log(const char *format, ...) if(rb_log == NULL) return; va_start(args, format); - rb_vsnprintf(errbuf, sizeof(errbuf), format, args); + vsnprintf(errbuf, sizeof(errbuf), format, args); va_end(args); rb_log(errbuf); } @@ -149,7 +149,7 @@ rb_lib_die(const char *format, ...) if(rb_die == NULL) abort(); va_start(args, format); - rb_vsnprintf(errbuf, sizeof(errbuf), format, args); + vsnprintf(errbuf, sizeof(errbuf), format, args); va_end(args); rb_die(errbuf); } @@ -161,7 +161,7 @@ rb_lib_restart(const char *format, ...) if(rb_restart == NULL) abort(); va_start(args, format); - rb_vsnprintf(errbuf, sizeof(errbuf), format, args); + vsnprintf(errbuf, sizeof(errbuf), format, args); va_end(args); rb_restart(errbuf); abort(); @@ -192,7 +192,7 @@ rb_lib_version(void) static char version_info[512]; char ssl_info[512]; rb_get_ssl_info(ssl_info, sizeof(ssl_info)); - rb_snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info); + snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info); return version_info; } diff --git a/libratbox/src/snprintf.c b/libratbox/src/snprintf.c deleted file mode 100644 index 9c7a9db7..00000000 --- a/libratbox/src/snprintf.c +++ /dev/null @@ -1,721 +0,0 @@ - -/* - * Modified and hacked into libratbox by Aaron Sethman - * The original headers are below.. - * Note that this implementation does not process floating point numbers so - * you will likely need to fall back to using sprintf yourself to do those... - * $Id: snprintf.c 26092 2008-09-19 15:13:52Z androsyn $ - */ - -/* - * linux/lib/vsprintf.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ -/* - * Wirzenius wrote this portably, Torvalds fucked it up :-) - */ - -/* - * Fri Jul 13 2001 Crutcher Dunnavant - * - changed to provide snprintf and vsnprintf functions - * So Feb 1 16:51:32 CET 2004 Juergen Quade - * - scnprintf and vscnprintf - */ -#include -#include - -static int -skip_atoi(const char **s) -{ - int i = 0; - - while(isdigit((unsigned char)**s)) - i = i * 10 + *((*s)++) - '0'; - return i; -} - -/* Decimal conversion is by far the most typical, and is used - * for /proc and /sys data. This directly impacts e.g. top performance - * with many processes running. We optimize it for speed - * using code from - * http://www.cs.uiowa.edu/~jones/bcd/decimal.html - * (with permission from the author, Douglas W. Jones). */ - -/* Formats correctly any integer in [0,99999]. - * Outputs from one to five digits depending on input. - * On i386 gcc 4.1.2 -O2: ~250 bytes of code. */ -static char * -put_dec_trunc(char *buf, unsigned q) -{ - unsigned d3, d2, d1, d0; - d1 = (q >> 4) & 0xf; - d2 = (q >> 8) & 0xf; - d3 = (q >> 12); - - d0 = 6 * (d3 + d2 + d1) + (q & 0xf); - q = (d0 * 0xcd) >> 11; - d0 = d0 - 10 * q; - *buf++ = d0 + '0'; /* least significant digit */ - d1 = q + 9 * d3 + 5 * d2 + d1; - if(d1 != 0) - { - q = (d1 * 0xcd) >> 11; - d1 = d1 - 10 * q; - *buf++ = d1 + '0'; /* next digit */ - - d2 = q + 2 * d2; - if((d2 != 0) || (d3 != 0)) - { - q = (d2 * 0xd) >> 7; - d2 = d2 - 10 * q; - *buf++ = d2 + '0'; /* next digit */ - - d3 = q + 4 * d3; - if(d3 != 0) - { - q = (d3 * 0xcd) >> 11; - d3 = d3 - 10 * q; - *buf++ = d3 + '0'; /* next digit */ - if(q != 0) - *buf++ = q + '0'; /* most sign. digit */ - } - } - } - return buf; -} - -/* Same with if's removed. Always emits five digits */ -static char * -put_dec_full(char *buf, unsigned q) -{ - /* BTW, if q is in [0,9999], 8-bit ints will be enough, */ - /* but anyway, gcc produces better code with full-sized ints */ - unsigned d3, d2, d1, d0; - d1 = (q >> 4) & 0xf; - d2 = (q >> 8) & 0xf; - d3 = (q >> 12); - - /* Possible ways to approx. divide by 10 */ - /* gcc -O2 replaces multiply with shifts and adds */ - // (x * 0xcd) >> 11: 11001101 - shorter code than * 0x67 (on i386) - // (x * 0x67) >> 10: 1100111 - // (x * 0x34) >> 9: 110100 - same - // (x * 0x1a) >> 8: 11010 - same - // (x * 0x0d) >> 7: 1101 - same, shortest code (on i386) - - d0 = 6 * (d3 + d2 + d1) + (q & 0xf); - q = (d0 * 0xcd) >> 11; - d0 = d0 - 10 * q; - *buf++ = d0 + '0'; - d1 = q + 9 * d3 + 5 * d2 + d1; - q = (d1 * 0xcd) >> 11; - d1 = d1 - 10 * q; - *buf++ = d1 + '0'; - - d2 = q + 2 * d2; - q = (d2 * 0xd) >> 7; - d2 = d2 - 10 * q; - *buf++ = d2 + '0'; - - d3 = q + 4 * d3; - q = (d3 * 0xcd) >> 11; /* - shorter code */ - /* q = (d3 * 0x67) >> 10; - would also work */ - d3 = d3 - 10 * q; - *buf++ = d3 + '0'; - *buf++ = q + '0'; - return buf; -} - -static char * -put_dec(char *buf, unsigned long long int num) -{ - while(1) - { - unsigned rem; - if(num < 100000) - return put_dec_trunc(buf, num); - rem = num % 100000; - num = num / 100000; - buf = put_dec_full(buf, rem); - } -} - -#define ZEROPAD 1 /* pad with zero */ -#define SIGN 2 /* unsigned/signed long */ -#define PLUS 4 /* show plus */ -#define SPACE 8 /* space if plus */ -#define LEFT 16 /* left justified */ -#define SPECIAL 32 /* 0x */ -#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ - -static size_t -number(char *const buf, const size_t size, size_t idx, unsigned long long int num, int base, int field_width, int precision, - int type) -{ - char sign, tmp[66]; - const char *digits; - /* we are called with base 8, 10 or 16, only, thus don't need "g..." */ - static const char small_digits[] = "0123456789abcdefx"; /* "ghijklmnopqrstuvwxyz"; */ - static const char large_digits[] = "0123456789ABCDEFX"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ - int need_pfx = ((type & SPECIAL) && base != 10); - int i; - - digits = (type & LARGE) ? large_digits : small_digits; - if(type & LEFT) - type &= ~ZEROPAD; - if(base < 2 || base > 36) - return idx; - sign = 0; - if(type & SIGN) - { - if((signed long long int)num < 0) - { - sign = '-'; - num = -(signed long long int)num; - field_width--; - } - else if(type & PLUS) - { - sign = '+'; - field_width--; - } - else if(type & SPACE) - { - sign = ' '; - field_width--; - } - } - if(need_pfx) - { - field_width--; - if(base == 16) - field_width--; - } - - /* generate full string in tmp[], in reverse order */ - i = 0; - if(num == 0) - tmp[i++] = '0'; - /* Generic code, for any base: - else do { - tmp[i++] = digits[do_div(num,base)]; - } while (num != 0); - */ - else if(base != 10) - { /* 8 or 16 */ - int mask = base - 1; - int shift = 3; - if(base == 16) - shift = 4; - do - { - tmp[i++] = digits[((unsigned char)num) & mask]; - num >>= shift; - } - while(num); - } - else - { /* base 10 */ - i = put_dec(tmp, num) - tmp; - } - - /* printing 100 using %2d gives "100", not "00" */ - if(i > precision) - precision = i; - /* leading space padding */ - field_width -= precision; - if(!(type & (ZEROPAD + LEFT))) - { - while(--field_width >= 0) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - } - /* sign */ - if(sign) - { - if(idx < size) - buf[idx] = sign; - ++idx; - } - /* "0x" / "0" prefix */ - if(need_pfx) - { - if(idx < size) - buf[idx] = '0'; - ++idx; - if(base == 16) - { - if(idx < size) - buf[idx] = digits[16]; /* for arbitrary base: digits[33]; */ - ++idx; - } - } - /* zero or space padding */ - if(!(type & LEFT)) - { - char c = (type & ZEROPAD) ? '0' : ' '; - while(--field_width >= 0) - { - if(idx < size) - buf[idx] = c; - ++idx; - } - } - /* hmm even more zero padding? */ - while(i <= --precision) - { - if(idx < size) - buf[idx] = '0'; - ++idx; - } - /* actual digits of result */ - while(--i >= 0) - { - if(idx < size) - buf[idx] = tmp[i]; - ++idx; - } - /* trailing space padding */ - while(--field_width >= 0) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - return idx; -} - -/** - * vsnprintf - Format a string and place it in a buffer - * @buf: The buffer to place the result into - * @size: The size of the buffer, including the trailing null space - * @fmt: The format string to use - * @args: Arguments for the format string - * - * The return value is the number of characters which would - * be generated for the given input, excluding the trailing - * '\0', as per ISO C99. If you want to have the exact - * number of characters written into @buf as return value - * (not including the trailing '\0'), use vscnprintf(). If the - * return is greater than or equal to @size, the resulting - * string is truncated. - * - * Call this function if you are already dealing with a va_list. - * You probably want snprintf() instead. - */ -int -rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) -{ - int len; - unsigned long long int num; - int i, base; - char c; - size_t idx; - const char *s; - - int flags; /* flags to number() */ - - int field_width; /* width of output field */ - int precision; /* min. # of digits for integers; max - number of chars for from string */ - int qualifier; /* 'h', 'l', or 'L' for integer fields */ - /* 'z' support added 23/7/1999 S.H. */ - /* 'z' changed to 'Z' --davidm 1/25/99 */ - /* 't' added for ptrdiff_t */ - - /* Reject out-of-range values early. Large positive sizes are - used for unknown buffer sizes. */ - if(rb_unlikely(size > INT_MAX)) - { - return 0; - } - - idx = 0; - - for(; *fmt; ++fmt) - { - if(*fmt != '%') - { - if(idx < size) - buf[idx] = *fmt; - ++idx; - continue; - } - - /* process flags */ - flags = 0; - repeat: - ++fmt; /* this also skips first '%' */ - switch (*fmt) - { - case '-': - flags |= LEFT; - goto repeat; - case '+': - flags |= PLUS; - goto repeat; - case ' ': - flags |= SPACE; - goto repeat; - case '#': - flags |= SPECIAL; - goto repeat; - case '0': - flags |= ZEROPAD; - goto repeat; - } - - /* get field width */ - field_width = -1; - if(isdigit((unsigned char)*fmt)) - field_width = skip_atoi(&fmt); - else if(*fmt == '*') - { - ++fmt; - /* it's the next argument */ - field_width = va_arg(args, int); - if(field_width < 0) - { - field_width = -field_width; - flags |= LEFT; - } - } - - /* get the precision */ - precision = -1; - if(*fmt == '.') - { - ++fmt; - if(isdigit((unsigned char)*fmt)) - precision = skip_atoi(&fmt); - else if(*fmt == '*') - { - ++fmt; - /* it's the next argument */ - precision = va_arg(args, int); - } - if(precision < 0) - precision = 0; - } - - /* get the conversion qualifier */ - qualifier = -1; - if(*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || - *fmt == 'Z' || *fmt == 'z' || *fmt == 't') - { - qualifier = *fmt; - ++fmt; - if(qualifier == 'l' && *fmt == 'l') - { - qualifier = 'L'; - ++fmt; - } - } - - /* default base */ - base = 10; - - switch (*fmt) - { - case 'c': - if(!(flags & LEFT)) - { - while(--field_width > 0) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - } - c = (unsigned char)va_arg(args, int); - if(idx < size) - buf[idx] = c; - ++idx; - while(--field_width > 0) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - continue; - - case 's': - s = va_arg(args, char *); - if(s == NULL) - { - s = "(null)"; - } - len = rb_strnlen(s, precision); - - if(!(flags & LEFT)) - { - while(len < field_width--) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - } - for(i = 0; i < len; ++i) - { - if(idx < size) - buf[idx] = *s; - ++idx; - ++s; - } - while(len < field_width--) - { - if(idx < size) - buf[idx] = ' '; - ++idx; - } - continue; - - case 'p': - if(field_width == -1) - { - field_width = 2 * sizeof(void *); - flags |= ZEROPAD; - } - idx = number(buf, size, idx, - (unsigned long)va_arg(args, void *), - 16, field_width, precision, flags); - continue; - - - case 'n': - /* FIXME: - * What does C99 say about the overflow case here? */ - if(qualifier == 'l') - { - long *ip = va_arg(args, long *); - *ip = idx; - } - else if(qualifier == 'Z' || qualifier == 'z') - { - size_t *ip = va_arg(args, size_t *); - *ip = idx; - } - else - { - int *ip = va_arg(args, int *); - *ip = idx; - } - continue; - - case '%': - if(idx < size) - buf[idx] = '%'; - ++idx; - continue; - - /* integer number formats - set up the flags and "break" */ - case 'o': - base = 8; - break; - - case 'X': - flags |= LARGE; - case 'x': - base = 16; - break; - - case 'd': - case 'i': - flags |= SIGN; - case 'u': - break; - - default: - if(idx < size) - buf[idx] = '%'; - ++idx; - if(*fmt) - { - if(idx < size) - buf[idx] = *fmt; - ++idx; - } - else - { - --fmt; - } - continue; - } - if(qualifier == 'L') - num = va_arg(args, long long int); - else if(qualifier == 'l') - { - num = va_arg(args, unsigned long); - if(flags & SIGN) - num = (signed long)num; - } - else if(qualifier == 'Z' || qualifier == 'z') - { - num = va_arg(args, size_t); - } - else if(qualifier == 't') - { - num = va_arg(args, ptrdiff_t); - } - else if(qualifier == 'h') - { - num = (unsigned short)va_arg(args, int); - if(flags & SIGN) - num = (signed short)num; - } - else - { - num = va_arg(args, unsigned int); - if(flags & SIGN) - num = (signed int)num; - } - idx = number(buf, size, idx, num, base, field_width, precision, flags); - } - if(size > 0) - { - if(idx < size) - buf[idx] = '\0'; - else - buf[size - 1] = '\0'; - } - /* the trailing null byte doesn't count towards the total */ - return idx; -} - -/** - * snprintf - Format a string and place it in a buffer - * @buf: The buffer to place the result into - * @size: The size of the buffer, including the trailing null space - * @fmt: The format string to use - * @...: Arguments for the format string - * - * The return value is the number of characters which would be - * generated for the given input, excluding the trailing null, - * as per ISO C99. If the return is greater than or equal to - * @size, the resulting string is truncated. - */ -int -rb_snprintf(char *buf, size_t size, const char *fmt, ...) -{ - va_list args; - int i; - - va_start(args, fmt); - i = rb_vsnprintf(buf, size, fmt, args); - va_end(args); - return i; -} - -/** - * vsprintf - Format a string and place it in a buffer - * @buf: The buffer to place the result into - * @fmt: The format string to use - * @args: Arguments for the format string - * - * The function returns the number of characters written - * into @buf. Use vsnprintf() or vscnprintf() in order to avoid - * buffer overflows. - * - * Call this function if you are already dealing with a va_list. - * You probably want sprintf() instead. - */ -int -rb_vsprintf(char *buf, const char *fmt, va_list args) -{ - return rb_vsnprintf(buf, INT_MAX, fmt, args); -} - -/** - * sprintf - Format a string and place it in a buffer - * @buf: The buffer to place the result into - * @fmt: The format string to use - * @...: Arguments for the format string - * - * The function returns the number of characters written - * into @buf. Use snprintf() or scnprintf() in order to avoid - * buffer overflows. - */ -int -rb_sprintf(char *buf, const char *fmt, ...) -{ - va_list args; - int i; - - va_start(args, fmt); - i = rb_vsnprintf(buf, INT_MAX, fmt, args); - va_end(args); - return i; -} - -/* - * rb_vsprintf_append() - * appends sprintf formatted string to the end of the buffer - */ - -int -rb_vsprintf_append(char *str, const char *format, va_list ap) -{ - size_t x = strlen(str); - return (rb_vsprintf(str + x, format, ap) + x); -} - -/* - * rb_sprintf_append() - * appends sprintf formatted string to the end of the buffer - */ -int -rb_sprintf_append(char *str, const char *format, ...) -{ - int x; - va_list ap; - va_start(ap, format); - x = rb_vsprintf_append(str, format, ap); - va_end(ap); - return (x); -} - -/* - * rb_vsnprintf_append() - * appends sprintf formatted string to the end of the buffer but not - * exceeding len - */ - -int -rb_vsnprintf_append(char *str, size_t len, const char *format, va_list ap) -{ - size_t x; - if(len == 0) - return 0; - x = strlen(str); - - if(len < x) - { - str[len - 1] = '\0'; - return len - 1; - } - return (rb_vsnprintf(str + x, len - x, format, ap) + x); -} - -/* - * rb_snprintf_append() - * appends snprintf formatted string to the end of the buffer but not - * exceeding len - */ - -int -rb_snprintf_append(char *str, size_t len, const char *format, ...) -{ - int x; - va_list ap; - va_start(ap, format); - x = rb_vsnprintf_append(str, len, format, ap); - va_end(ap); - return (x); -} diff --git a/libratbox/src/tools.c b/libratbox/src/tools.c index 99ef9128..71f5e9c9 100644 --- a/libratbox/src/tools.c +++ b/libratbox/src/tools.c @@ -202,6 +202,35 @@ rb_strnlen(const char *s, size_t count) } #endif +/* + * rb_snprintf_append() + * appends snprintf formatted string to the end of the buffer but not + * exceeding len + */ +int +rb_snprintf_append(char *str, size_t len, const char *format, ...) +{ + int x; + + if(len == 0) + return 0; + + x = strlen(str); + + if(len < x) + { + str[len - 1] = '\0'; + return (int)len - 1; + } + + va_list ap; + va_start(ap, format); + x = (vsnprintf(str + x, len - x, format, ap) + (int)x); + va_end(ap); + + return (x); +} + /* rb_basename * * input - diff --git a/libratbox/src/win32.c b/libratbox/src/win32.c index 8b7f7116..287016bd 100644 --- a/libratbox/src/win32.c +++ b/libratbox/src/win32.c @@ -145,7 +145,7 @@ rb_setenv(const char *name, const char *value, int overwrite) return -1; len = strlen(name) + strlen(value) + 5; buf = rb_malloc(len); - rb_snprintf(buf, len, "%s=%s", name, value); + snprintf(buf, len, "%s=%s", name, value); len = putenv(buf); rb_free(buf); return (len); diff --git a/modules/Makefile.in b/modules/Makefile.in index 321d840c..af79a3bb 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -756,9 +756,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu modules/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu modules/Makefile + $(AUTOMAKE) --foreign modules/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/modules/core/m_error.c b/modules/core/m_error.c index df19a14b..9699db9d 100644 --- a/modules/core/m_error.c +++ b/modules/core/m_error.c @@ -58,7 +58,7 @@ is_safe_error(const char *message) if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25)) return 1; - rb_snprintf(prefix2, sizeof prefix2, + snprintf(prefix2, sizeof prefix2, "Closing Link: 127.0.0.1 %s (", me.name); if (!strncmp(message, prefix2, strlen(prefix2))) return 1; diff --git a/modules/core/m_join.c b/modules/core/m_join.c index a19e2335..9dcd3964 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -769,7 +769,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char else modes = empty_modes; - mlen_uid = rb_sprintf(buf_uid, ":%s SJOIN %ld %s %s :", + mlen_uid = sprintf(buf_uid, ":%s SJOIN %ld %s %s :", use_id(source_p), (long) chptr->channelts, parv[2], modes); ptr_uid = buf_uid + mlen_uid; @@ -838,7 +838,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char } /* copy the nick to the two buffers */ - len = rb_sprintf(ptr_uid, "%s ", use_id(target_p)); + len = sprintf(ptr_uid, "%s ", use_id(target_p)); ptr_uid += len; len_uid += len; @@ -1109,7 +1109,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_DEL; } *mbuf++ = 'k'; - len = rb_sprintf(pbuf, "%s ", oldmode->key); + len = sprintf(pbuf, "%s ", oldmode->key); pbuf += len; } if(oldmode->join_num && !mode->join_num) @@ -1138,7 +1138,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'l'; - len = rb_sprintf(pbuf, "%d ", mode->limit); + len = sprintf(pbuf, "%d ", mode->limit); pbuf += len; } if(mode->key[0] && strcmp(oldmode->key, mode->key)) @@ -1149,7 +1149,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'k'; - len = rb_sprintf(pbuf, "%s ", mode->key); + len = sprintf(pbuf, "%s ", mode->key); pbuf += len; } if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time)) @@ -1160,7 +1160,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'j'; - len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); + len = sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); pbuf += len; } if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && @@ -1172,7 +1172,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'f'; - len = rb_sprintf(pbuf, "%s ", mode->forward); + len = sprintf(pbuf, "%s ", mode->forward); pbuf += len; } *mbuf = '\0'; @@ -1297,7 +1297,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p, pbuf = lparabuf; - cur_len = mlen = rb_sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname); + cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname); mbuf = lmodebuf + mlen; RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) @@ -1325,9 +1325,9 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p, *mbuf++ = c; cur_len += plen; if (banptr->forward) - pbuf += rb_sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward); + pbuf += sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward); else - pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr); + pbuf += sprintf(pbuf, "%s ", banptr->banstr); count++; free_ban(banptr); diff --git a/modules/core/m_kill.c b/modules/core/m_kill.c index c6447445..c673f37e 100644 --- a/modules/core/m_kill.c +++ b/modules/core/m_kill.c @@ -165,7 +165,7 @@ mo_kill(struct Client *client_p, struct Client *source_p, int parc, const char * target_p->flags |= FLAGS_KILLED; } - rb_sprintf(buf, "Killed (%s (%s))", source_p->name, reason); + sprintf(buf, "Killed (%s (%s))", source_p->name, reason); exit_client(client_p, target_p, source_p, buf); @@ -284,7 +284,7 @@ ms_kill(struct Client *client_p, struct Client *source_p, int parc, const char * /* FLAGS_KILLED prevents a quit being sent out */ target_p->flags |= FLAGS_KILLED; - rb_sprintf(buf, "Killed (%s %s)", source_p->name, reason); + sprintf(buf, "Killed (%s %s)", source_p->name, reason); exit_client(client_p, target_p, source_p, buf); @@ -300,11 +300,11 @@ relay_kill(struct Client *one, struct Client *source_p, char buffer[BUFSIZE]; if(MyClient(source_p)) - rb_snprintf(buffer, sizeof(buffer), + snprintf(buffer, sizeof(buffer), "%s!%s!%s!%s (%s)", me.name, source_p->host, source_p->username, source_p->name, reason); else - rb_snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason); + snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason); RB_DLINK_FOREACH(ptr, serv_list.head) { diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index 99f180de..458de564 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -341,7 +341,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char fakesource_p = &me; else fakesource_p = source_p; - mlen = rb_sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname); + mlen = sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname); mbuf = modebuf + mlen; pbuf = parabuf; @@ -401,7 +401,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char forward[-1] = '$'; *mbuf++ = parv[3][0]; - arglen = rb_sprintf(pbuf, "%s ", s); + arglen = sprintf(pbuf, "%s ", s); pbuf += arglen; plen += arglen; modecount++; @@ -433,4 +433,3 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char source_p->id, (long) chptr->channelts, chptr->chname, parv[3], parv[4]); return 0; } - diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index ab358a15..93d19d81 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -332,7 +332,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p "with %d arguments (expecting 10)", client_p->name, parc); ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.", parc, client_p->name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Excess parameters (%d) to %s command, expecting %d", parc, "UID", 10); exit_client(client_p, client_p, client_p, squitreason); @@ -348,7 +348,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p if(!clean_uid(parv[8], source_p->id)) { - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Invalid UID %s for nick %s on %s/%s", parv[8], parv[1], source_p->name, source_p->id); exit_client(client_p, client_p, client_p, squitreason); @@ -423,7 +423,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char * "with %d arguments (expecting 12)", client_p->name, parc); ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.", parc, client_p->name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Excess parameters (%d) to %s command, expecting %d", parc, "EUID", 12); exit_client(client_p, client_p, client_p, squitreason); @@ -439,7 +439,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char * if(!clean_uid(parv[8], source_p->id)) { - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Invalid UID %s for nick %s on %s/%s", parv[8], parv[1], source_p->name, source_p->id); exit_client(client_p, client_p, client_p, squitreason); @@ -612,7 +612,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick) strcpy(source_p->name, nick); add_to_client_hash(nick, source_p); - rb_snprintf(note, sizeof(note), "Nick: %s", nick); + snprintf(note, sizeof(note), "Nick: %s", nick); rb_note(client_p->localClient->F, note); if(source_p->flags & FLAGS_SENTUSER) @@ -717,7 +717,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p, rb_dlinkDestroy(ptr, &source_p->on_allow_list); } - rb_snprintf(note, sizeof(note), "Nick: %s", nick); + snprintf(note, sizeof(note), "Nick: %s", nick); rb_note(client_p->localClient->F, note); return; @@ -1211,7 +1211,7 @@ static void bad_nickname(struct Client *client_p, const char *nick) ilog(L_SERVER, "Link %s cancelled, bad nickname %s sent (NICKLEN mismatch?)", client_p->name, nick); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Bad nickname introduced [%s]", nick); exit_client(client_p, client_p, &me, squitreason); } diff --git a/modules/core/m_quit.c b/modules/core/m_quit.c index bc77f095..22e1ae4e 100644 --- a/modules/core/m_quit.c +++ b/modules/core/m_quit.c @@ -67,7 +67,7 @@ m_quit(struct Client *client_p, struct Client *source_p, int parc, const char *p if(ConfigFileEntry.client_exit && comment[0]) { - rb_snprintf(reason, sizeof(reason), "Quit: %s", comment); + snprintf(reason, sizeof(reason), "Quit: %s", comment); comment = reason; } diff --git a/modules/core/m_server.c b/modules/core/m_server.c index ef4fca8c..8a0abd5e 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -330,7 +330,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char ilog(L_SERVER, "Link %s cancelled, server %s already exists", client_p->name, name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Server %s already exists", name); exit_client(client_p, client_p, &me, squitreason); @@ -416,7 +416,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char ilog(L_SERVER, "Non-Hub link %s introduced %s.", client_p->name, name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "No matching hub_mask for %s", name); exit_client(NULL, client_p, &me, squitreason); @@ -433,7 +433,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char ilog(L_SERVER, "Link %s introduced leafed server %s.", client_p->name, name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Matching leaf_mask for %s", name); exit_client(NULL, client_p, &me, squitreason); @@ -508,7 +508,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p ilog(L_SERVER, "Link %s cancelled, server %s already exists", client_p->name, parv[1]); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Server %s already exists", parv[1]); exit_client(NULL, client_p, &me, squitreason); @@ -527,7 +527,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p ilog(L_SERVER, "Link %s cancelled, SID %s for server %s already in use by %s", client_p->name, parv[3], parv[1], target_p->name); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "SID %s for %s already in use by %s", parv[3], parv[1], target_p->name); exit_client(NULL, client_p, &me, squitreason); @@ -587,7 +587,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p ilog(L_SERVER, "Non-Hub link %s introduced %s.", client_p->name, parv[1]); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "No matching hub_mask for %s", parv[1]); exit_client(NULL, client_p, &me, squitreason); @@ -603,7 +603,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p ilog(L_SERVER, "Link %s introduced leafed server %s.", client_p->name, parv[1]); - rb_snprintf(squitreason, sizeof squitreason, + snprintf(squitreason, sizeof squitreason, "Matching leaf_mask for %s", parv[1]); exit_client(NULL, client_p, &me, squitreason); diff --git a/modules/m_accept.c b/modules/m_accept.c index afe96233..a0a47fd1 100644 --- a/modules/m_accept.c +++ b/modules/m_accept.c @@ -245,7 +245,7 @@ list_accepts(struct Client *source_p) *nicks = '\0'; } - len += rb_snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name); + len += snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name); count++; } } diff --git a/modules/m_cap.c b/modules/m_cap.c index 2472d4cb..635f2405 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -187,7 +187,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea int curlen, mlen; size_t i; - mlen = rb_sprintf(buf, ":%s CAP %s %s", + mlen = sprintf(buf, ":%s CAP %s %s", me.name, EmptyString(source_p->name) ? "*" : source_p->name, subcmd); @@ -247,7 +247,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea buflen++; } - curlen = rb_sprintf(p, "%s ", clicap_list[i].name); + curlen = sprintf(p, "%s ", clicap_list[i].name); p += curlen; buflen += curlen; } @@ -357,7 +357,7 @@ cap_req(struct Client *source_p, const char *arg) if(EmptyString(arg)) return; - buflen = rb_snprintf(buf, sizeof(buf), ":%s CAP %s ACK", + buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK", me.name, EmptyString(source_p->name) ? "*" : source_p->name); pbuf[0][0] = '\0'; diff --git a/modules/m_encap.c b/modules/m_encap.c index 0b8e50b5..3cbfcccb 100644 --- a/modules/m_encap.c +++ b/modules/m_encap.c @@ -79,7 +79,7 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char if((size_t)(cur_len + len) >= sizeof(buffer)) return 0; - rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); + snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); cur_len += len; ptr += len; } @@ -88,9 +88,9 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char /* if its a command without parameters, dont prepend a ':' */ if(parc == 3) - rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]); + snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]); else - rb_snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]); + snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]); /* add a trailing \0 if it was too long */ if((cur_len + len) >= BUFSIZE) @@ -105,5 +105,3 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } - - diff --git a/modules/m_ison.c b/modules/m_ison.c index d918b7bf..5533545c 100644 --- a/modules/m_ison.c +++ b/modules/m_ison.c @@ -76,7 +76,7 @@ m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *p current_insert_point2 = buf2; *buf2 = '\0'; - rb_sprintf(buf, form_str(RPL_ISON), me.name, source_p->name); + sprintf(buf, form_str(RPL_ISON), me.name, source_p->name); len = strlen(buf); current_insert_point = buf + len; diff --git a/modules/m_map.c b/modules/m_map.c index 7d736c18..6d00c879 100644 --- a/modules/m_map.c +++ b/modules/m_map.c @@ -110,7 +110,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf) } frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total; - rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL, + snprintf(buf + USER_COL, BUFSIZE - USER_COL, " | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users), frac / 10, frac % 10); diff --git a/modules/m_monitor.c b/modules/m_monitor.c index 2c81d39c..61310fb1 100644 --- a/modules/m_monitor.c +++ b/modules/m_monitor.c @@ -104,9 +104,9 @@ add_monitor(struct Client *client_p, const char *nicks) sendto_one(client_p, "%s", offbuf); if(p) - rb_snprintf(buf, sizeof(buf), "%s,%s", name, p); + snprintf(buf, sizeof(buf), "%s,%s", name, p); else - rb_snprintf(buf, sizeof(buf), "%s", name); + snprintf(buf, sizeof(buf), "%s", name); sendto_one(client_p, form_str(ERR_MONLISTFULL), me.name, client_p->name, @@ -370,4 +370,3 @@ m_monitor(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } - diff --git a/modules/m_names.c b/modules/m_names.c index d9b97e53..315d5207 100644 --- a/modules/m_names.c +++ b/modules/m_names.c @@ -137,7 +137,7 @@ names_global(struct Client *source_p) chptr = ptr->data; channel_member_names(chptr, source_p, 0); } - cur_len = mlen = rb_sprintf(buf, form_str(RPL_NAMREPLY), + cur_len = mlen = sprintf(buf, form_str(RPL_NAMREPLY), me.name, source_p->name, "*", "*"); t = buf + mlen; @@ -180,7 +180,7 @@ names_global(struct Client *source_p) t = buf + mlen; } - tlen = rb_sprintf(t, "%s ", target_p->name); + tlen = sprintf(t, "%s ", target_p->name); cur_len += tlen; t += tlen; } diff --git a/modules/m_operspy.c b/modules/m_operspy.c index 0ea5a7f1..bb3ed328 100644 --- a/modules/m_operspy.c +++ b/modules/m_operspy.c @@ -87,7 +87,7 @@ ms_operspy(struct Client *client_p, struct Client *source_p, if((size_t)(cur_len + len) >= sizeof(buffer)) return 0; - rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", + snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); ptr += len; cur_len += len; @@ -98,4 +98,3 @@ ms_operspy(struct Client *client_p, struct Client *source_p, return 0; } - diff --git a/modules/m_restart.c b/modules/m_restart.c index a8ca8b08..8e2459e1 100644 --- a/modules/m_restart.c +++ b/modules/m_restart.c @@ -137,7 +137,7 @@ do_restart(struct Client *source_p, const char *servername) me.name, get_client_name(source_p, HIDE_IP)); } - rb_sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP)); + sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP)); restart(buf); return 0; diff --git a/modules/m_scan.c b/modules/m_scan.c index 35050dbf..71f3b610 100644 --- a/modules/m_scan.c +++ b/modules/m_scan.c @@ -240,7 +240,7 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc, if (mask != NULL) { - rb_snprintf(maskbuf, BUFSIZE, "%s!%s@%s", + snprintf(maskbuf, BUFSIZE, "%s!%s@%s", target_p->name, target_p->username, target_p->host); if (!match(mask, maskbuf)) diff --git a/modules/m_services.c b/modules/m_services.c index ea619b38..47e76ce5 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -217,7 +217,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p, parv[2]); } - rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", + snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", me.name); exit_client(NULL, exist_p, &me, buf); } @@ -256,7 +256,7 @@ doit: del_all_accepts(target_p); - rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); + snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); rb_note(target_p->localClient->F, note); return 0; } diff --git a/modules/m_signon.c b/modules/m_signon.c index f7fb8eb9..f2d25aeb 100644 --- a/modules/m_signon.c +++ b/modules/m_signon.c @@ -192,7 +192,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p, "Nick collision due to SVSLOGIN on %s", nick); - rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", + snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", me.name); exit_client(NULL, exist_p, &me, buf); }else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) { @@ -236,7 +236,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p, send_signon(NULL, target_p, nick, user, host, rb_current_time(), login); - rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); + snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); rb_note(target_p->localClient->F, note); } @@ -416,4 +416,3 @@ send_signon(struct Client *client_p, struct Client *target_p, change_nick_user_host(target_p, nick, user, host, newts, "Signing %s (%s)", *login ? "in" : "out", nick); } - diff --git a/modules/m_svinfo.c b/modules/m_svinfo.c index a8e2dffa..9fec29d8 100644 --- a/modules/m_svinfo.c +++ b/modules/m_svinfo.c @@ -71,7 +71,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char sendto_realops_snomask(SNO_GENERAL, L_ALL, "Link %s dropped, wrong TS protocol version (%s,%s)", source_p->name, parv[1], parv[2]); - rb_snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)", + snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)", parv[1], parv[2]); exit_client(source_p, source_p, source_p, squitreason); return 0; @@ -95,7 +95,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char "Link %s dropped, excessive TS delta" " (my TS=%ld, their TS=%ld, delta=%ld)", log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat); - rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%ld)", + snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%ld)", (long) rb_current_time(), (long) theirtime, deltat); disable_server_conf_autoconn(source_p->name); exit_client(source_p, source_p, source_p, squitreason); @@ -112,4 +112,3 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } - diff --git a/modules/m_testline.c b/modules/m_testline.c index c74edd63..ff916921 100644 --- a/modules/m_testline.c +++ b/modules/m_testline.c @@ -132,7 +132,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch if(aconf && aconf->status & CONF_DLINE) { get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); - rb_snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, + snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, operreason ? "|" : "", operreason ? operreason : ""); sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, @@ -184,9 +184,9 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch if(aconf->status & CONF_KILL) { get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); - rb_snprintf(buf, sizeof(buf), "%s@%s", + snprintf(buf, sizeof(buf), "%s@%s", puser, phost); - rb_snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, + snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, operreason ? "|" : "", operreason ? operreason : ""); sendto_one(source_p, form_str(RPL_TESTLINE), me.name, source_p->name, diff --git a/modules/m_time.c b/modules/m_time.c index 81031ddc..d1728a70 100644 --- a/modules/m_time.c +++ b/modules/m_time.c @@ -109,7 +109,7 @@ date(void) if(minswest < 0) minswest = -minswest; - rb_sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u", + sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u", weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday, lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec, plus, minswest / 60, minswest % 60); diff --git a/modules/m_topic.c b/modules/m_topic.c index d1728351..9b9123b0 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -127,7 +127,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char * char topic[TOPICLEN + 1]; char topic_info[USERHOST_REPLYLEN]; rb_strlcpy(topic, parv[2], sizeof(topic)); - rb_sprintf(topic_info, "%s!%s@%s", + sprintf(topic_info, "%s!%s@%s", source_p->name, source_p->username, source_p->host); if (ConfigChannel.strip_topic_colors) diff --git a/modules/m_user.c b/modules/m_user.c index 16fa9fc2..0760e7c5 100644 --- a/modules/m_user.c +++ b/modules/m_user.c @@ -75,7 +75,7 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char * if((p = strchr(parv[1], '@'))) *p = '\0'; - rb_snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]); + snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]); rb_free(source_p->localClient->fullcaps); source_p->localClient->fullcaps = rb_strdup(buf); diff --git a/modules/m_userhost.c b/modules/m_userhost.c index 108974e7..b1e58aea 100644 --- a/modules/m_userhost.c +++ b/modules/m_userhost.c @@ -63,7 +63,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha int cur_len; int rl; - cur_len = rb_sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, ""); + cur_len = sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, ""); t = buf + cur_len; for (i = 1; i <= 5; i++) @@ -81,7 +81,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha */ if(MyClient(target_p) && (target_p == source_p)) { - rl = rb_sprintf(response, "%s%s=%c%s@%s ", + rl = sprintf(response, "%s%s=%c%s@%s ", target_p->name, IsOper(target_p) ? "*" : "", (target_p->user->away) ? '-' : '+', @@ -90,7 +90,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha } else { - rl = rb_sprintf(response, "%s%s=%c%s@%s ", + rl = sprintf(response, "%s%s=%c%s@%s ", target_p->name, IsOper(target_p) ? "*" : "", (target_p->user->away) ? '-' : '+', @@ -99,7 +99,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha if((rl + cur_len) < (BUFSIZE - 10)) { - rb_sprintf(t, "%s", response); + sprintf(t, "%s", response); t += rl; cur_len += rl; } diff --git a/modules/m_who.c b/modules/m_who.c index 9a50d279..b387c430 100644 --- a/modules/m_who.c +++ b/modules/m_who.c @@ -468,7 +468,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...) max = *pos >= bufsize ? 0 : bufsize - *pos; va_start(ap, fmt); - result = rb_vsnprintf(buf + *pos, max, fmt, ap); + result = vsnprintf(buf + *pos, max, fmt, ap); va_end(ap); *pos += result; } @@ -492,7 +492,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt size_t pos; const char *q; - rb_sprintf(status, "%c%s%s", + sprintf(status, "%c%s%s", target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : ""); if (fmt->fields == 0) diff --git a/modules/m_whois.c b/modules/m_whois.c index aadb0e28..cb2ed0d5 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -199,7 +199,7 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char { char buffer[BUFSIZE]; - rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s %s", + snprintf(buffer, sizeof(buffer), "%s!%s@%s %s", target_p->name, target_p->username, target_p->host, target_p->servptr->name); report_operspy(source_p, "WHOIS", buffer); @@ -253,7 +253,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) target_p->name, target_p->username, target_p->host, target_p->info); - cur_len = mlen = rb_sprintf(buf, form_str(RPL_WHOISCHANNELS), + cur_len = mlen = sprintf(buf, form_str(RPL_WHOISCHANNELS), get_id(&me, source_p), get_id(source_p, source_p), target_p->name); @@ -296,7 +296,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) t = buf + mlen; } - tlen = rb_sprintf(t, "%s%s%s ", + tlen = sprintf(t, "%s%s%s ", hdata.approved ? "" : "!", find_channel_status(msptr, 1), chptr->chname); @@ -329,7 +329,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) if(MyClient(target_p) && !EmptyString(target_p->localClient->opername) && IsOper(source_p)) { char buf[512]; - rb_snprintf(buf, sizeof(buf), "is opered as %s, privset %s", + snprintf(buf, sizeof(buf), "is opered as %s, privset %s", target_p->localClient->opername, target_p->localClient->privset->name); sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL), target_p->name, buf); @@ -423,4 +423,3 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) return; } - diff --git a/ssld/Makefile.in b/ssld/Makefile.in index d7cf4a63..d760ece6 100644 --- a/ssld/Makefile.in +++ b/ssld/Makefile.in @@ -371,9 +371,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ssld/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ssld/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu ssld/Makefile + $(AUTOMAKE) --foreign ssld/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ diff --git a/ssld/ssld.c b/ssld/ssld.c index 532a8a4b..3583ba08 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -256,7 +256,7 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...) rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn); rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL); va_start(ap, fmt); - rb_vsnprintf(reason, sizeof(reason), fmt, ap); + vsnprintf(reason, sizeof(reason), fmt, ap); va_end(ap); buf[0] = 'D'; @@ -814,7 +814,7 @@ process_stats(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) if(conn == NULL) return; - rb_snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata, + snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata, conn->plain_out, conn->mod_in, conn->plain_in, conn->mod_out); conn->plain_out = 0; conn->plain_in = 0; diff --git a/tools/Makefile.in b/tools/Makefile.in index 207da77d..d0543f4c 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -371,9 +371,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu tools/Makefile + $(AUTOMAKE) --foreign tools/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \