Merge pull request #140 from viatsko/remove-snprintf

Remove libratbox's snprintf.c, update related ircd code
This commit is contained in:
William Pitcock 2016-02-09 21:58:07 -06:00
commit 5512416070
92 changed files with 327 additions and 1120 deletions

View file

@ -172,7 +172,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in \
$(top_srcdir)/libltdl/config/config.sub \ $(top_srcdir)/libltdl/config/config.sub \
$(top_srcdir)/libltdl/config/install-sh \ $(top_srcdir)/libltdl/config/install-sh \
$(top_srcdir)/libltdl/config/ltmain.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/ar-lib libltdl/config/compile \
libltdl/config/config.guess libltdl/config/config.sub \ libltdl/config/config.guess libltdl/config/config.sub \
libltdl/config/depcomp libltdl/config/install-sh \ libltdl/config/depcomp libltdl/config/install-sh \

View file

@ -372,9 +372,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu authd/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign authd/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu authd/Makefile $(AUTOMAKE) --foreign authd/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -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; const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr;
cp = (const unsigned char *)&v4->sin_addr.s_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])); (unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0]));
} }
#ifdef RB_IPV6 #ifdef RB_IPV6

View file

@ -384,9 +384,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bandb/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bandb/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu bandb/Makefile $(AUTOMAKE) --foreign bandb/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -161,11 +161,11 @@ list_bans(void)
for(j = 0; j < table.row_count; j++) for(j = 0; j < table.row_count; j++)
{ {
if(i == BANDB_KLINE) 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], bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]); table.row[j][1], table.row[j][2], table.row[j][3]);
else 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], bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]); table.row[j][2], table.row[j][3]);
@ -288,7 +288,7 @@ static void
db_error_cb(const char *errstr) db_error_cb(const char *errstr)
{ {
char buf[256]; char buf[256];
rb_snprintf(buf, sizeof(buf), "! :%s", errstr); snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, "%s", buf); rb_helper_write(bandb_helper, "%s", buf);
rb_sleep(2 << 30, 0); rb_sleep(2 << 30, 0);
exit(1); exit(1);

View file

@ -236,7 +236,7 @@ main(int argc, char *argv[])
/* checking for our files to import or export */ /* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++) 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]); etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO) if(flag.import && flag.pretend == NO)
@ -297,11 +297,11 @@ export_config(const char *conf, int id)
return; return;
if(strstr(conf, ".perm") != 0) 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", "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time",
bandb_table[id]); bandb_table[id]);
else 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", "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time",
bandb_table[id]); bandb_table[id]);
@ -330,7 +330,7 @@ export_config(const char *conf, int id)
{ {
case BANDB_DLINE: case BANDB_DLINE:
case BANDB_DLINE_PERM: case BANDB_DLINE_PERM:
rb_snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask1],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -340,7 +340,7 @@ export_config(const char *conf, int id)
case BANDB_XLINE: case BANDB_XLINE:
case BANDB_XLINE_PERM: case BANDB_XLINE_PERM:
rb_snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"\"%s\",\"0\",\"%s\",\"%s\",%s\n", "\"%s\",\"0\",\"%s\",\"%s\",%s\n",
escape_quotes(table.row[j][mask1]), escape_quotes(table.row[j][mask1]),
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -349,7 +349,7 @@ export_config(const char *conf, int id)
case BANDB_RESV: case BANDB_RESV:
case BANDB_RESV_PERM: case BANDB_RESV_PERM:
rb_snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask1],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -358,7 +358,7 @@ export_config(const char *conf, int id)
default: /* Klines */ default: /* Klines */
rb_snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask2], table.row[j][mask1], table.row[j][mask2],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -497,9 +497,9 @@ import_config(const char *conf, int id)
/* append operreason_field to reason_field */ /* append operreason_field to reason_field */
if(!EmptyString(f_oreason)) 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 else
rb_snprintf(newreason, sizeof(newreason), "%s", f_reason); snprintf(newreason, sizeof(newreason), "%s", f_reason);
if(flag.pretend == NO) if(flag.pretend == NO)
{ {
@ -859,7 +859,7 @@ bt_smalldate(const char *string)
lt = gmtime(&t); lt = gmtime(&t);
if(lt == NULL) if(lt == NULL)
return 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); lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min);
return buf; return buf;
} }

View file

@ -47,7 +47,7 @@ mlog(const char *errstr, ...)
char buf[256]; char buf[256];
va_list ap; va_list ap;
va_start(ap, errstr); va_start(ap, errstr);
rb_vsnprintf(buf, sizeof(buf), errstr, ap); vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap); va_end(ap);
error_cb(buf); error_cb(buf);
} }
@ -73,14 +73,14 @@ rsdb_init(rsdb_error_cb * ecb)
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) 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)); sqlite3_errmsg(rb_bandb));
mlog(errbuf); mlog(errbuf);
return -1; return -1;
} }
if(access(dbpath, W_OK)) 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); mlog(errbuf);
return -1; return -1;
} }

2
configure vendored
View file

@ -15407,7 +15407,7 @@ _ACEOF
fi fi
for ac_func in socketpair vsnprintf mmap gettimeofday strdup strndup for ac_func in snprintf vsnprintf socketpair mmap gettimeofday strdup strndup
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View file

@ -212,7 +212,7 @@ AC_CHECK_TYPE([sa_family_t], [],
AC_CHECK_TYPES([uintptr_t]) AC_CHECK_TYPES([uintptr_t])
dnl check for various functions... 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 AC_FUNC_ALLOCA

View file

@ -321,9 +321,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile $(AUTOMAKE) --foreign doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -683,9 +683,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extensions/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign extensions/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu extensions/Makefile $(AUTOMAKE) --foreign extensions/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -42,14 +42,14 @@ static int eb_extended(const char *data, struct Client *client_p,
if (data == NULL) if (data == NULL)
return EXTBAN_INVALID; 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); client_p->name, client_p->username, client_p->host, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) 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); client_p->name, client_p->username, client_p->orighost, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;

View file

@ -38,16 +38,16 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr,
struct sockaddr_in ip4; struct sockaddr_in ip4;
char *s = src_host, *s2 = src_iphost, *s3 = NULL, *s4 = NULL; 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); 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_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost);
/* handle hostmangling if necessary */ /* handle hostmangling if necessary */
if (client_p->localClient->mangledhost != NULL) if (client_p->localClient->mangledhost != NULL)
{ {
if (!strcmp(client_p->host, client_p->localClient->mangledhost)) 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)) 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; s3 = src_althost;
} }
@ -56,7 +56,7 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr,
/* handle Teredo if necessary */ /* 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)) 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); s4 = src_ip4host + strlen(src_ip4host);
rb_inet_ntop_sock((struct sockaddr *)&ip4, rb_inet_ntop_sock((struct sockaddr *)&ip4,
s4, src_ip4host + sizeof src_ip4host - s4); 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; return match(banstr, s) || match(banstr, s2) || (s3 != NULL && match(banstr, s3)) || (s4 != NULL && match(banstr, s4)) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
} }

View file

@ -124,11 +124,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
if(ipv6) if(ipv6)
{ {
rb_snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum); snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum);
} }
else else
{ {
rb_snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum); snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum);
} }
} }

View file

@ -93,7 +93,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask)
if (ipmask == 0) if (ipmask == 0)
{ {
rb_snprintf(outbuf, HOSTLEN, "%s-%X%X", snprintf(outbuf, HOSTLEN, "%s-%X%X",
ServerInfo.network_name, hosthash2, hosthash); ServerInfo.network_name, hosthash2, hosthash);
len1 = strlen(outbuf); len1 = strlen(outbuf);
rest = strchr(inbuf, '.'); rest = strchr(inbuf, '.');
@ -105,7 +105,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask)
rb_strlcat(outbuf, rest, HOSTLEN); rb_strlcat(outbuf, rest, HOSTLEN);
} }
else else
rb_snprintf(outbuf, HOSTLEN, "%X%X.%s", snprintf(outbuf, HOSTLEN, "%X%X.%s",
hosthash2, hosthash, ServerInfo.network_name); hosthash2, hosthash, ServerInfo.network_name);
} }

View file

@ -186,9 +186,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
} }
if(underline) if(underline)
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3)); snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else 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 /* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */ * 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; 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) if(action)
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3); snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3);
else 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_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", sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",

