replace rb_snprintf with system snprintf

This commit is contained in:
Sam Dodrill 2014-12-15 20:39:52 -08:00
parent 63a50eaabc
commit 1ac5b0570e
57 changed files with 151 additions and 151 deletions

View File

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

View File

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

View File

@ -69,13 +69,13 @@ rsdb_init(rsdb_error_cb * ecb)
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) {
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK)) {
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf);
return -1;
}

View File

@ -41,13 +41,13 @@ static int eb_extended(const char *data, struct Client *client_p,
if (data == NULL)
return EXTBAN_INVALID;
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) {
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;

View File

@ -36,7 +36,7 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
return 0;
}
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
snprintf(text, sizeof(text), "O%s", source_p->id);
/* Provide a nice error message if you try to OACCEPT someone
* who you've already OACCEPTed. */

View File

@ -132,7 +132,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr);
rb_snprintf(text, sizeof(text), "K%s", who->id);
snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -172,9 +172,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
}
if(underline)
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else
rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
/* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */
@ -184,9 +184,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
}
if(action)
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
else
rb_snprintf(text2, sizeof(text2), "%s", text);
snprintf(text2, sizeof(text2), "%s", text);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",

View File

@ -454,7 +454,7 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
close(fd);
return 0;
}
rb_snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
F = rb_open(fd, RB_FD_UNKNOWN, buf);
rb_set_nb(F);
event->comm_ptr = F;

View File

@ -272,7 +272,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
struct ev_entry *ev;
len = sizeof(buf);
rb_snprintf(buf, len, "Last event to run: %s", last_event_ran);
snprintf(buf, len, "Last event to run: %s", last_event_ran);
func(buf, ptr);
rb_strlcpy(buf, "Operation Next Execution", len);
@ -280,7 +280,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
RB_DLINK_FOREACH(dptr, event_list.head) {
ev = dptr->data;
rb_snprintf(buf, len, "%-28s %-4ld seconds", ev->name,
snprintf(buf, len, "%-28s %-4ld seconds", ev->name,
ev->when - (long)rb_current_time());
func(buf, ptr);
}

View File

@ -529,7 +529,7 @@ rb_supports_ssl(void)
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)",
snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)",
LIBGNUTLS_VERSION, gnutls_check_version(NULL));
}

View File

@ -116,19 +116,19 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
helper = rb_malloc(sizeof(rb_helper));
rb_snprintf(buf, sizeof(buf), "%s helper - read", name);
snprintf(buf, sizeof(buf), "%s helper - read", name);
if(rb_pipe(&in_f[0], &in_f[1], buf) < 0) {
rb_free(helper);
return NULL;
}
rb_snprintf(buf, sizeof(buf), "%s helper - write", name);
snprintf(buf, sizeof(buf), "%s helper - write", name);
if(rb_pipe(&out_f[0], &out_f[1], buf) < 0) {
rb_free(helper);
return NULL;
}
rb_snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1]));
rb_snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0]));
snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1]));
snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0]));
rb_set_nb(in_f[0]);
rb_set_nb(in_f[1]);
@ -139,7 +139,7 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
rb_setenv("OFD", fx, 1);
rb_setenv("MAXFD", "256", 1);
rb_snprintf(buf, sizeof(buf), "-ircd %s daemon", name);
snprintf(buf, sizeof(buf), "-ircd %s daemon", name);
parv[0] = buf;
parv[1] = NULL;

View File

@ -170,7 +170,7 @@ rb_ssl_clear_handshake_count(rb_fde_t *F)
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "Not compiled with SSL support");
snprintf(buf, len, "Not compiled with SSL support");
}
#endif /* !HAVE_OPENSSL */

View File

@ -622,7 +622,7 @@ rb_supports_ssl(void)
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx",
snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx",
SSLeay_version(SSLEAY_VERSION),
(long)OPENSSL_VERSION_NUMBER, SSLeay());
}

View File

@ -74,7 +74,7 @@ prefix_toa2x(rb_prefix_t *prefix, char *buf, int buf_len, int with_len)
}
inet_ntop(prefix->family, &prefix->add.sin, buf, buf_len);
if(with_len) {
rb_snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen);
snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen);
strcat(buf, tmp);
}
return (buf);

View File

