ircsprintf -> rb_sprintf

This commit is contained in:
William Pitcock 2008-04-01 15:21:53 -05:00
parent 5b96d9a6b9
commit 7cdb0a09b9
26 changed files with 61 additions and 61 deletions

View file

@ -637,7 +637,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_DEL;
}
*mbuf++ = 'k';
len = ircsprintf(pbuf, "%s ", oldmode->key);
len = rb_sprintf(pbuf, "%s ", oldmode->key);
pbuf += len;
}
if(oldmode->join_num && !mode->join_num)
@ -666,7 +666,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'l';
len = ircsprintf(pbuf, "%d ", mode->limit);
len = rb_sprintf(pbuf, "%d ", mode->limit);
pbuf += len;
}
if(mode->key[0] && strcmp(oldmode->key, mode->key))
@ -677,7 +677,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'k';
len = ircsprintf(pbuf, "%s ", mode->key);
len = rb_sprintf(pbuf, "%s ", mode->key);
pbuf += len;
}
if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time))
@ -688,7 +688,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'j';
len = ircsprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
pbuf += len;
}
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && ConfigChannel.use_forward)
@ -699,7 +699,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'f';
len = ircsprintf(pbuf, "%s ", mode->forward);
len = rb_sprintf(pbuf, "%s ", mode->forward);
pbuf += len;
}
*mbuf = '\0';

View file

@ -150,7 +150,7 @@ mo_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
target_p->flags |= FLAGS_KILLED;
}
ircsprintf(buf, "Killed (%s (%s))", source_p->name, reason);
rb_sprintf(buf, "Killed (%s (%s))", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf);
@ -272,7 +272,7 @@ ms_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
/* FLAGS_KILLED prevents a quit being sent out */
target_p->flags |= FLAGS_KILLED;
ircsprintf(buf, "Killed (%s %s)", source_p->name, reason);
rb_sprintf(buf, "Killed (%s %s)", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf);
@ -288,11 +288,11 @@ relay_kill(struct Client *one, struct Client *source_p,
char buffer[BUFSIZE];
if(MyClient(source_p))
ircsnprintf(buffer, sizeof(buffer),
rb_snprintf(buffer, sizeof(buffer),
"%s!%s!%s!%s (%s)",
me.name, source_p->host, source_p->username, source_p->name, reason);
else
ircsnprintf(buffer, sizeof(buffer), "%s %s", inpath, reason);
rb_snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason);
RB_DLINK_FOREACH(ptr, serv_list.head)
{

View file

@ -280,7 +280,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
fakesource_p = &me;
else
fakesource_p = source_p;
mlen = ircsprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
mlen = rb_sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
mbuf = modebuf + mlen;
pbuf = parabuf;
@ -328,7 +328,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
}
*mbuf++ = parv[3][0];
arglen = ircsprintf(pbuf, "%s ", s);
arglen = rb_sprintf(pbuf, "%s ", s);
pbuf += arglen;
plen += arglen;
modecount++;

View file

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

View file

@ -367,14 +367,14 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
else
modes = empty_modes;
mlen_nick = ircsprintf(buf_nick, ":%s SJOIN %ld %s %s :",
mlen_nick = rb_sprintf(buf_nick, ":%s SJOIN %ld %s %s :",
source_p->name, (long) chptr->channelts, parv[2], modes);
ptr_nick = buf_nick + mlen_nick;
/* working on the presumption eventually itll be more efficient to
* build a TS6 buffer without checking its needed..
*/
mlen_uid = ircsprintf(buf_uid, ":%s SJOIN %ld %s %s :",
mlen_uid = rb_sprintf(buf_uid, ":%s SJOIN %ld %s %s :",
use_id(source_p), (long) chptr->channelts, parv[2], modes);
ptr_uid = buf_uid + mlen_uid;
@ -455,10 +455,10 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
}
/* copy the nick to the two buffers */
len = ircsprintf(ptr_nick, "%s ", target_p->name);
len = rb_sprintf(ptr_nick, "%s ", target_p->name);
ptr_nick += len;
len_nick += len;
len = ircsprintf(ptr_uid, "%s ", use_id(target_p));
len = rb_sprintf(ptr_uid, "%s ", use_id(target_p));
ptr_uid += len;
len_uid += len;
@ -651,7 +651,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_DEL;
}
*mbuf++ = 'k';
len = ircsprintf(pbuf, "%s ", oldmode->key);
len = rb_sprintf(pbuf, "%s ", oldmode->key);
pbuf += len;
pargs++;
}
@ -681,7 +681,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'l';
len = ircsprintf(pbuf, "%d ", mode->limit);
len = rb_sprintf(pbuf, "%d ", mode->limit);
pbuf += len;
pargs++;
}
@ -693,7 +693,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'k';
len = ircsprintf(pbuf, "%s ", mode->key);
len = rb_sprintf(pbuf, "%s ", mode->key);
pbuf += len;
pargs++;
}
@ -705,7 +705,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'j';
len = ircsprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
pbuf += len;
pargs++;
}
@ -717,7 +717,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD;
}
*mbuf++ = 'f';
len = ircsprintf(pbuf, "%s ", mode->forward);
len = rb_sprintf(pbuf, "%s ", mode->forward);
pbuf += len;
pargs++;
}
@ -844,7 +844,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
pbuf = lparabuf;
cur_len = mlen = ircsprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
cur_len = mlen = rb_sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
mbuf = lmodebuf + mlen;
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head)
@ -875,7 +875,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
*mbuf++ = c;
cur_len += plen;
pbuf += ircsprintf(pbuf, "%s ", banptr->banstr);
pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr);
count++;
free_ban(banptr);