View file

@ -85,11 +85,11 @@ start_bandb(void)
rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1); rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL) 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) 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); ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) 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]; 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)) if(!EmptyString(mask2))
rb_snprintf_append(buf, sizeof(buf), "%s ", mask2); rb_snprintf_append(buf, sizeof(buf), "%s ", mask2);

View file

@ -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; ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr;
/* becomes 2.0.0.127.torbl.ahbl.org or whatever */ /* 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[3],
(unsigned int) ip[2], (unsigned int) ip[2],
(unsigned int) ip[1], (unsigned int) ip[1],
@ -190,7 +190,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
uint8_t lo = ip[i] & 0x0F; uint8_t lo = ip[i] & 0x0F;
/* One part... (why 5? rb_snprintf adds \0) */ /* 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) lo, /* Remember, backwards */
(unsigned int) hi); (unsigned int) hi);

View file

@ -188,7 +188,7 @@ cache_links(void *unused)
/* if the below is ever modified, change LINKSLINELEN */ /* if the below is ever modified, change LINKSLINELEN */
links_line = rb_malloc(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->name, me.name,
target_p->info[0] ? target_p->info : target_p->info[0] ? target_p->info :
"(Unknown Location)"); "(Unknown Location)");
@ -265,7 +265,7 @@ load_help(void)
{ {
if(ldirent->d_name[0] == '.') if(ldirent->d_name[0] == '.')
continue; 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); cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER);
irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr); irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr);
} }
@ -280,7 +280,7 @@ load_help(void)
{ {
if(ldirent->d_name[0] == '.') if(ldirent->d_name[0] == '.')
continue; 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 defined(S_ISLNK) && defined(HAVE_LSTAT)
if(lstat(filename, &sb) < 0) if(lstat(filename, &sb) < 0)
@ -350,7 +350,7 @@ cache_user_motd(void)
if(local_tm != NULL) 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", "%d/%d/%d %d:%d",
local_tm->tm_mday, local_tm->tm_mon + 1, local_tm->tm_mday, local_tm->tm_mon + 1,
1900 + local_tm->tm_year, local_tm->tm_hour, 1900 + local_tm->tm_year, local_tm->tm_hour,

View file

@ -179,7 +179,7 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask)
{ {
if ((1 << entry->value) & cap_mask) if ((1 << entry->value) & cap_mask)
{ {
tl = rb_sprintf(t, "%s ", entry->cap); tl = sprintf(t, "%s ", entry->cap);
t += tl; t += tl;
} }
} }
@ -238,20 +238,20 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd
struct DictionaryIter iter; struct DictionaryIter iter;
struct CapabilityEntry *entry; 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); cb(buf, privdata);
DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) 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); 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))); (unsigned int)((sizeof(unsigned int) * 8) - (idx->highest_bit - 1)));
cb(buf, privdata); 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); cb(buf, privdata);
} }

View file

@ -451,7 +451,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
{ {
is_member = IsMember(client_p, chptr); 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, me.name, client_p->name,
channel_pub_or_secret(chptr), chptr->chname); 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; 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); target_p->name, target_p->username, target_p->host);
} }
else else
@ -490,7 +490,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
t = lbuf + mlen; 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); 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 the buffers havent been built, do it here */
if(s == NULL) if(s == NULL)
{ {
rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); 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_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
s = src_host; s = src_host;
s2 = src_iphost; 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 host mangling mode enabled, also check their real host */
if(!strcmp(who->host, who->localClient->mangledhost)) 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; s3 = src_althost;
} }
/* if host mangling mode not enabled and no other spoof, /* if host mangling mode not enabled and no other spoof,
* also check the mangled form of their host */ * also check the mangled form of their host */
else if (!IsDynSpoof(who)) 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; 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 && if(who->localClient->ip.ss_family == AF_INET6 &&
ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4)) 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); s4 = src_ip4host + strlen(src_ip4host);
rb_inet_ntop_sock((struct sockaddr *)&ip4, rb_inet_ntop_sock((struct sockaddr *)&ip4,
s4, src_ip4host + sizeof src_ip4host - s4); 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.chptr = chptr;
moduledata.approved = 0; moduledata.approved = 0;
rb_sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host); 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_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost);
if(source_p->localClient->mangledhost != NULL) if(source_p->localClient->mangledhost != NULL)
{ {
/* if host mangling mode enabled, also check their real host */ /* if host mangling mode enabled, also check their real host */
if(!strcmp(source_p->host, source_p->localClient->mangledhost)) 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; use_althost = 1;
} }
/* if host mangling mode not enabled and no other spoof, /* if host mangling mode not enabled and no other spoof,
* also check the mangled form of their host */ * also check the mangled form of their host */
else if (!IsDynSpoof(source_p)) 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; use_althost = 1;
} }
} }
@ -971,8 +971,8 @@ find_bannickchange_channel(struct Client *client_p)
if (!MyClient(client_p)) if (!MyClient(client_p))
return NULL; return NULL;
rb_sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); 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_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost);
RB_DLINK_FOREACH(ptr, client_p->user->channel.head) RB_DLINK_FOREACH(ptr, client_p->user->channel.head)
{ {
@ -1202,7 +1202,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'l'; *mbuf++ = 'l';
if(!IsClient(client_p) || IsMember(client_p, chptr)) 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) if(*chptr->mode.key)
@ -1210,7 +1210,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'k'; *mbuf++ = 'k';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) 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) if(chptr->mode.join_num)
@ -1218,7 +1218,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'j'; *mbuf++ = 'j';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) 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); chptr->mode.join_time);
} }
@ -1228,7 +1228,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'f'; *mbuf++ = 'f';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) 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'; *mbuf = '\0';
@ -1273,7 +1273,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
pbuf = parabuf; pbuf = parabuf;
dir = MODE_QUERY; 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, use_id(source_p), (long) chptr->channelts,
chptr->chname); chptr->chname);
@ -1336,7 +1336,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
if(arg != NULL) if(arg != NULL)
{ {
len = rb_sprintf(pbuf, "%s ", arg); len = sprintf(pbuf, "%s ", arg);
pbuf += len; pbuf += len;
pbl += len; pbl += len;
mc++; mc++;

View file

@ -283,7 +283,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
if(IsPerson(source_p)) 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 else
rb_strlcpy(who, source_p->name, sizeof(who)); rb_strlcpy(who, source_p->name, sizeof(who));
@ -851,7 +851,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
char buf[BANLEN]; char buf[BANLEN];
banptr = ptr->data; banptr = ptr->data;
if(banptr->forward) 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 else
rb_strlcpy(buf, banptr->banstr, sizeof(buf)); rb_strlcpy(buf, banptr->banstr, sizeof(buf));
@ -981,7 +981,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
} }
if(removed && removed->forward) 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 else
removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1; removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1;
if(removed) if(removed)
@ -1166,7 +1166,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0) if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0)
return; return;
rb_sprintf(limitstr, "%d", limit); sprintf(limitstr, "%d", limit);
mode_changes[mode_count].letter = c; mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD; mode_changes[mode_count].dir = MODE_ADD;
@ -1741,9 +1741,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
return; return;
if(IsServer(source_p)) 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 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->name, source_p->username,
source_p->host, chptr->chname); 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) if(mode_changes[i].arg != NULL)
{ {
paracount++; paracount++;
len = rb_sprintf(pbuf, "%s ", mode_changes[i].arg); len = sprintf(pbuf, "%s ", mode_changes[i].arg);
pbuf += len; pbuf += len;
paralen += len; paralen += len;
} }

View file