@ -82,7 +82,7 @@ rb_ctime(const time_t t, char *buf, size_t len)
return (p);
}
rb_snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d",
snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d",
s_weekdays[tp->tm_wday], s_month[tp->tm_mon],
tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900);
return (p);
@ -106,7 +106,7 @@ rb_date(const time_t t, char *buf, size_t len)
return (buf);
}
rb_snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00",
snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00",
weekdays[gm->tm_wday], months[gm->tm_mon], gm->tm_mday,
gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec);
return (buf);
@ -184,7 +184,7 @@ rb_lib_version(void)
static char version_info[512];
char ssl_info[512];
rb_get_ssl_info(ssl_info, sizeof(ssl_info));
rb_snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info);
snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info);
return version_info;
}

View File

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

View File

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

View File

@ -221,7 +221,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
use_id(source_p), chptr->chname, use_id(who), comment);
remove_user_from_channel(msptr);
rb_snprintf(text, sizeof(text), "K%s", who->id);
snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -263,11 +263,11 @@ relay_kill(struct Client *one, struct Client *source_p,
char buffer[BUFSIZE];
if(MyClient(source_p))
rb_snprintf(buffer, sizeof(buffer),
snprintf(buffer, sizeof(buffer),
"%s!%s!%s!%s (%s)",
me.name, source_p->host, source_p->username, source_p->name, reason);
else
rb_snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason);
snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason);
RB_DLINK_FOREACH(ptr, serv_list.head) {
client_p = ptr->data;

View File

@ -768,7 +768,7 @@ msg_client(int p_or_n, const char *command,
(IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) ||
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]))) {
if (IsOper(source_p)) {
rb_snprintf(text3, sizeof(text3), "O%s", source_p->id);
snprintf(text3, sizeof(text3), "O%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3)) {
oaccept = 1;

View File

@ -311,7 +311,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
"with %d arguments (expecting 10)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.",
parc, client_p->name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d",
parc, "UID", 10);
exit_client(client_p, client_p, client_p, squitreason);
@ -325,7 +325,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
}
if(!clean_uid(parv[8])) {
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Invalid UID %s for nick %s on %s",
parv[8], parv[1], source_p->name);
exit_client(client_p, client_p, client_p, squitreason);
@ -394,7 +394,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
"with %d arguments (expecting 12)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.",
parc, client_p->name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d",
parc, "EUID", 12);
exit_client(client_p, client_p, client_p, squitreason);
@ -408,7 +408,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
}
if(!clean_uid(parv[8])) {
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Invalid UID %s for nick %s on %s",
parv[8], parv[1], source_p->name);
exit_client(client_p, client_p, client_p, squitreason);
@ -601,7 +601,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick)
strcpy(source_p->name, nick);
add_to_client_hash(nick, source_p);
rb_snprintf(note, sizeof(note), "Nick: %s", nick);
snprintf(note, sizeof(note), "Nick: %s", nick);
rb_note(client_p->localClient->F, note);
if(source_p->flags & FLAGS_SENTUSER) {
@ -710,7 +710,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
rb_dlinkDestroy(ptr, &source_p->on_allow_list);
}
rb_snprintf(note, sizeof(note), "Nick: %s", nick);
snprintf(note, sizeof(note), "Nick: %s", nick);
rb_note(client_p->localClient->F, note);
return;
@ -1158,7 +1158,7 @@ static void bad_nickname(struct Client *client_p, const char *nick)
ilog(L_SERVER, "Link %s cancelled, bad nickname %s sent (NICKLEN mismatch?)",
client_p->name, nick);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Bad nickname introduced [%s]", nick);
exit_client(client_p, client_p, &me, squitreason);
}

View File