View file

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

View file

@ -177,7 +177,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
int curlen, mlen;
int i;
mlen = ircsprintf(buf, ":%s CAP %s %s",
mlen = rb_sprintf(buf, ":%s CAP %s %s",
me.name,
EmptyString(source_p->name) ? "*" : source_p->name,
subcmd);
@ -251,7 +251,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
}
}
curlen = ircsprintf(p, "%s ", clicap_list[i].name);
curlen = rb_sprintf(p, "%s ", clicap_list[i].name);
p += curlen;
buflen += curlen;
}
@ -363,7 +363,7 @@ cap_req(struct Client *source_p, const char *arg)
if(EmptyString(arg))
return;
buflen = ircsnprintf(buf, sizeof(buf), ":%s CAP %s ACK",
buflen = rb_snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
me.name, EmptyString(source_p->name) ? "*" : source_p->name);
pbuf[0][0] = '\0';

View file

@ -202,7 +202,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
if(tdline_time > 0)
{
ircsnprintf(dlbuffer, sizeof(dlbuffer),
rb_snprintf(dlbuffer, sizeof(dlbuffer),
"Temporary D-line %d min. - %s (%s)",
(int) (tdline_time / 60), reason, current_date);
DupString(aconf->passwd, dlbuffer);
@ -235,7 +235,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
}
else
{
ircsnprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date);
rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date);
DupString(aconf->passwd, dlbuffer);
add_conf_by_address(aconf->host, CONF_DLINE, NULL, aconf);
write_confitem(DLINE_TYPE, source_p, NULL, aconf->host, reason,
@ -262,7 +262,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
int pairme = NO, error_on_write = NO;
mode_t oldumask;
ircsnprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile);
if(!IsOperUnkline(source_p))
{

View file

@ -82,7 +82,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;
ircsnprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
cur_len += len;
ptr += len;
}
@ -91,9 +91,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)
ircsnprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
else
ircsnprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]);
rb_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

@ -559,7 +559,7 @@ set_local_gline(struct Client *source_p, const char *user,
DupString(aconf->spasswd, oper_reason);
}
ircsnprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->passwd, buffer);
DupString(aconf->user, user);

View file

@ -77,7 +77,7 @@ m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *p
current_insert_point2 = buf2;
*buf2 = '\0';
ircsprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
rb_sprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
len = strlen(buf);
current_insert_point = buf + len;

View file

@ -197,7 +197,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
if(tkline_time > 0)
{
ircsnprintf(buffer, sizeof(buffer),
rb_snprintf(buffer, sizeof(buffer),
"Temporary K-line %d min. - %s (%s)",
(int) (tkline_time / 60), reason, current_date);
DupString(aconf->passwd, buffer);
@ -205,7 +205,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
}
else
{
ircsnprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->passwd, buffer);
apply_kline(source_p, aconf, reason, oper_reason, current_date);
}
@ -313,7 +313,7 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
if(tkline_time > 0)
{
ircsnprintf(buffer, sizeof(buffer),
rb_snprintf(buffer, sizeof(buffer),
"Temporary K-line %d min. - %s (%s)",
(int) (tkline_time / 60), reason, current_date);
DupString(aconf->passwd, buffer);
@ -321,7 +321,7 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
}
else
{
ircsnprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
DupString(aconf->passwd, buffer);
apply_kline(source_p, aconf, reason, oper_reason, current_date);
}
@ -768,7 +768,7 @@ remove_permkline_match(struct Client *source_p, struct ConfItem *aconf)
host = aconf->host;
user = aconf->user;
ircsnprintf(temppath, sizeof(temppath),
rb_snprintf(temppath, sizeof(temppath),
"%s.tmp", ConfigFileEntry.klinefile);
filename = get_conf_name(KLINE_TYPE);

View file

@ -110,7 +110,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
}
}
ircsnprintf(buf + USER_COL, BUFSIZE - USER_COL,
rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&root_p->serv->users),
100 * (float) rb_dlink_list_length(&root_p->serv->users) / (float) Count.total);

View file