@ -350,7 +350,7 @@ check_pings_list(rb_dlink_list * list)
"No response from %s, closing link", "No response from %s, closing link",
log_client_name(client_p, HIDE_IP)); log_client_name(client_p, HIDE_IP));
} }
(void) rb_snprintf(scratch, sizeof(scratch), (void) snprintf(scratch, sizeof(scratch),
"Ping timeout: %d seconds", "Ping timeout: %d seconds",
(int) (rb_current_time() - client_p->localClient->lasttime)); (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_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); rb_note(client_p->localClient->F, note);
} }
} }
@ -926,16 +926,16 @@ get_client_name(struct Client *client, int showip)
switch (showip) switch (showip)
{ {
case SHOW_IP: case SHOW_IP:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username, client->name, client->username,
client->sockhost); client->sockhost);
break; break;
case MASK_IP: 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); client->name, client->username);
break; break;
default: default:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username, client->host); client->name, client->username, client->host);
} }
return nbuf; return nbuf;
@ -968,12 +968,12 @@ log_client_name(struct Client *target_p, int showip)
switch (showip) switch (showip)
{ {
case SHOW_IP: 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); target_p->username, target_p->sockhost);
break; break;
default: 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); target_p->username, target_p->host);
} }
@ -1209,7 +1209,7 @@ dead_link(struct Client *client_p, int sendqex)
if(sendqex) if(sendqex)
rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice)); rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
else 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; abt->client = client_p;
SetIOError(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); strcat(comment1, source_p->name);
} }
if (IsPerson(from)) if (IsPerson(from))
rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s", snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from->name, comment); from->name, comment);
if(source_p->serv != NULL) 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 /* Always show source here, so the server notices show
* which side initiated the split -- jilles * 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); from == source_p ? me.name : from->name, comment);
if (!IsIOError(source_p)) if (!IsIOError(source_p))
sendto_one(source_p, "SQUIT %s :%s", use_id(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) if(error == 0)
rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg)); rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
else 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); exit_client(client_p, client_p, &me, errmsg);
} }

View file

@ -377,7 +377,7 @@ write_pidfile(const char *filename)
{ {
unsigned int pid = (unsigned int) getpid(); 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)) if((fputs(buff, fb) == -1))
{ {
ilog(L_MAIN, "Error writing %u to pid file %s (%s)", ilog(L_MAIN, "Error writing %u to pid file %s (%s)",

View file

@ -128,7 +128,7 @@ get_listener_name(const struct Listener *listener)
if(listener == NULL) if(listener == NULL)
return 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)); me.name, listener->name, get_listener_port(listener));
return buf; 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) 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)) if (len >= (int)(sizeof(buf)-1))
{ {
buf[sizeof(buf) - 3] = '\r'; buf[sizeof(buf) - 3] = '\r';

View file

@ -84,7 +84,7 @@ verify_logfile_access(const char *filename)
if(access(dirname, F_OK) == -1) 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) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", 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) 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)); filename, dirname, strerror(errno));
if(testing_conf || server_state_foreground) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
@ -106,7 +106,7 @@ verify_logfile_access(const char *filename)
if(access(filename, W_OK) == -1) 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) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf);
@ -177,10 +177,10 @@ ilog(ilogfile dest, const char *format, ...)
return; return;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buf, sizeof(buf), format, args); vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
rb_snprintf(buf2, sizeof(buf2), "%s %s\n", snprintf(buf2, sizeof(buf2), "%s %s\n",
smalldate(rb_current_time()), buf); smalldate(rb_current_time()), buf);
if(fputs(buf2, logfile) < 0) if(fputs(buf2, logfile) < 0)
@ -209,7 +209,7 @@ inotice(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buf, sizeof(buf), format, args); vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("notice", buf); _iprint("notice", buf);
@ -224,7 +224,7 @@ iwarn(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buf, sizeof(buf), format, args); vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("warning", buf); _iprint("warning", buf);
@ -239,7 +239,7 @@ ierror(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buf, sizeof(buf), format, args); vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("error", buf); _iprint("error", buf);
@ -274,7 +274,7 @@ smalldate(time_t ltime)
lt = localtime(&ltime); lt = localtime(&ltime);
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_year + 1900, lt->tm_mon + 1,
lt->tm_mday, lt->tm_hour, lt->tm_min); lt->tm_mday, lt->tm_hour, lt->tm_min);

View file

@ -240,12 +240,12 @@ load_all_modules(int warn)
while ((ldirent = readdir(system_module_dir)) != NULL) 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")) 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) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name);
(void) load_a_module(module_fq_name, warn, 0); (void) load_a_module(module_fq_name, warn, 0);
} }
} }
(void) closedir(system_module_dir); (void) closedir(system_module_dir);
@ -266,7 +266,7 @@ load_core_modules(int warn)
for (i = 0; core_module_table[i]; i++) 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"); core_module_table[i], ".la");
if(load_a_module(module_name, warn, 1) == -1) if(load_a_module(module_name, warn, 1) == -1)
@ -301,7 +301,7 @@ load_one_module(const char *path, int coremodule)
{ {
mpath = pathst->data; 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((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL))
{ {
if(stat(modpath, &statbuf) == 0) if(stat(modpath, &statbuf) == 0)

View file

@ -95,7 +95,7 @@ monitor_signon(struct Client *client_p)
if(monptr == NULL) if(monptr == NULL)
return; 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); sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf);
} }

View file

@ -2034,7 +2034,7 @@ conf_report_error(const char *fmt, ...)
char msg[IRCD_BUFSIZE + 1] = { 0 }; char msg[IRCD_BUFSIZE + 1] = { 0 };
va_start(ap, fmt); va_start(ap, fmt);
rb_vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); vsnprintf(msg, IRCD_BUFSIZE, fmt, ap);
va_end(ap); va_end(ap);
if (testing_conf) if (testing_conf)

View file

@ -373,7 +373,7 @@ handle_command(struct Message *mptr, struct Client *client_p,
ilog(L_SERVER, ilog(L_SERVER,
"Insufficient parameters (%d < %d) for command '%s' from %s.", "Insufficient parameters (%d < %d) for command '%s' from %s.",
i, ehandler.min_para, mptr->cmd, client_p->name); 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'", "Insufficient parameters (%d < %d) for command '%s'",
i, ehandler.min_para, mptr->cmd); i, ehandler.min_para, mptr->cmd);
exit_client(client_p, client_p, client_p, squitreason); 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 */ int tl; /* current length of presently being built string in t */
for (i = 2; i < (parc - 1); i++) for (i = 2; i < (parc - 1); i++)
{ {
tl = rb_sprintf(t, " %s", parv[i]); tl = sprintf(t, " %s", parv[i]);
t += tl; t += tl;
} }
rb_sprintf(t, " :%s", parv[parc - 1]); sprintf(t, " :%s", parv[parc - 1]);
} }
if((target_p = find_client(parv[1])) != NULL) if((target_p = find_client(parv[1])) != NULL)

View file