@ -65,7 +65,7 @@ m_quit(struct Client *client_p, struct Client *source_p, int parc, const char *p
strip_colour(comment);
if(ConfigFileEntry.client_exit && comment[0]) {
rb_snprintf(reason, sizeof(reason), "Quit: %s", comment);
snprintf(reason, sizeof(reason), "Quit: %s", comment);
comment = reason;
}

View File

@ -113,7 +113,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
if (!(client_p->localClient->caps & cap->cap)) {
char exitbuf[BUFSIZE];
rb_snprintf(exitbuf, BUFSIZE, "Missing required CAPAB [%s]", cap->name);
snprintf(exitbuf, BUFSIZE, "Missing required CAPAB [%s]", cap->name);
exit_client(client_p, client_p, client_p, exitbuf);
return 0;
@ -309,7 +309,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Server %s already exists",
name);
exit_client(client_p, client_p, &me, squitreason);
@ -391,7 +391,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s",
name);
exit_client(NULL, client_p, &me, squitreason);
@ -407,7 +407,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s",
name);
exit_client(NULL, client_p, &me, squitreason);
@ -483,7 +483,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Server %s already exists",
parv[1]);
exit_client(NULL, client_p, &me, squitreason);
@ -501,7 +501,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s cancelled, SID %s for server %s already in use by %s",
client_p->name, parv[3], parv[1], target_p->name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"SID %s for %s already in use by %s",
parv[3], parv[1], target_p->name);
exit_client(NULL, client_p, &me, squitreason);
@ -556,7 +556,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s",
parv[1]);
exit_client(NULL, client_p, &me, squitreason);
@ -571,7 +571,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, parv[1]);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s",
parv[1]);
exit_client(NULL, client_p, &me, squitreason);

View File

@ -228,7 +228,7 @@ list_accepts(struct Client *source_p)
*nicks = '\0';
}
len += rb_snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name);
len += snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name);
count++;
}
}

View File

@ -345,7 +345,7 @@ cap_req(struct Client *source_p, const char *arg)
if(EmptyString(arg))
return;
buflen = rb_snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
me.name, EmptyString(source_p->name) ? "*" : source_p->name);
pbuf[0][0] = '\0';

View File

@ -77,7 +77,7 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char
if((size_t)(cur_len + len) >= sizeof(buffer))
return 0;
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
cur_len += len;
ptr += len;
}
@ -86,9 +86,9 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char
/* if its a command without parameters, dont prepend a ':' */
if(parc == 3)
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
else
rb_snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]);
snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]);
/* add a trailing \0 if it was too long */
if((cur_len + len) >= BUFSIZE)

View File

@ -103,7 +103,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
}
frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total;
rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
frac / 10, frac % 10);

View File

@ -86,9 +86,9 @@ add_monitor(struct Client *client_p, const char *nicks)
sendto_one(client_p, "%s", offbuf);
if(p)
rb_snprintf(buf, sizeof(buf), "%s,%s", name, p);
snprintf(buf, sizeof(buf), "%s,%s", name, p);
else
rb_snprintf(buf, sizeof(buf), "%s", name);
snprintf(buf, sizeof(buf), "%s", name);
sendto_one(client_p, form_str(ERR_MONLISTFULL),
me.name, client_p->name,

View File

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

View File

@ -218,7 +218,7 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc,
continue;
if (mask != NULL) {
rb_snprintf(maskbuf, BUFSIZE, "%s!%s@%s",
snprintf(maskbuf, BUFSIZE, "%s!%s@%s",
target_p->name, target_p->username, target_p->host);
if (!match(mask, maskbuf))

View File

@ -196,7 +196,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
me.name);
rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name);
exit_client(NULL, exist_p, &me, buf);
}
@ -234,7 +234,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_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);
return 0;
}

View File

@ -201,7 +201,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
me.name);
rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name);
exit_client(NULL, exist_p, &me, buf);
} else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) {
@ -240,7 +240,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
send_signon(NULL, target_p, nick, user, host, rb_current_time(), login);
rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note);
}

View File

@ -69,7 +69,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Link %s dropped, wrong TS protocol version (%s,%s)",
source_p->name, parv[1], parv[2]);
rb_snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)",
snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)",
parv[1], parv[2]);
exit_client(source_p, source_p, source_p, squitreason);
return 0;
@ -92,7 +92,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char
"Link %s dropped, excessive TS delta"
" (my TS=%ld, their TS=%ld, delta=%d)",
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=%d)",
snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%d)",
(long) rb_current_time(), (long) theirtime, deltat);
disable_server_conf_autoconn(source_p->name);
exit_client(source_p, source_p, source_p, squitreason);

View File

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

View File

@ -69,7 +69,7 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char *
if((p = strchr(parv[1], '@')))
*p = '\0';
rb_snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]);
snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]);
rb_free(source_p->localClient->fullcaps);
source_p->localClient->fullcaps = rb_strdup(buf);