@ -140,7 +140,7 @@ names_global(struct Client *source_p)
chptr = ptr->data;
channel_member_names(chptr, source_p, 0);
}
cur_len = mlen = ircsprintf(buf, form_str(RPL_NAMREPLY),
cur_len = mlen = rb_sprintf(buf, form_str(RPL_NAMREPLY),
me.name, source_p->name, "*", "*");
t = buf + mlen;
@ -183,7 +183,7 @@ names_global(struct Client *source_p)
t = buf + mlen;
}
tlen = ircsprintf(t, "%s ", target_p->name);
tlen = rb_sprintf(t, "%s ", target_p->name);
cur_len += tlen;
t += tlen;
}

View file

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

View file

@ -94,7 +94,7 @@ mo_restart(struct Client *client_p, struct Client *source_p, int parc, const cha
me.name, get_client_name(source_p, HIDE_IP));
}
ircsprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
rb_sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
restart(buf);
return 0;

View file

@ -544,7 +544,7 @@ remove_resv_from_file(struct Client *source_p, const char *name)
int error_on_write = 0;
int found_resv = 0;
ircsprintf(temppath, "%s.tmp", ConfigFileEntry.resvfile);
rb_sprintf(temppath, "%s.tmp", ConfigFileEntry.resvfile);
filename = get_conf_name(RESV_TYPE);
if((in = fopen(filename, "r")) == NULL)

View file

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

View file

@ -163,7 +163,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
if(aconf->status & CONF_KILL)
{
ircsnprintf(buf, sizeof(buf), "%s@%s",
rb_snprintf(buf, sizeof(buf), "%s@%s",
aconf->user, aconf->host);
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name,
@ -175,7 +175,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
}
else if(aconf->status & CONF_GLINE)
{
ircsnprintf(buf, sizeof(buf), "%s@%s",
rb_snprintf(buf, sizeof(buf), "%s@%s",
aconf->user, aconf->host);
sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name,

View file

@ -111,7 +111,7 @@ date(void)
if(minswest < 0)
minswest = -minswest;
ircsprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
rb_sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec,
plus, minswest / 60, minswest % 60);

View file

@ -102,7 +102,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr))
{
char topic_info[USERHOST_REPLYLEN];
ircsprintf(topic_info, "%s!%s@%s",
rb_sprintf(topic_info, "%s!%s@%s",
source_p->name, source_p->username, source_p->host);
set_channel_topic(chptr, parv[2], topic_info, CurrentTime);

View file

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

View file

@ -64,7 +64,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
int cur_len;
int rl;
cur_len = ircsprintf(buf, form_str(RPL_USERHOST), me.name, parv[0], "");
cur_len = rb_sprintf(buf, form_str(RPL_USERHOST), me.name, parv[0], "");
t = buf + cur_len;
for (i = 1; i <= 5; i++)
@ -82,7 +82,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
*/
if(MyClient(target_p) && (target_p == source_p))
{
rl = ircsprintf(response, "%s%s=%c%s@%s ",
rl = rb_sprintf(response, "%s%s=%c%s@%s ",
target_p->name,
IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+',
@ -91,7 +91,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
}
else
{
rl = ircsprintf(response, "%s%s=%c%s@%s ",
rl = rb_sprintf(response, "%s%s=%c%s@%s ",
target_p->name,
IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+',
@ -100,7 +100,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
if((rl + cur_len) < (BUFSIZE - 10))
{
ircsprintf(t, "%s", response);
rb_sprintf(t, "%s", response);
t += rl;
cur_len += rl;
}

View file

@ -379,7 +379,7 @@ do_who(struct Client *source_p, struct Client *target_p, const char *chname, con
{
char status[5];
ircsprintf(status, "%c%s%s",
rb_sprintf(status, "%c%s%s",
target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", op_flags);
sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name,

View file

@ -258,7 +258,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
target_p->name, target_p->username,
target_p->host, target_p->info);
cur_len = mlen = ircsprintf(buf, form_str(RPL_WHOISCHANNELS),
cur_len = mlen = rb_sprintf(buf, form_str(RPL_WHOISCHANNELS),
get_id(&me, source_p), get_id(source_p, source_p),
target_p->name);
@ -295,7 +295,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
t = buf + mlen;
}
tlen = ircsprintf(t, "%s%s%s ",
tlen = rb_sprintf(t, "%s%s%s ",
visible ? "" : "!",
find_channel_status(msptr, 1),
chptr->chname);

View file

@ -373,7 +373,7 @@ write_xline(struct Client *source_p, struct ConfItem *aconf)
return;
}
ircsprintf(buffer, "\"%s\",\"0\",\"%s\",\"%s\",%ld\n",
rb_sprintf(buffer, "\"%s\",\"0\",\"%s\",\"%s\",%ld\n",
aconf->name, aconf->passwd,
get_oper_name(source_p), CurrentTime);
@ -593,7 +593,7 @@ remove_xline_from_file(struct Client *source_p, const char *huntgecos)
int found_xline = 0;
filename = ConfigFileEntry.xlinefile;
ircsnprintf(temppath, sizeof(temppath),
rb_snprintf(temppath, sizeof(temppath),
"%s.tmp", ConfigFileEntry.xlinefile);
if((in = fopen(filename, "r")) == NULL)