@ -77,7 +77,7 @@ server_reboot(void)
execv(SPATH, (void *)myargv); execv(SPATH, (void *)myargv);
/* use this if execv of SPATH fails */ /* 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); execv(path, (void *)myargv);
exit(-1); exit(-1);

View file

@ -492,7 +492,7 @@ auth_connect_callback(rb_fde_t *F, int error, void *data)
return; return;
} }
rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n",
auth->rport, auth->lport); auth->rport, auth->lport);
authlen = strlen(authbuf); authlen = strlen(authbuf);

View file

@ -1269,13 +1269,13 @@ get_oper_name(struct Client *client_p)
if(MyOper(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->name, client_p->username,
client_p->host, client_p->localClient->opername); client_p->host, client_p->localClient->opername);
return buffer; 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->name, client_p->username,
client_p->host, client_p->servptr->name); client_p->host, client_p->servptr->name);
return buffer; return buffer;
@ -1319,7 +1319,7 @@ get_user_ban_reason(struct ConfItem *aconf)
if (aconf->flags & CONF_FLAGS_TEMPORARY && if (aconf->flags & CONF_FLAGS_TEMPORARY &&
(aconf->status == CONF_KILL || aconf->status == CONF_DLINE)) (aconf->status == CONF_KILL || aconf->status == CONF_DLINE))
rb_snprintf(reasonbuf, sizeof reasonbuf, snprintf(reasonbuf, sizeof reasonbuf,
"Temporary %c-line %d min. - ", "Temporary %c-line %d min. - ",
aconf->status == CONF_DLINE ? 'D' : 'K', aconf->status == CONF_DLINE ? 'D' : 'K',
(int)((aconf->hold - aconf->created) / 60)); (int)((aconf->hold - aconf->created) / 60));
@ -1355,7 +1355,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
*oper_reason = NULL; *oper_reason = NULL;
else 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->spasswd,
EmptyString(aconf->spasswd) ? "" : " ", EmptyString(aconf->spasswd) ? "" : " ",
aconf->info.oper); aconf->info.oper);

View file

@ -209,7 +209,7 @@ propagate_generic(struct Client *source_p, const char *command,
va_list args; va_list args;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buffer, sizeof(buffer), format, args); vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args); va_end(args);
sendto_match_servs(source_p, target, cap, NOCAPS, 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; rb_dlink_node *ptr;
va_start(args, format); va_start(args, format);
rb_vsnprintf(buffer, sizeof(buffer), format, args); vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args); va_end(args);
RB_DLINK_FOREACH(ptr, cluster_conf_list.head) RB_DLINK_FOREACH(ptr, cluster_conf_list.head)
@ -827,4 +827,3 @@ find_tgchange(const char *host)
return NULL; return NULL;
} }

View file

@ -503,7 +503,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
int mlen; int mlen;
int cur_len; 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); me.id, (long) chptr->channelts, chptr->chname, flag);
t = buf + mlen; t = buf + mlen;
@ -531,9 +531,9 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
} }
if (banptr->forward) if (banptr->forward)
rb_sprintf(t, "%s$%s ", banptr->banstr, banptr->forward); sprintf(t, "%s$%s ", banptr->banstr, banptr->forward);
else else
rb_sprintf(t, "%s ", banptr->banstr); sprintf(t, "%s ", banptr->banstr);
t += tlen; t += tlen;
cur_len += tlen; cur_len += tlen;
} }
@ -634,7 +634,7 @@ burst_TS6(struct Client *client_p)
if(*chptr->chname != '#') if(*chptr->chname != '#')
continue; 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, (long) chptr->channelts, chptr->chname,
channel_modes(chptr, client_p)); channel_modes(chptr, client_p));
@ -658,7 +658,7 @@ burst_TS6(struct Client *client_p)
t = buf + mlen; 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)); use_id(msptr->client_p));
cur_len += tlen; cur_len += tlen;
@ -868,7 +868,7 @@ server_estab(struct Client *client_p)
hdata.target = client_p; hdata.target = client_p;
call_hook(h_server_introduced, &hdata); 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); rb_note(client_p->localClient->F, note);
/* /*
@ -973,7 +973,7 @@ server_estab(struct Client *client_p)
/* /*
* serv_connect() - initiate a server connection * serv_connect() - initiate a server connection
* *
* inputs - pointer to conf * inputs - pointer to conf
* - pointer to client doing the connet * - pointer to client doing the connet
* output - * output -
* side effects - * side effects -
@ -1025,7 +1025,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
} }
/* servernames are always guaranteed under HOSTLEN chars */ /* 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); rb_note(F, note);
/* Create a local client */ /* Create a local client */

View file

@ -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); rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
add_to_client_hash(source_p->name, source_p); 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); 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++; ServerStats.is_ref++;
sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains " sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains "
"only alphanumeric characters."); "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); exit_client(client_p, source_p, &me, tmpstr2);
return (CLIENT_EXITED); return (CLIENT_EXITED);
} }

View file

@ -478,7 +478,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
current_serial++; current_serial++;
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
if(IsServer(source_p)) if(IsServer(source_p))
@ -921,7 +921,7 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
rb_linebuf_newbuf(&rb_linebuf_id); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
if(IsServer(source_p)) 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); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, 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 */ /* rather a lot of copying around, oh well -- jilles */
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&linebuf, pattern, NULL, rb_linebuf_putmsg(&linebuf, pattern, NULL,
":%s NOTICE * :*** Notice -- %s", me.name, buf); ":%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 */ /* rather a lot of copying around, oh well -- jilles */
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&linebuf, pattern, NULL, rb_linebuf_putmsg(&linebuf, pattern, NULL,
":%s NOTICE * :*** Notice -- %s", me.name, buf); ":%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); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
rb_vsnprintf(buf, sizeof(buf), pattern, args); vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s", rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s",

View file

@ -246,11 +246,11 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
if(ssld_path == NULL) 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) 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); ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) 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(F1, READBUF_SIZE);
rb_set_buffers(F2, 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); rb_setenv("CTL_FD", fdarg, 1);
if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1) if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1)
{ {
ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno)); ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno));
return started; 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_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); rb_setenv("CTL_PPID", s_pid, 1);
#ifdef _WIN32 #ifdef _WIN32
SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1); 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); rb_free(client_p->certfp);
certfp_string = rb_malloc(len * 2 + 1); certfp_string = rb_malloc(len * 2 + 1);
for(i = 0; i < len; i++) for(i = 0; i < len; i++)
rb_snprintf(certfp_string + 2 * i, 3, "%02x", snprintf(certfp_string + 2 * i, 3, "%02x",
certfp[i]); certfp[i]);
client_p->certfp = certfp_string; 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)); len, sizeof(tmpbuf));
return; 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_private_key, nul, ssl_dh_params, nul,
ssl_cipher_list != NULL ? ssl_cipher_list : "", nul); ssl_cipher_list != NULL ? ssl_cipher_list : "", nul);
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len); 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; 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); ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
} }

View file

@ -201,7 +201,7 @@ const char *
isupport_intptr(const void *ptr) isupport_intptr(const void *ptr)
{ {
static char buf[15]; static char buf[15];
rb_snprintf(buf, sizeof buf, "%d", *(const int *)ptr); snprintf(buf, sizeof buf, "%d", *(const int *)ptr);
return buf; return buf;
} }
@ -240,7 +240,7 @@ isupport_chanmodes(const void *ptr)
{ {
static char result[80]; 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_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_invex ? "I" : "",
ConfigChannel.use_forward ? "f" : "", ConfigChannel.use_forward ? "f" : "",
@ -259,7 +259,7 @@ isupport_chanlimit(const void *ptr)
{ {
static char result[30]; 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); ConfigChannel.disable_local_channels ? "#" : "&#", ConfigChannel.max_chans_per_user);
return result; return result;
} }
@ -269,7 +269,7 @@ isupport_maxlist(const void *ptr)
{ {
static char result[30]; 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_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_invex ? "I" : "",
ConfigChannel.max_bans); ConfigChannel.max_bans);
@ -281,7 +281,7 @@ isupport_targmax(const void *ptr)
{ {
static char result[200]; 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,
ConfigFileEntry.max_targets); ConfigFileEntry.max_targets);
return result; return result;
@ -296,7 +296,7 @@ isupport_extban(const void *ptr)
p = get_extban_string(); p = get_extban_string();
if (EmptyString(p)) if (EmptyString(p))
return NULL; return NULL;
rb_snprintf(result, sizeof result, "$,%s", p); snprintf(result, sizeof result, "$,%s", p);
return result; return result;
} }
@ -305,7 +305,7 @@ isupport_nicklen(const void *ptr)
{ {
static char result[200]; static char result[200];
rb_snprintf(result, sizeof result, "%u", ConfigFileEntry.nicklen - 1); snprintf(result, sizeof result, "%u", ConfigFileEntry.nicklen - 1);
return result; return result;
} }

3
libratbox/configure vendored
View file

@ -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 : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 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 "Assert debugging ............... $assert"
echo "SSL Type........................ $SSL_TYPE" echo "SSL Type........................ $SSL_TYPE"
echo echo

View file