View File

@ -187,7 +187,7 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char
if(operspy) {
char buffer[BUFSIZE];
rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s %s",
snprintf(buffer, sizeof(buffer), "%s!%s@%s %s",
target_p->name, target_p->username,
target_p->host, target_p->servptr->name);
report_operspy(source_p, "WHOIS", buffer);

View File

@ -83,11 +83,11 @@ start_bandb(void)
rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL) {
rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) {
rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s",
ConfigFileEntry.dpath, suffix);
snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s",
ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) {
ilog(L_MAIN,
@ -122,7 +122,7 @@ bandb_add(bandb_type type, struct Client *source_p, const char *mask1,
static char buf[BUFSIZE];
rb_snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
if(!EmptyString(mask2))
rb_snprintf_append(buf, sizeof(buf), "%s ", mask2);

View File

@ -121,7 +121,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr;
/* becomes 2.0.0.127.torbl.ahbl.org or whatever */
rb_snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s",
snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s",
(unsigned int) ip[3],
(unsigned int) ip[2],
(unsigned int) ip[1],
@ -147,8 +147,8 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
uint8_t hi = (ip[i] >> 4) & 0x0F;
uint8_t lo = ip[i] & 0x0F;
/* One part... (why 5? rb_snprintf adds \0) */
rb_snprintf(bufptr, 5, "%1x.%1x.",
/* One part... (why 5? snprintf adds \0) */
snprintf(bufptr, 5, "%1x.%1x.",
(unsigned int) lo, /* Remember, backwards */
(unsigned int) hi);

View File

@ -172,7 +172,7 @@ cache_links(void *unused)
/* if the below is ever modified, change LINKSLINELEN */
links_line = rb_malloc(LINKSLINELEN);
rb_snprintf(links_line, LINKSLINELEN, "%s %s :1 %s",
snprintf(links_line, LINKSLINELEN, "%s %s :1 %s",
target_p->name, me.name,
target_p->info[0] ? target_p->info :
"(Unknown Location)");
@ -241,7 +241,7 @@ load_help(void)
while((ldirent = readdir(helpfile_dir)) != NULL) {
if(ldirent->d_name[0] == '.')
continue;
rb_snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name);
cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER);
irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr);
}
@ -255,7 +255,7 @@ load_help(void)
while((ldirent = readdir(helpfile_dir)) != NULL) {
if(ldirent->d_name[0] == '.')
continue;
rb_snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name);
snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name);
#if defined(S_ISLNK) && defined(HAVE_LSTAT)
if(lstat(filename, &sb) < 0)
@ -319,7 +319,7 @@ cache_user_motd(void)
local_tm = localtime(&sb.st_mtime);
if(local_tm != NULL) {
rb_snprintf(user_motd_changed, sizeof(user_motd_changed),
snprintf(user_motd_changed, sizeof(user_motd_changed),
"%d/%d/%d %d:%d",
local_tm->tm_mday, local_tm->tm_mon + 1,
1900 + local_tm->tm_year, local_tm->tm_hour,

View File

@ -853,7 +853,7 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
return (ERR_BANNEDFROMCHAN);
rb_snprintf(text, sizeof(text), "K%s", source_p->id);
snprintf(text, sizeof(text), "K%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, chptr->metadata) {
if(!strcmp(md->value, "KICKNOREJOIN") && !strcmp(md->name, text) && (md->timevalue + 2 > rb_current_time()))

View File

@ -140,7 +140,7 @@ construct_cflag_param_string(void)
{
*cflagsparaminfo = '\0';
rb_snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%s%sb%s%s%s%sklov%s%s",
snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%s%sb%s%s%s%sklov%s%s",
ConfigChannel.use_owner ? "y" : "",
ConfigChannel.use_admin ? "a" : "",
ConfigChannel.use_except ? "e" : "",

View File

@ -329,7 +329,7 @@ check_pings_list(rb_dlink_list * list)
"No response from %s, closing link",
log_client_name(client_p, HIDE_IP));
}
(void) rb_snprintf(scratch, sizeof(scratch),
(void) snprintf(scratch, sizeof(scratch),
"Ping timeout: %d seconds",
(int) (rb_current_time() - client_p->localClient->lasttime));
@ -759,16 +759,16 @@ get_client_name(struct Client *client, int showip)
/* And finally, let's get the host information, ip or name */
switch (showip) {
case SHOW_IP:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username,
client->sockhost);
break;
case MASK_IP:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
client->name, client->username);
break;
default:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username, client->host);
}
return nbuf;
@ -799,16 +799,16 @@ log_client_name(struct Client *target_p, int showip)
switch (showip) {
case SHOW_IP:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name,
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name,
target_p->username, target_p->sockhost);
break;
case MASK_IP:
rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
target_p->name, target_p->username);
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);
}
@ -1064,7 +1064,7 @@ dead_link(struct Client *client_p, int sendqex)
if(sendqex)
rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
else
rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno));
snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno));
abt->client = client_p;
SetIOError(client_p);
@ -1196,7 +1196,7 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie
strcat(comment1, source_p->name);
}
if (IsPerson(from))
rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s",
snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from->name, comment);
if(source_p->serv != NULL)
@ -1274,7 +1274,7 @@ exit_local_server(struct Client *client_p, struct Client *source_p, struct Clien
/* Always show source here, so the server notices show
* which side initiated the split -- jilles
*/
rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s",
snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from == source_p ? me.name : from->name, comment);
if (!IsIOError(source_p))
sendto_one(source_p, "SQUIT %s :%s", use_id(source_p),
@ -1824,7 +1824,7 @@ error_exit_client(struct Client *client_p, int error)
if(error == 0)
rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
else
rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error));
snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error));
exit_client(client_p, client_p, &me, errmsg);
}