@ -24,7 +24,7 @@ AC_PROG_CC_C99
if test x"$ac_cv_prog_cc_c99" = "xno"; then if test x"$ac_cv_prog_cc_c99" = "xno"; then
AC_ERROR([ircd-ratbox requires a C99 capable compiler]) AC_ERROR([ircd-ratbox requires a C99 capable compiler])
fi fi
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_EGREP AC_PROG_EGREP
@ -192,7 +192,7 @@ RB_PROTO_INET6([], [
]) ])
fi fi
fi fi
AC_CHECK_TYPES([struct sockaddr_storage],[ AC_CHECK_TYPES([struct sockaddr_storage],[
rb_have_sockaddr_storage=yes rb_have_sockaddr_storage=yes
@ -200,7 +200,7 @@ AC_CHECK_TYPES([struct sockaddr_storage],[
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
]) ])
dnl Check for stdarg.h - if we cant find it, halt configure 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 **])]) 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... 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(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])) 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_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll]) AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll])
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
@ -327,14 +327,14 @@ fi
if test "$cf_enable_openssl" != no; then if test "$cf_enable_openssl" != no; then
CPPFLAGS="$CPPFLAGS $SSL_LIBS" CPPFLAGS="$CPPFLAGS $SSL_LIBS"
AC_CHECK_LIB(crypto, RAND_status, AC_CHECK_LIB(crypto, RAND_status,
[cf_enable_openssl=yes], [cf_enable_openssl=yes],
[cf_enable_openssl=no]) [cf_enable_openssl=no])
fi fi
if test "$cf_enable_openssl" != no; then if test "$cf_enable_openssl" != no; then
CPPFLAGS="$CPPFLAGS $SSL_LIBS" CPPFLAGS="$CPPFLAGS $SSL_LIBS"
AC_CHECK_LIB(ssl, SSL_read, AC_CHECK_LIB(ssl, SSL_read,
[SSL_LIBS="$SSL_LIBS -lssl -lcrypto"], [SSL_LIBS="$SSL_LIBS -lssl -lcrypto"],
[cf_enable_openssl=no], [-lcrypto]) [cf_enable_openssl=no], [-lcrypto])
fi fi
@ -364,11 +364,11 @@ AC_ARG_ENABLE(gnutls,
AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])], AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])],
[cf_enable_gnutls=$enableval], [cf_enable_gnutls=$enableval],
[cf_enable_gnutls="auto"]) [cf_enable_gnutls="auto"])
if test "$cf_enable_gnutls" != no; then if test "$cf_enable_gnutls" != no; then
PKG_CHECK_MODULES(GNUTLS, [gnutls], [ PKG_CHECK_MODULES(GNUTLS, [gnutls], [
cf_enable_gnutls="yes" cf_enable_gnutls="yes"
], [cf_enable_gnutls="no"]) ], [cf_enable_gnutls="no"])
fi fi
dnl mbed TLS is given highest preference when no specified TLS library is provided 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 elif test x"$cf_enable_mbedtls" != xno; then
AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS]) AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS])
SSL_LIBS="" SSL_LIBS=""
SSL_CFLAGS="" SSL_CFLAGS=""
GNUTLS_CFLAGS="" GNUTLS_CFLAGS=""
GNUTLS_LIBS="" GNUTLS_LIBS=""
SSL_TYPE="mbedtls" SSL_TYPE="mbedtls"
elif test x"$cf_enable_gnutls" != xno; then elif test x"$cf_enable_gnutls" != xno; then
AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS]) AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS])
SSL_LIBS="" SSL_LIBS=""
@ -462,7 +462,7 @@ AC_SUBST(GNUTLS_LIBS)
AC_SUBST(MBEDTLS_CFLAGS) AC_SUBST(MBEDTLS_CFLAGS)
AC_SUBST(MBEDTLS_LIBS) 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.]) AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where libratbox is installed.])
else else
@ -472,7 +472,7 @@ dnl a custom prefix with a trailing slash
prefix=`echo $prefix | sed 's/\/$//'` prefix=`echo $prefix | sed 's/\/$//'`
AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where libratbox is installed.]) AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where libratbox is installed.])
fi fi
AC_SUBST(RB_PREFIX) AC_SUBST(RB_PREFIX)
@ -481,14 +481,14 @@ AC_CONFIG_COMMANDS([include/librb-config.h],
[ [
outfile=include/librb-config.h.tmp outfile=include/librb-config.h.tmp
cat > $outfile <<\_______EOF cat > $outfile <<\_______EOF
/* /*
* librb-config.h: libratbox config file. Please modify configure.ac * librb-config.h: libratbox config file. Please modify configure.ac
*/ */
#ifndef __LIBRB_CONFIG_H #ifndef __LIBRB_CONFIG_H
#define __LIBRB_CONFIG_H #define __LIBRB_CONFIG_H
_______EOF _______EOF
if test "x$rb_have_ipv6" = "xyes"; then if test "x$rb_have_ipv6" = "xyes"; then
echo "#define RB_IPV6 1" >> $outfile echo "#define RB_IPV6 1" >> $outfile
@ -651,18 +651,18 @@ fi
rb_socklen_t=$rb_socklen_t rb_socklen_t=$rb_socklen_t
if test "x$rb_have_sockaddr_storage" = "xyes"; then if test "x$rb_have_sockaddr_storage" = "xyes"; then
rb_sockaddr_storage="yes" rb_sockaddr_storage="yes"
else else
rb_sockaddr_storage="no" rb_sockaddr_storage="no"
fi fi
rb_have_ipv6="$have_v6" rb_have_ipv6="$have_v6"
rb_mv="$MV" rb_mv="$MV"
rb_rm="$RM" rb_rm="$RM"
] ]
) )
@ -687,4 +687,3 @@ echo "IPv6 support ................... $have_v6"
echo "Assert debugging ............... $assert" echo "Assert debugging ............... $assert"
echo "SSL Type........................ $SSL_TYPE" echo "SSL Type........................ $SSL_TYPE"
echo echo

View file

@ -220,7 +220,6 @@ pid_t rb_getpid(void);
#include <rb_commio.h> #include <rb_commio.h>
#include <rb_balloc.h> #include <rb_balloc.h>
#include <rb_linebuf.h> #include <rb_linebuf.h>
#include <rb_snprintf.h>
#include <rb_event.h> #include <rb_event.h>
#include <rb_helper.h> #include <rb_helper.h>
#include <rb_rawbuf.h> #include <rb_rawbuf.h>

View file

@ -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 */

View file

@ -34,6 +34,14 @@
size_t rb_strlcpy(char *dst, const char *src, size_t siz); 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_strlcat(char *dst, const char *src, size_t siz);
size_t rb_strnlen(const char *s, size_t count); 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_basename(const char *);
char *rb_dirname(const char *); char *rb_dirname(const char *);

View file

@ -27,7 +27,6 @@ libratbox_la_SOURCES = \
ratbox_lib.c \ ratbox_lib.c \
rb_memory.c \ rb_memory.c \
linebuf.c \ linebuf.c \
snprintf.c \
tools.c \ tools.c \
helper.c \ helper.c \
devpoll.c \ devpoll.c \
@ -41,8 +40,7 @@ libratbox_la_SOURCES = \
patricia.c \ patricia.c \
arc4random.c \ arc4random.c \
version.c version.c
libratbox_la_LDFLAGS = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt 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@ libratbox_la_LIBADD = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@
lib_LTLIBRARIES = libratbox.la lib_LTLIBRARIES = libratbox.la

View file

@ -133,10 +133,9 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libratbox_la_DEPENDENCIES = libratbox_la_DEPENDENCIES =
am_libratbox_la_OBJECTS = unix.lo win32.lo crypt.lo balloc.lo \ am_libratbox_la_OBJECTS = unix.lo win32.lo crypt.lo balloc.lo \
commio.lo mbedtls.lo openssl.lo gnutls.lo nossl.lo event.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 \ ratbox_lib.lo rb_memory.lo linebuf.lo tools.lo helper.lo \
helper.lo devpoll.lo epoll.lo poll.lo ports.lo sigio.lo \ devpoll.lo epoll.lo poll.lo ports.lo sigio.lo select.lo \
select.lo kqueue.lo rawbuf.lo patricia.lo arc4random.lo \ kqueue.lo rawbuf.lo patricia.lo arc4random.lo version.lo
version.lo
libratbox_la_OBJECTS = $(am_libratbox_la_OBJECTS) libratbox_la_OBJECTS = $(am_libratbox_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@) AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -359,7 +358,6 @@ libratbox_la_SOURCES = \
ratbox_lib.c \ ratbox_lib.c \
rb_memory.c \ rb_memory.c \
linebuf.c \ linebuf.c \
snprintf.c \
tools.c \ tools.c \
helper.c \ helper.c \
devpoll.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)/rb_memory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.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)/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)/tools.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@

View file

@ -1174,26 +1174,6 @@ inetntoa(const char *in)
return buf; 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 * 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. * 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); tp += strlen(tp);
break; break;
} }
tp += SPRINTF((tp, "%x", words[i])); tp += sprintf(tp, "%x", words[i]);
} }
/* Was it a trailing run of 0x00's? */ /* Was it a trailing run of 0x00's? */
if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) 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)) if(inet_pton4(src, dst))
{ {
char tmp[HOSTIPLEN]; char tmp[HOSTIPLEN];
rb_sprintf(tmp, "::ffff:%s", src); sprintf(tmp, "::ffff:%s", src);
return (inet_pton6(tmp, dst)); return (inet_pton6(tmp, dst));
} }
else else

View file

@ -485,7 +485,7 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
close(fd); close(fd);
return 0; 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); F = rb_open(fd, RB_FD_UNKNOWN, buf);
rb_set_nb(F); rb_set_nb(F);
event->comm_ptr = F; event->comm_ptr = F;

View file

@ -293,7 +293,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
struct ev_entry *ev; struct ev_entry *ev;
len = sizeof(buf); 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); func(buf, ptr);
rb_strlcpy(buf, "Operation Next Execution", len); 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) RB_DLINK_FOREACH(dptr, event_list.head)
{ {
ev = dptr->data; 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()); ev->when - (long)rb_current_time());
func(buf, ptr); func(buf, ptr);
} }

View file

@ -124,14 +124,7 @@ rb_rawbuf_flush
rb_rawbuf_get rb_rawbuf_get
rb_rawbuf_length rb_rawbuf_length
rb_outofmemory rb_outofmemory
rb_snprintf
rb_snprintf_append rb_snprintf_append
rb_sprintf
rb_sprintf_append
rb_vsnprintf
rb_vsnprintf_append
rb_vsprintf
rb_vsprintf_append
rb_free_rb_dlink_node rb_free_rb_dlink_node
rb_init_rb_dlink_nodes rb_init_rb_dlink_nodes
rb_make_rb_dlink_node rb_make_rb_dlink_node

View file

@ -664,7 +664,7 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) 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)); LIBGNUTLS_VERSION, gnutls_check_version(NULL));
} }
@ -673,7 +673,7 @@ rb_ssl_get_cipher(rb_fde_t *F)
{ {
static char buf[1024]; 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_protocol_get_name(gnutls_protocol_get_version(SSL_P(F))),
gnutls_kx_get_name(gnutls_kx_get(SSL_P(F))), gnutls_kx_get_name(gnutls_kx_get(SSL_P(F))),
gnutls_cipher_get_name(gnutls_cipher_get(SSL_P(F))), gnutls_cipher_get_name(gnutls_cipher_get(SSL_P(F))),

View file

@ -119,21 +119,21 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
helper = rb_malloc(sizeof(rb_helper)); 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) if(rb_pipe(&in_f[0], &in_f[1], buf) < 0)
{ {
rb_free(helper); rb_free(helper);
return NULL; 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) if(rb_pipe(&out_f[0], &out_f[1], buf) < 0)
{ {
rb_free(helper); rb_free(helper);
return NULL; return NULL;
} }
rb_snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1])); snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1]));
rb_snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0])); snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0]));
rb_set_nb(in_f[0]); rb_set_nb(in_f[0]);
rb_set_nb(in_f[1]); 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("OFD", fx, 1);
rb_setenv("MAXFD", "256", 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[0] = buf;
parv[1] = NULL; parv[1] = NULL;

View file

@ -526,13 +526,13 @@ rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args,
if(prefixfmt != NULL) if(prefixfmt != NULL)
{ {
va_start(prefix_args, prefixfmt); 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); va_end(prefix_args);
} }
if(va_args != NULL) 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; bufline->terminated = 1;
@ -644,7 +644,7 @@ rb_linebuf_put(buf_head_t * bufhead, const char *format, ...)
if(rb_unlikely(format != NULL)) if(rb_unlikely(format != NULL))
{ {
va_start(args, format); 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); va_end(args);
} }

View file

@ -593,7 +593,7 @@ rb_get_ssl_info(char *buf, size_t len)
char version_str[512]; char version_str[512];
mbedtls_version_get_string(version_str); 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); MBEDTLS_VERSION_STRING, version_str);
} }

View file

@ -165,7 +165,7 @@ rb_ssl_clear_handshake_count(rb_fde_t *F)
void void
rb_get_ssl_info(char *buf, size_t len) 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 int

View file

@ -746,7 +746,7 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) 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), SSLeay_version(SSLEAY_VERSION),
(long)OPENSSL_VERSION_NUMBER, SSLeay()); (long)OPENSSL_VERSION_NUMBER, SSLeay());
} }

View file

@ -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); inet_ntop(prefix->family, &prefix->add.sin, buf, buf_len);
if(with_len) if(with_len)
{ {
rb_snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen); snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen);
strcat(buf, tmp); strcat(buf, tmp);
} }
return (buf); return (buf);

View file

@ -87,7 +87,7 @@ rb_ctime(const time_t t, char *buf, size_t len)
return (p); 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], 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); tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900);
return (p); return (p);
@ -112,7 +112,7 @@ rb_date(const time_t t, char *buf, size_t len)
return (buf); 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, weekdays[gm->tm_wday], months[gm->tm_mon], gm->tm_mday,
gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec); gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec);
return (buf); return (buf);
@ -137,7 +137,7 @@ rb_lib_log(const char *format, ...)
if(rb_log == NULL) if(rb_log == NULL)
return; return;
va_start(args, format); va_start(args, format);
rb_vsnprintf(errbuf, sizeof(errbuf), format, args); vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_log(errbuf); rb_log(errbuf);
} }
@ -149,7 +149,7 @@ rb_lib_die(const char *format, ...)
if(rb_die == NULL) if(rb_die == NULL)
abort(); abort();
va_start(args, format); va_start(args, format);
rb_vsnprintf(errbuf, sizeof(errbuf), format, args); vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_die(errbuf); rb_die(errbuf);
} }
@ -161,7 +161,7 @@ rb_lib_restart(const char *format, ...)
if(rb_restart == NULL) if(rb_restart == NULL)
abort(); abort();
va_start(args, format); va_start(args, format);
rb_vsnprintf(errbuf, sizeof(errbuf), format, args); vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_restart(errbuf); rb_restart(errbuf);
abort(); abort();
@ -192,7 +192,7 @@ rb_lib_version(void)
static char version_info[512]; static char version_info[512];
char ssl_info[512]; char ssl_info[512];
rb_get_ssl_info(ssl_info, sizeof(ssl_info)); 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; return version_info;
} }

View file

@ -1,721 +0,0 @@
/*
* Modified and hacked into libratbox by Aaron Sethman <androsyn@ratbox.org>
* 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 <crutcher+kernel@datastacks.com>
* - changed to provide snprintf and vsnprintf functions
* So Feb 1 16:51:32 CET 2004 Juergen Quade <quade@hsnr.de>
* - scnprintf and vscnprintf
*/
#include <libratbox_config.h>
#include <ratbox_lib.h>
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);
}

View file

@ -202,6 +202,35 @@ rb_strnlen(const char *s, size_t count)
} }
#endif #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 /* rb_basename
* *
* input - * input -

View file

@ -145,7 +145,7 @@ rb_setenv(const char *name, const char *value, int overwrite)
return -1; return -1;
len = strlen(name) + strlen(value) + 5; len = strlen(name) + strlen(value) + 5;
buf = rb_malloc(len); buf = rb_malloc(len);
rb_snprintf(buf, len, "%s=%s", name, value); snprintf(buf, len, "%s=%s", name, value);
len = putenv(buf); len = putenv(buf);
rb_free(buf); rb_free(buf);
return (len); return (len);

View file

@ -756,9 +756,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu modules/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu modules/Makefile $(AUTOMAKE) --foreign modules/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -58,7 +58,7 @@ is_safe_error(const char *message)
if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25)) if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25))
return 1; return 1;
rb_snprintf(prefix2, sizeof prefix2, snprintf(prefix2, sizeof prefix2,
"Closing Link: 127.0.0.1 %s (", me.name); "Closing Link: 127.0.0.1 %s (", me.name);
if (!strncmp(message, prefix2, strlen(prefix2))) if (!strncmp(message, prefix2, strlen(prefix2)))
return 1; return 1;

View file