View File

@ -825,15 +825,15 @@ void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line,
s_assert(dict != NULL);
if (dict->id != NULL)
rb_snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
dict->id, dict->count);
else
rb_snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
(void *)dict, dict->count);
cb(str, privdata);
maxdepth = 0;
sum = stats_recurse(dict->root, 0, &maxdepth);
rb_snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
cb(str, privdata);
return;
}

View File

@ -377,7 +377,7 @@ write_pidfile(const char *filename)
if((fb = fopen(filename, "w"))) {
unsigned int pid = (unsigned int) getpid();
rb_snprintf(buff, sizeof(buff), "%u\n", pid);
snprintf(buff, sizeof(buff), "%u\n", pid);
if((fputs(buff, fb) == -1)) {
ilog(L_MAIN, "Error writing %u to pid file %s (%s)",
pid, filename, strerror(errno));

View File

@ -116,7 +116,7 @@ get_listener_name(const struct Listener *listener)
#endif
port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port);
rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
return buf;
}
@ -484,7 +484,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi
ServerStats.is_ref++;
if(ConfigFileEntry.dline_with_reason) {
len = rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf));
len = snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf));
if (len >= (int)(sizeof(buf)-1)) {
buf[sizeof(buf) - 3] = '\r';
buf[sizeof(buf) - 2] = '\n';

View File

@ -80,7 +80,7 @@ verify_logfile_access(const char *filename)
rb_free(d);
if(access(dirname, F_OK) == -1) {
rb_snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname);
snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname);
if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf);
@ -89,7 +89,7 @@ verify_logfile_access(const char *filename)
if(access(filename, F_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));
if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf);
@ -99,7 +99,7 @@ verify_logfile_access(const char *filename)
}
if(access(filename, W_OK) == -1) {
rb_snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno));
snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno));
if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf);
@ -168,7 +168,7 @@ ilog(ilogfile dest, const char *format, ...)
rb_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
rb_snprintf(buf2, sizeof(buf2), "%s %s\n",
snprintf(buf2, sizeof(buf2), "%s %s\n",
smalldate(rb_current_time()), buf);
if(fputs(buf2, logfile) < 0) {
@ -261,7 +261,7 @@ smalldate(time_t 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_mday, lt->tm_hour, lt->tm_min);

View File

@ -248,7 +248,7 @@ load_all_modules(int warn)
while ((ldirent = readdir(system_module_dir)) != NULL) {
len = strlen(ldirent->d_name);
if((len > 3) && !strcmp(ldirent->d_name+len-3, SHARED_SUFFIX)) {
(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);
}
@ -270,7 +270,7 @@ load_core_modules(int warn)
for (i = 0; core_module_table[i]; i++) {
rb_snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
core_module_table[i], SHARED_SUFFIX);
if(load_a_module(module_name, warn, 1) == -1) {
@ -303,7 +303,7 @@ load_one_module(const char *path, int coremodule)
RB_DLINK_FOREACH(pathst, mod_paths.head) {
mpath = pathst->data;
rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) {
if(stat(modpath, &statbuf) == 0) {
if(S_ISREG(statbuf.st_mode)) {

View File

@ -99,7 +99,7 @@ monitor_signon(struct Client *client_p)
if(monptr == NULL)
return;
rb_snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host);
snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host);
sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf);
}

View File

@ -330,7 +330,7 @@ handle_command(struct Message *mptr, struct Client *client_p,
ilog(L_SERVER,
"Insufficient parameters (%d < %d) for command '%s' from %s.",
i, ehandler.min_para, mptr->cmd, client_p->name);
rb_snprintf(squitreason, sizeof squitreason,
snprintf(squitreason, sizeof squitreason,
"Insufficient parameters (%d < %d) for command '%s'",
i, ehandler.min_para, mptr->cmd);
exit_client(client_p, client_p, client_p, squitreason);

View File

@ -76,7 +76,7 @@ server_reboot(void)
execv(SPATH, (void *)myargv);
/* use this if execv of SPATH fails */
rb_snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath);
snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath);
execv(path, (void *)myargv);
exit(-1);

View File

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

View File

@ -1310,13 +1310,13 @@ get_oper_name(struct Client *client_p)
static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
if(MyOper(client_p)) {
rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
client_p->name, client_p->username,
client_p->host, client_p->localClient->opername);
return buffer;
}
rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
client_p->name, client_p->username,
client_p->host, client_p->servptr->name);
return buffer;
@ -1360,7 +1360,7 @@ get_user_ban_reason(struct ConfItem *aconf)
if (aconf->flags & CONF_FLAGS_TEMPORARY &&
(aconf->status == CONF_KILL || aconf->status == CONF_DLINE))
rb_snprintf(reasonbuf, sizeof reasonbuf,
snprintf(reasonbuf, sizeof reasonbuf,
"Temporary %c-line %d min. - ",
aconf->status == CONF_DLINE ? 'D' : 'K',
(int)((aconf->hold - aconf->created) / 60));
@ -1394,7 +1394,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
if(!IsOper(source_p))
*oper_reason = NULL;
else {
rb_snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)",
snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)",
EmptyString(aconf->spasswd) ? "" : aconf->spasswd,
EmptyString(aconf->spasswd) ? "" : " ",
aconf->info.oper);