@ -769,7 +769,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
else else
modes = empty_modes; 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); use_id(source_p), (long) chptr->channelts, parv[2], modes);
ptr_uid = buf_uid + mlen_uid; 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 */ /* 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; ptr_uid += len;
len_uid += len; len_uid += len;
@ -1109,7 +1109,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_DEL; dir = MODE_DEL;
} }
*mbuf++ = 'k'; *mbuf++ = 'k';
len = rb_sprintf(pbuf, "%s ", oldmode->key); len = sprintf(pbuf, "%s ", oldmode->key);
pbuf += len; pbuf += len;
} }
if(oldmode->join_num && !mode->join_num) if(oldmode->join_num && !mode->join_num)
@ -1138,7 +1138,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD; dir = MODE_ADD;
} }
*mbuf++ = 'l'; *mbuf++ = 'l';
len = rb_sprintf(pbuf, "%d ", mode->limit); len = sprintf(pbuf, "%d ", mode->limit);
pbuf += len; pbuf += len;
} }
if(mode->key[0] && strcmp(oldmode->key, mode->key)) 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; dir = MODE_ADD;
} }
*mbuf++ = 'k'; *mbuf++ = 'k';
len = rb_sprintf(pbuf, "%s ", mode->key); len = sprintf(pbuf, "%s ", mode->key);
pbuf += len; pbuf += len;
} }
if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time)) 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; dir = MODE_ADD;
} }
*mbuf++ = 'j'; *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; pbuf += len;
} }
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && 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; dir = MODE_ADD;
} }
*mbuf++ = 'f'; *mbuf++ = 'f';
len = rb_sprintf(pbuf, "%s ", mode->forward); len = sprintf(pbuf, "%s ", mode->forward);
pbuf += len; pbuf += len;
} }
*mbuf = '\0'; *mbuf = '\0';
@ -1297,7 +1297,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
pbuf = lparabuf; 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; mbuf = lmodebuf + mlen;
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) 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; *mbuf++ = c;
cur_len += plen; cur_len += plen;
if (banptr->forward) if (banptr->forward)
pbuf += rb_sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward); pbuf += sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward);
else else
pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr); pbuf += sprintf(pbuf, "%s ", banptr->banstr);
count++; count++;
free_ban(banptr); free_ban(banptr);

View file

@ -165,7 +165,7 @@ mo_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
target_p->flags |= FLAGS_KILLED; 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); 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 */ /* FLAGS_KILLED prevents a quit being sent out */
target_p->flags |= FLAGS_KILLED; 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); 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]; char buffer[BUFSIZE];
if(MyClient(source_p)) if(MyClient(source_p))
rb_snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),
"%s!%s!%s!%s (%s)", "%s!%s!%s!%s (%s)",
me.name, source_p->host, source_p->username, source_p->name, reason); me.name, source_p->host, source_p->username, source_p->name, reason);
else 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) RB_DLINK_FOREACH(ptr, serv_list.head)
{ {

View file

@ -341,7 +341,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
fakesource_p = &me; fakesource_p = &me;
else else
fakesource_p = source_p; 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; mbuf = modebuf + mlen;
pbuf = parabuf; pbuf = parabuf;
@ -401,7 +401,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
forward[-1] = '$'; forward[-1] = '$';
*mbuf++ = parv[3][0]; *mbuf++ = parv[3][0];
arglen = rb_sprintf(pbuf, "%s ", s); arglen = sprintf(pbuf, "%s ", s);
pbuf += arglen; pbuf += arglen;
plen += arglen; plen += arglen;
modecount++; 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]); source_p->id, (long) chptr->channelts, chptr->chname, parv[3], parv[4]);
return 0; return 0;
} }

View file

@ -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); "with %d arguments (expecting 10)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.", ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.",
parc, client_p->name); parc, client_p->name);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "UID", 10); parc, "UID", 10);
exit_client(client_p, client_p, client_p, squitreason); 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)) 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", "Invalid UID %s for nick %s on %s/%s",
parv[8], parv[1], source_p->name, source_p->id); parv[8], parv[1], source_p->name, source_p->id);
exit_client(client_p, client_p, client_p, squitreason); 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); "with %d arguments (expecting 12)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.", ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.",
parc, client_p->name); parc, client_p->name);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "EUID", 12); parc, "EUID", 12);
exit_client(client_p, client_p, client_p, squitreason); 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)) 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", "Invalid UID %s for nick %s on %s/%s",
parv[8], parv[1], source_p->name, source_p->id); parv[8], parv[1], source_p->name, source_p->id);
exit_client(client_p, client_p, client_p, squitreason); 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); strcpy(source_p->name, nick);
add_to_client_hash(nick, source_p); 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); rb_note(client_p->localClient->F, note);
if(source_p->flags & FLAGS_SENTUSER) 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_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); rb_note(client_p->localClient->F, note);
return; 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?)", ilog(L_SERVER, "Link %s cancelled, bad nickname %s sent (NICKLEN mismatch?)",
client_p->name, nick); client_p->name, nick);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Bad nickname introduced [%s]", nick); "Bad nickname introduced [%s]", nick);
exit_client(client_p, client_p, &me, squitreason); exit_client(client_p, client_p, &me, squitreason);
} }

View file

@ -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]) if(ConfigFileEntry.client_exit && comment[0])
{ {
rb_snprintf(reason, sizeof(reason), "Quit: %s", comment); snprintf(reason, sizeof(reason), "Quit: %s", comment);
comment = reason; comment = reason;
} }

View file

@ -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", ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, name); client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Server %s already exists", "Server %s already exists",
name); name);
exit_client(client_p, client_p, &me, squitreason); 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.", ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, name); client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s", "No matching hub_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); 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.", ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, name); client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); 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", ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, parv[1]); client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Server %s already exists", "Server %s already exists",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); 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", 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); 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", "SID %s for %s already in use by %s",
parv[3], parv[1], target_p->name); parv[3], parv[1], target_p->name);
exit_client(NULL, client_p, &me, squitreason); 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.", ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, parv[1]); client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s", "No matching hub_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); 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.", ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, parv[1]); client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason, snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);

View file

@ -245,7 +245,7 @@ list_accepts(struct Client *source_p)
*nicks = '\0'; *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++; count++;
} }
} }

View file

@ -187,7 +187,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
int curlen, mlen; int curlen, mlen;
size_t i; size_t i;
mlen = rb_sprintf(buf, ":%s CAP %s %s", mlen = sprintf(buf, ":%s CAP %s %s",
me.name, me.name,
EmptyString(source_p->name) ? "*" : source_p->name, EmptyString(source_p->name) ? "*" : source_p->name,
subcmd); subcmd);
@ -247,7 +247,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
buflen++; buflen++;
} }
curlen = rb_sprintf(p, "%s ", clicap_list[i].name); curlen = sprintf(p, "%s ", clicap_list[i].name);
p += curlen; p += curlen;
buflen += curlen; buflen += curlen;
} }
@ -357,7 +357,7 @@ cap_req(struct Client *source_p, const char *arg)
if(EmptyString(arg)) if(EmptyString(arg))
return; 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); me.name, EmptyString(source_p->name) ? "*" : source_p->name);
pbuf[0][0] = '\0'; pbuf[0][0] = '\0';

View file

@ -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)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return 0;
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
cur_len += len; cur_len += len;
ptr += 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 its a command without parameters, dont prepend a ':' */
if(parc == 3) if(parc == 3)
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]); snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
else 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 */ /* add a trailing \0 if it was too long */
if((cur_len + len) >= BUFSIZE) 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; return 0;
} }

View file

@ -76,7 +76,7 @@ m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *p
current_insert_point2 = buf2; current_insert_point2 = buf2;
*buf2 = '\0'; *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); len = strlen(buf);
current_insert_point = buf + len; current_insert_point = buf + len;

View file

@ -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; 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), " | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
frac / 10, frac % 10); frac / 10, frac % 10);

View file

@ -104,9 +104,9 @@ add_monitor(struct Client *client_p, const char *nicks)
sendto_one(client_p, "%s", offbuf); sendto_one(client_p, "%s", offbuf);
if(p) if(p)
rb_snprintf(buf, sizeof(buf), "%s,%s", name, p); snprintf(buf, sizeof(buf), "%s,%s", name, p);
else else
rb_snprintf(buf, sizeof(buf), "%s", name); snprintf(buf, sizeof(buf), "%s", name);
sendto_one(client_p, form_str(ERR_MONLISTFULL), sendto_one(client_p, form_str(ERR_MONLISTFULL),
me.name, client_p->name, 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; return 0;
} }