View File

@ -471,7 +471,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
int cur_len;
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;
RB_DLINK_FOREACH(ptr, list->head) {
@ -599,8 +599,8 @@ burst_TS6(struct Client *client_p)
continue;
cur_len = mlen = sprintf(buf, ":%s SJOIN %ld %s %s :", me.id,
(long) chptr->channelts, chptr->chname,
channel_modes(chptr, client_p));
(long) chptr->channelts, chptr->chname,
channel_modes(chptr, client_p));
t = buf + mlen;
@ -627,7 +627,7 @@ burst_TS6(struct Client *client_p)
}
sprintf(t, "%s%s ", find_channel_status(msptr, 1),
use_id(msptr->client_p));
use_id(msptr->client_p));
cur_len += tlen;
t += tlen;
@ -839,7 +839,7 @@ server_estab(struct Client *client_p)
hdata.target = client_p;
call_hook(h_server_introduced, &hdata);
rb_snprintf(note, sizeof(note), "Server: %s", client_p->name);
snprintf(note, sizeof(note), "Server: %s", client_p->name);
rb_note(client_p->localClient->F, note);
/*
@ -1107,7 +1107,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
return 0;
}
rb_snprintf(note, sizeof note, "Server: %s", server_p->name);
snprintf(note, sizeof note, "Server: %s", server_p->name);
rb_note(F, note);
/* Create a local client */

View File

@ -295,7 +295,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
add_to_client_hash(source_p->name, source_p);
rb_snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name);
snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name);
rb_note(source_p->localClient->F, note);
}