View file

@ -137,7 +137,7 @@ names_global(struct Client *source_p)
chptr = ptr->data; chptr = ptr->data;
channel_member_names(chptr, source_p, 0); 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, "*", "*"); me.name, source_p->name, "*", "*");
t = buf + mlen; t = buf + mlen;
@ -180,7 +180,7 @@ names_global(struct Client *source_p)
t = buf + mlen; t = buf + mlen;
} }
tlen = rb_sprintf(t, "%s ", target_p->name); tlen = sprintf(t, "%s ", target_p->name);
cur_len += tlen; cur_len += tlen;
t += tlen; t += tlen;
} }

View file

@ -87,7 +87,7 @@ ms_operspy(struct Client *client_p, struct Client *source_p,
if((size_t)(cur_len + len) >= sizeof(buffer)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return 0;
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", snprintf(ptr, sizeof(buffer) - cur_len, "%s ",
parv[i]); parv[i]);
ptr += len; ptr += len;
cur_len += len; cur_len += len;
@ -98,4 +98,3 @@ ms_operspy(struct Client *client_p, struct Client *source_p,
return 0; return 0;
} }

View file

@ -137,7 +137,7 @@ do_restart(struct Client *source_p, const char *servername)
me.name, get_client_name(source_p, HIDE_IP)); 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); restart(buf);
return 0; return 0;

View file

@ -240,7 +240,7 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc,
if (mask != NULL) 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); target_p->name, target_p->username, target_p->host);
if (!match(mask, maskbuf)) if (!match(mask, maskbuf))

View file

@ -217,7 +217,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
parv[2]); 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); me.name);
exit_client(NULL, exist_p, &me, buf); exit_client(NULL, exist_p, &me, buf);
} }
@ -256,7 +256,7 @@ doit:
del_all_accepts(target_p); 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); rb_note(target_p->localClient->F, note);
return 0; return 0;
} }

View file

@ -192,7 +192,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
"Nick collision due to SVSLOGIN on %s", "Nick collision due to SVSLOGIN on %s",
nick); nick);
rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name); me.name);
exit_client(NULL, exist_p, &me, buf); exit_client(NULL, exist_p, &me, buf);
}else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) { }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); 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); 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); change_nick_user_host(target_p, nick, user, host, newts, "Signing %s (%s)", *login ? "in" : "out", nick);
} }

View file

@ -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, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Link %s dropped, wrong TS protocol version (%s,%s)", "Link %s dropped, wrong TS protocol version (%s,%s)",
source_p->name, parv[1], parv[2]); 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]); parv[1], parv[2]);
exit_client(source_p, source_p, source_p, squitreason); exit_client(source_p, source_p, source_p, squitreason);
return 0; 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" "Link %s dropped, excessive TS delta"
" (my TS=%ld, their TS=%ld, delta=%ld)", " (my TS=%ld, their TS=%ld, delta=%ld)",
log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat); 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); (long) rb_current_time(), (long) theirtime, deltat);
disable_server_conf_autoconn(source_p->name); disable_server_conf_autoconn(source_p->name);
exit_client(source_p, source_p, source_p, squitreason); 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; return 0;
} }

View file

@ -132,7 +132,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
if(aconf && aconf->status & CONF_DLINE) if(aconf && aconf->status & CONF_DLINE)
{ {
get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); 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 : ""); operreason ? "|" : "", operreason ? operreason : "");
sendto_one(source_p, form_str(RPL_TESTLINE), sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, 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) if(aconf->status & CONF_KILL)
{ {
get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); 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); puser, phost);
rb_snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason,
operreason ? "|" : "", operreason ? operreason : ""); operreason ? "|" : "", operreason ? operreason : "");
sendto_one(source_p, form_str(RPL_TESTLINE), sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, me.name, source_p->name,

View file

@ -109,7 +109,7 @@ date(void)
if(minswest < 0) if(minswest < 0)
minswest = -minswest; 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, weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec, lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec,
plus, minswest / 60, minswest % 60); plus, minswest / 60, minswest % 60);

View file

@ -127,7 +127,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
char topic[TOPICLEN + 1]; char topic[TOPICLEN + 1];
char topic_info[USERHOST_REPLYLEN]; char topic_info[USERHOST_REPLYLEN];
rb_strlcpy(topic, parv[2], sizeof(topic)); 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); source_p->name, source_p->username, source_p->host);
if (ConfigChannel.strip_topic_colors) if (ConfigChannel.strip_topic_colors)

View file

@ -75,7 +75,7 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char *
if((p = strchr(parv[1], '@'))) if((p = strchr(parv[1], '@')))
*p = '\0'; *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); rb_free(source_p->localClient->fullcaps);
source_p->localClient->fullcaps = rb_strdup(buf); source_p->localClient->fullcaps = rb_strdup(buf);

View file

@ -63,7 +63,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
int cur_len; int cur_len;
int rl; 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; t = buf + cur_len;
for (i = 1; i <= 5; i++) 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)) 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, target_p->name,
IsOper(target_p) ? "*" : "", IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+', (target_p->user->away) ? '-' : '+',
@ -90,7 +90,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
} }
else else
{ {
rl = rb_sprintf(response, "%s%s=%c%s@%s ", rl = sprintf(response, "%s%s=%c%s@%s ",
target_p->name, target_p->name,
IsOper(target_p) ? "*" : "", IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+', (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)) if((rl + cur_len) < (BUFSIZE - 10))
{ {
rb_sprintf(t, "%s", response); sprintf(t, "%s", response);
t += rl; t += rl;
cur_len += rl; cur_len += rl;
} }

View file

@ -468,7 +468,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
max = *pos >= bufsize ? 0 : bufsize - *pos; max = *pos >= bufsize ? 0 : bufsize - *pos;
va_start(ap, fmt); va_start(ap, fmt);
result = rb_vsnprintf(buf + *pos, max, fmt, ap); result = vsnprintf(buf + *pos, max, fmt, ap);
va_end(ap); va_end(ap);
*pos += result; *pos += result;
} }
@ -492,7 +492,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
size_t pos; size_t pos;
const char *q; 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)) : ""); 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) if (fmt->fields == 0)

View file

@ -199,7 +199,7 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char
{ {
char buffer[BUFSIZE]; 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->name, target_p->username,
target_p->host, target_p->servptr->name); target_p->host, target_p->servptr->name);
report_operspy(source_p, "WHOIS", buffer); 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->name, target_p->username,
target_p->host, target_p->info); 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), get_id(&me, source_p), get_id(source_p, source_p),
target_p->name); target_p->name);
@ -296,7 +296,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
t = buf + mlen; t = buf + mlen;
} }
tlen = rb_sprintf(t, "%s%s%s ", tlen = sprintf(t, "%s%s%s ",
hdata.approved ? "" : "!", hdata.approved ? "" : "!",
find_channel_status(msptr, 1), find_channel_status(msptr, 1),
chptr->chname); 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)) if(MyClient(target_p) && !EmptyString(target_p->localClient->opername) && IsOper(source_p))
{ {
char buf[512]; 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); target_p->localClient->opername, target_p->localClient->privset->name);
sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL), sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL),
target_p->name, buf); target_p->name, buf);
@ -423,4 +423,3 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
return; return;
} }

View file

@ -371,9 +371,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ssld/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ssld/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu ssld/Makefile $(AUTOMAKE) --foreign ssld/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \

View file

@ -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_READ, conn_plain_read_shutdown_cb, conn);
rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL); rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL);
va_start(ap, fmt); va_start(ap, fmt);
rb_vsnprintf(reason, sizeof(reason), fmt, ap); vsnprintf(reason, sizeof(reason), fmt, ap);
va_end(ap); va_end(ap);
buf[0] = 'D'; buf[0] = 'D';
@ -814,7 +814,7 @@ process_stats(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb)
if(conn == NULL) if(conn == NULL)
return; 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, conn->mod_in, conn->plain_in, conn->mod_out);
conn->plain_out = 0; conn->plain_out = 0;
conn->plain_in = 0; conn->plain_in = 0;

View file

@ -371,9 +371,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu tools/Makefile $(AUTOMAKE) --foreign tools/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
*config.status*) \ *config.status*) \