View File

@ -252,10 +252,10 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
last_spin = rb_current_time();
if(ssld_path == NULL) {
rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) {
rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s",
snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s",
ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) {
ilog(L_MAIN,
@ -279,15 +279,15 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
rb_set_buffers(F1, READBUF_SIZE);
rb_set_buffers(F2, READBUF_SIZE);
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2));
snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2));
rb_setenv("CTL_FD", fdarg, 1);
if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1) {
ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno));
return started;
}
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1));
snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1));
rb_setenv("CTL_PIPE", fdarg, 1);
rb_snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid());
snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid());
rb_setenv("CTL_PPID", s_pid, 1);
#ifdef _WIN32
SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1);
@ -404,7 +404,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
rb_free(client_p->certfp);
certfp_string = rb_malloc(RB_SSL_CERTFP_LEN * 2 + 1);
for(i = 0; i < RB_SSL_CERTFP_LEN; i++)
rb_snprintf(certfp_string + 2 * i, 3, "%02x",
snprintf(certfp_string + 2 * i, 3, "%02x",
certfp[i]);
client_p->certfp = certfp_string;
}
@ -580,7 +580,7 @@ send_new_ssl_certs_one(ssl_ctl_t * ctl, const char *ssl_cert, const char *ssl_pr
len, sizeof(tmpbuf));
return;
}
len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul,
len = snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul,
ssl_private_key, nul, ssl_dh_params, nul);
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
}
@ -608,7 +608,7 @@ send_init_prng(ssl_ctl_t * ctl, prng_seed_t seedtype, const char *path)
return;
}
len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul);
len = snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul);
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
}

View File

@ -190,7 +190,7 @@ const char *
isupport_intptr(const void *ptr)
{
static char buf[15];
rb_snprintf(buf, sizeof buf, "%d", *(const int *)ptr);
snprintf(buf, sizeof buf, "%d", *(const int *)ptr);
return buf;
}
@ -219,7 +219,7 @@ isupport_chanmodes(const void *ptr)
{
static char result[80];
rb_snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s",
snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s",
ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "",
strchr(ConfigChannel.disabledmodes, 'q') ? "" : "q",
@ -240,7 +240,7 @@ isupport_chanlimit(const void *ptr)
{
static char result[30];
rb_snprintf(result, sizeof result, "%s:%i",
snprintf(result, sizeof result, "%s:%i",
ConfigChannel.use_local_channels ? "&#" : "#",
ConfigChannel.max_chans_per_user);
return result;
@ -251,7 +251,7 @@ isupport_prefix(const void *ptr)
{
static char result[13];
rb_snprintf(result, sizeof result, "(%s%so%sv)%s%s@%s+",
snprintf(result, sizeof result, "(%s%so%sv)%s%s@%s+",
ConfigChannel.use_owner ? "y" : "",
ConfigChannel.use_admin ? "a" : "",
ConfigChannel.use_halfop ? "h" : "",
@ -266,7 +266,7 @@ isupport_maxlist(const void *ptr)
{
static char result[30];
rb_snprintf(result, sizeof result, "bq%s%s:%i",
snprintf(result, sizeof result, "bq%s%s:%i",
ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "",
ConfigChannel.max_bans);
@ -278,7 +278,7 @@ isupport_targmax(const void *ptr)
{
static char result[200];
rb_snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:",
snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:",
ConfigFileEntry.max_targets,
ConfigFileEntry.max_targets);
return result;
@ -293,7 +293,7 @@ isupport_extban(const void *ptr)
p = get_extban_string();
if (EmptyString(p))
return NULL;
rb_snprintf(result, sizeof result, "$,%s", p);
snprintf(result, sizeof result, "$,%s", p);
return result;
}
@ -305,7 +305,7 @@ isupport_ownermode(const void *ptr)
if(!ConfigChannel.use_owner)
return NULL;
rb_snprintf(result, sizeof result, "y");
snprintf(result, sizeof result, "y");
return result;
}

View File

@ -758,7 +758,7 @@ process_stats(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb)
if(conn == NULL)
return;
rb_snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata,
snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata,
conn->plain_out, conn->mod_in, conn->plain_in, conn->mod_out);
conn->plain_out = 0;
conn->plain_in = 0;