Compare commits
3 Commits
elemental-
...
armageddon
Author | SHA1 | Date |
---|---|---|
Sam Dodrill | a99df1c02c | |
Sam Dodrill | 1ac5b0570e | |
Sam Dodrill | 63a50eaabc |
4
NEWS
4
NEWS
|
@ -1,10 +1,6 @@
|
|||
This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd team.
|
||||
See LICENSE for licensing details (GPL v2).
|
||||
|
||||
-- elemental-ircd 6.6.2
|
||||
|
||||
Fix ban logic
|
||||
|
||||
-- elemental-ircd 6.6.1
|
||||
|
||||
All code is now in the linux kernel coding style. Patches that do not
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ mlog(const char *errstr, ...)
|
|||
char buf[256];
|
||||
va_list ap;
|
||||
va_start(ap, errstr);
|
||||
rb_vsnprintf(buf, sizeof(buf), errstr, ap);
|
||||
vsnprintf(buf, sizeof(buf), errstr, ap);
|
||||
va_end(ap);
|
||||
error_cb(buf);
|
||||
} else
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for elemental-ircd 6.6.2.
|
||||
# Generated by GNU Autoconf 2.69 for elemental-ircd 6.6.1.
|
||||
#
|
||||
# 2014 elemental-ircd Team
|
||||
#
|
||||
|
@ -579,8 +579,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='elemental-ircd'
|
||||
PACKAGE_TARNAME='elemental-ircd'
|
||||
PACKAGE_VERSION='6.6.2'
|
||||
PACKAGE_STRING='elemental-ircd 6.6.2'
|
||||
PACKAGE_VERSION='6.6.1'
|
||||
PACKAGE_STRING='elemental-ircd 6.6.1'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures elemental-ircd 6.6.2 to adapt to many kinds of systems.
|
||||
\`configure' configures elemental-ircd 6.6.1 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1364,7 +1364,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of elemental-ircd 6.6.2:";;
|
||||
short | recursive ) echo "Configuration of elemental-ircd 6.6.1:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1488,7 +1488,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
elemental-ircd configure 6.6.2
|
||||
elemental-ircd configure 6.6.1
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
|
@ -2092,7 +2092,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by elemental-ircd $as_me 6.6.2, which was
|
||||
It was created by elemental-ircd $as_me 6.6.1, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -10100,7 +10100,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by elemental-ircd $as_me 6.6.2, which was
|
||||
This file was extended by elemental-ircd $as_me 6.6.1, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -10166,7 +10166,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
elemental-ircd config.status 6.6.2
|
||||
elemental-ircd config.status 6.6.1
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ AC_PREREQ(2.57)
|
|||
dnl Sneaky way to get an Id tag into the configure script
|
||||
AC_COPYRIGHT([2014 elemental-ircd Team])
|
||||
|
||||
AC_INIT([elemental-ircd],[6.6.2])
|
||||
AC_INIT([elemental-ircd],[6.6.1])
|
||||
|
||||
AC_CONFIG_HEADER(include/setup.h)
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -38,26 +38,9 @@
|
|||
/*
|
||||
* 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);
|
||||
int sprintf_append(char *str, const char *format, ...);
|
||||
int snprintf_append(char *str, const size_t size, const char *, ...);
|
||||
int vsnprintf_append(char *str, const size_t size, const char *fmt, va_list args);
|
||||
int vsprintf_append(char *str, const char *fmt, va_list args);
|
||||
|
||||
#endif /* SPRINTF_IRC */
|
||||
|
|
|
@ -1134,7 +1134,7 @@ inetntoa(const char *in)
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#define SPRINTF(x) ((size_t)rb_sprintf x)
|
||||
#define SPRINTF(x) ((size_t)sprintf x)
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
|
@ -1513,7 +1513,7 @@ rb_inet_pton(int af, const char *src, void *dst)
|
|||
/* Somebody might have passed as an IPv4 address this is sick but it works */
|
||||
if(inet_pton4(src, dst)) {
|
||||
char tmp[HOSTIPLEN];
|
||||
rb_sprintf(tmp, "::ffff:%s", src);
|
||||
sprintf(tmp, "::ffff:%s", src);
|
||||
return (inet_pton6(tmp, dst));
|
||||
} else
|
||||
return (inet_pton6(src, dst));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -506,12 +506,12 @@ rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args,
|
|||
|
||||
if(prefixfmt != NULL) {
|
||||
va_start(prefix_args, prefixfmt);
|
||||
len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args);
|
||||
len = vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args);
|
||||
va_end(prefix_args);
|
||||
}
|
||||
|
||||
if(va_args != NULL) {
|
||||
len += rb_vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args);
|
||||
len += vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args);
|
||||
}
|
||||
|
||||
bufline->terminated = 1;
|
||||
|
@ -608,7 +608,7 @@ rb_linebuf_put(buf_head_t * bufhead, const char *format, ...)
|
|||
|
||||
if(rb_unlikely(format != NULL)) {
|
||||
va_start(args, format);
|
||||
len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args);
|
||||
len = vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
@ -131,7 +131,7 @@ rb_lib_log(const char *format, ...)
|
|||
if(rb_log == NULL)
|
||||
return;
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
va_end(args);
|
||||
rb_log(errbuf);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ rb_lib_die(const char *format, ...)
|
|||
if(rb_die == NULL)
|
||||
abort();
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
va_end(args);
|
||||
rb_die(errbuf);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ rb_lib_restart(const char *format, ...)
|
|||
if(rb_restart == NULL)
|
||||
abort();
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
vsnprintf(errbuf, sizeof(errbuf), format, args);
|
||||
va_end(args);
|
||||
rb_restart(errbuf);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,606 +26,43 @@
|
|||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
||||
static int
|
||||
skip_atoi(const char **s)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while(isdigit(**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(*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(*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) {
|
||||
abort(); /* prefer blowing up vs corrupt data */
|
||||
}
|
||||
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;
|
||||
}
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* rb_vsprintf_append()
|
||||
* vsprintf_append()
|
||||
* appends sprintf formatted string to the end of the buffer
|
||||
*/
|
||||
|
||||
int
|
||||
rb_vsprintf_append(char *str, const char *format, va_list ap)
|
||||
vsprintf_append(char *str, const char *format, va_list ap)
|
||||
{
|
||||
size_t x = strlen(str);
|
||||
return (rb_vsprintf(str + x, format, ap) + x);
|
||||
return (vsprintf(str + x, format, ap) + x);
|
||||
}
|
||||
|
||||
/*
|
||||
* rb_sprintf_append()
|
||||
* sprintf_append()
|
||||
* appends sprintf formatted string to the end of the buffer
|
||||
*/
|
||||
int
|
||||
rb_sprintf_append(char *str, const char *format, ...)
|
||||
sprintf_append(char *str, const char *format, ...)
|
||||
{
|
||||
int x;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
x = rb_vsprintf_append(str, format, ap);
|
||||
x = vsprintf_append(str, format, ap);
|
||||
va_end(ap);
|
||||
return (x);
|
||||
}
|
||||
|
||||
/*
|
||||
* rb_vsnprintf_append()
|
||||
* 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)
|
||||
vsnprintf_append(char *str, size_t len, const char *format, va_list ap)
|
||||
{
|
||||
size_t x;
|
||||
if(len == 0)
|
||||
|
@ -636,22 +73,22 @@ rb_vsnprintf_append(char *str, size_t len, const char *format, va_list ap)
|
|||
str[len - 1] = '\0';
|
||||
return len - 1;
|
||||
}
|
||||
return (rb_vsnprintf(str + x, len - x, format, ap) + x);
|
||||
return (vsnprintf(str + x, len - x, format, ap) + x);
|
||||
}
|
||||
|
||||
/*
|
||||
* rb_snprintf_append()
|
||||
* 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, ...)
|
||||
nprintf_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);
|
||||
x = vsnprintf_append(str, len, format, ap);
|
||||
va_end(ap);
|
||||
return (x);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -494,7 +494,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
else
|
||||
modes = empty_modes;
|
||||
|
||||
mlen_uid = rb_sprintf(buf_uid, ":%s SJOIN %ld %s %s :",
|
||||
mlen_uid = sprintf(buf_uid, ":%s SJOIN %ld %s %s :",
|
||||
use_id(source_p), (long) chptr->channelts, parv[2], modes);
|
||||
ptr_uid = buf_uid + mlen_uid;
|
||||
|
||||
|
@ -579,7 +579,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
}
|
||||
|
||||
/* copy the nick to the two buffers */
|
||||
len = rb_sprintf(ptr_uid, "%s ", use_id(target_p));
|
||||
len = sprintf(ptr_uid, "%s ", use_id(target_p));
|
||||
ptr_uid += len;
|
||||
len_uid += len;
|
||||
|
||||
|
@ -937,7 +937,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
dir = MODE_DEL;
|
||||
}
|
||||
*mbuf++ = 'k';
|
||||
len = rb_sprintf(pbuf, "%s ", oldmode->key);
|
||||
len = sprintf(pbuf, "%s ", oldmode->key);
|
||||
pbuf += len;
|
||||
}
|
||||
if(oldmode->join_num && !mode->join_num) {
|
||||
|
@ -960,7 +960,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
dir = MODE_ADD;
|
||||
}
|
||||
*mbuf++ = 'l';
|
||||
len = rb_sprintf(pbuf, "%d ", mode->limit);
|
||||
len = sprintf(pbuf, "%d ", mode->limit);
|
||||
pbuf += len;
|
||||
}
|
||||
if(mode->key[0] && strcmp(oldmode->key, mode->key)) {
|
||||
|
@ -969,7 +969,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
dir = MODE_ADD;
|
||||
}
|
||||
*mbuf++ = 'k';
|
||||
len = rb_sprintf(pbuf, "%s ", mode->key);
|
||||
len = sprintf(pbuf, "%s ", mode->key);
|
||||
pbuf += len;
|
||||
}
|
||||
if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time)) {
|
||||
|
@ -978,7 +978,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
dir = MODE_ADD;
|
||||
}
|
||||
*mbuf++ = 'j';
|
||||
len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
|
||||
len = sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
|
||||
pbuf += len;
|
||||
}
|
||||
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && ConfigChannel.use_forward) {
|
||||
|
@ -987,7 +987,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
dir = MODE_ADD;
|
||||
}
|
||||
*mbuf++ = 'f';
|
||||
len = rb_sprintf(pbuf, "%s ", mode->forward);
|
||||
len = sprintf(pbuf, "%s ", mode->forward);
|
||||
pbuf += len;
|
||||
}
|
||||
*mbuf = '\0';
|
||||
|
@ -1393,7 +1393,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
|||
|
||||
pbuf = lparabuf;
|
||||
|
||||
cur_len = mlen = rb_sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
|
||||
cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
|
||||
mbuf = lmodebuf + mlen;
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) {
|
||||
|
@ -1417,7 +1417,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
|||
|
||||
*mbuf++ = c;
|
||||
cur_len += plen;
|
||||
pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr);
|
||||
pbuf += sprintf(pbuf, "%s ", banptr->banstr);
|
||||
count++;
|
||||
|
||||
free_ban(banptr);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -140,7 +140,7 @@ mo_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
target_p->flags |= FLAGS_KILLED;
|
||||
}
|
||||
|
||||
rb_sprintf(buf, "Killed (%s (%s))", source_p->name, reason);
|
||||
sprintf(buf, "Killed (%s (%s))", source_p->name, reason);
|
||||
|
||||
exit_client(client_p, target_p, source_p, buf);
|
||||
|
||||
|
@ -247,7 +247,7 @@ ms_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
/* FLAGS_KILLED prevents a quit being sent out */
|
||||
target_p->flags |= FLAGS_KILLED;
|
||||
|
||||
rb_sprintf(buf, "Killed (%s %s)", source_p->name, reason);
|
||||
sprintf(buf, "Killed (%s %s)", source_p->name, reason);
|
||||
|
||||
exit_client(client_p, target_p, source_p, buf);
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -293,7 +293,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
fakesource_p = &me;
|
||||
else
|
||||
fakesource_p = source_p;
|
||||
mlen = rb_sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
|
||||
mlen = sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
|
||||
mbuf = modebuf + mlen;
|
||||
pbuf = parabuf;
|
||||
|
||||
|
@ -337,7 +337,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
}
|
||||
|
||||
*mbuf++ = parv[3][0];
|
||||
arglen = rb_sprintf(pbuf, "%s ", s);
|
||||
arglen = sprintf(pbuf, "%s ", s);
|
||||
pbuf += arglen;
|
||||
plen += arglen;
|
||||
modecount++;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
|
|||
int curlen, mlen;
|
||||
size_t i;
|
||||
|
||||
mlen = rb_sprintf(buf, ":%s CAP %s %s",
|
||||
mlen = sprintf(buf, ":%s CAP %s %s",
|
||||
me.name,
|
||||
EmptyString(source_p->name) ? "*" : source_p->name,
|
||||
subcmd);
|
||||
|
@ -237,7 +237,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
|
|||
}
|
||||
}
|
||||
|
||||
curlen = rb_sprintf(p, "%s ", clicap_list[i].name);
|
||||
curlen = sprintf(p, "%s ", clicap_list[i].name);
|
||||
p += curlen;
|
||||
buflen += curlen;
|
||||
}
|
||||
|
@ -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';
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -75,7 +75,7 @@ m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
|||
current_insert_point2 = buf2;
|
||||
*buf2 = '\0';
|
||||
|
||||
rb_sprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
|
||||
sprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
|
||||
len = strlen(buf);
|
||||
current_insert_point = buf + len;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -128,7 +128,7 @@ names_global(struct Client *source_p)
|
|||
chptr = ptr->data;
|
||||
channel_member_names(chptr, source_p, 0);
|
||||
}
|
||||
cur_len = mlen = rb_sprintf(buf, form_str(RPL_NAMREPLY),
|
||||
cur_len = mlen = sprintf(buf, form_str(RPL_NAMREPLY),
|
||||
me.name, source_p->name, "*", "*");
|
||||
t = buf + mlen;
|
||||
|
||||
|
@ -167,7 +167,7 @@ names_global(struct Client *source_p)
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
tlen = rb_sprintf(t, "%s ", target_p->name);
|
||||
tlen = sprintf(t, "%s ", target_p->name);
|
||||
cur_len += tlen;
|
||||
t += tlen;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -123,7 +123,7 @@ do_restart(struct Client *source_p, const char *servername)
|
|||
me.name, get_client_name(source_p, HIDE_IP));
|
||||
}
|
||||
|
||||
rb_sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
|
||||
sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
|
||||
restart(buf);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -108,7 +108,7 @@ date(void)
|
|||
if(minswest < 0)
|
||||
minswest = -minswest;
|
||||
|
||||
rb_sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
|
||||
sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
|
||||
weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
|
||||
lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec,
|
||||
plus, minswest / 60, minswest % 60);
|
||||
|
|
|
@ -135,7 +135,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
}
|
||||
|
||||
if(ConfigChannel.host_in_topic)
|
||||
rb_sprintf(topic_info, "%s!%s@%s",
|
||||
sprintf(topic_info, "%s!%s@%s",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
else
|
||||
rb_strlcpy(topic_info, source_p->name, sizeof(topic_info));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
|
|||
int cur_len;
|
||||
int rl;
|
||||
|
||||
cur_len = rb_sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, "");
|
||||
cur_len = sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, "");
|
||||
t = buf + cur_len;
|
||||
|
||||
for (i = 1; i <= 5; i++) {
|
||||
|
@ -77,14 +77,14 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
|
|||
* is. Useful for things like NAT, and dynamic dial-up users.
|
||||
*/
|
||||
if(MyClient(target_p) && (target_p == source_p)) {
|
||||
rl = rb_sprintf(response, "%s%s=%c%s@%s ",
|
||||
rl = sprintf(response, "%s%s=%c%s@%s ",
|
||||
target_p->name,
|
||||
IsOper(target_p) ? "*" : "",
|
||||
(target_p->user->away) ? '-' : '+',
|
||||
target_p->username,
|
||||
target_p->sockhost);
|
||||
} else {
|
||||
rl = rb_sprintf(response, "%s%s=%c%s@%s ",
|
||||
rl = sprintf(response, "%s%s=%c%s@%s ",
|
||||
target_p->name,
|
||||
IsOper(target_p) ? "*" : "",
|
||||
(target_p->user->away) ? '-' : '+',
|
||||
|
@ -92,7 +92,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
|
|||
}
|
||||
|
||||
if((rl + cur_len) < (BUFSIZE - 10)) {
|
||||
rb_sprintf(t, "%s", response);
|
||||
sprintf(t, "%s", response);
|
||||
t += rl;
|
||||
cur_len += rl;
|
||||
} else
|
||||
|
|
|
@ -441,7 +441,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
|
|||
|
||||
max = *pos >= bufsize ? 0 : bufsize - *pos;
|
||||
va_start(ap, fmt);
|
||||
result = rb_vsnprintf(buf + *pos, max, fmt, ap);
|
||||
result = vsnprintf(buf + *pos, max, fmt, ap);
|
||||
va_end(ap);
|
||||
*pos += result;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
|
|||
size_t pos;
|
||||
const char *q;
|
||||
|
||||
rb_sprintf(status, "%c%s%s",
|
||||
sprintf(status, "%c%s%s",
|
||||
target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : "");
|
||||
|
||||
if (fmt->fields == 0)
|
||||
|
|
|
@ -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);
|
||||
|
@ -244,7 +244,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
|
|||
target_p->name, target_p->username,
|
||||
target_p->host, target_p->info);
|
||||
|
||||
cur_len = mlen = rb_sprintf(buf, form_str(RPL_WHOISCHANNELS),
|
||||
cur_len = mlen = sprintf(buf, form_str(RPL_WHOISCHANNELS),
|
||||
get_id(&me, source_p), get_id(source_p, source_p),
|
||||
target_p->name);
|
||||
|
||||
|
@ -276,7 +276,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
tlen = rb_sprintf(t, "%s%s%s ",
|
||||
tlen = sprintf(t, "%s%s%s ",
|
||||
visible ? "" : "*",
|
||||
find_channel_status(msptr, 1),
|
||||
chptr->chname);
|
||||
|
|
18
src/bandbi.c
18
src/bandbi.c
|
@ -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,16 +122,16 @@ 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);
|
||||
snprintf_append(buf, sizeof(buf), "%s ", mask2);
|
||||
|
||||
rb_snprintf_append(buf, sizeof(buf), "%s %ld %d :%s",
|
||||
snprintf_append(buf, sizeof(buf), "%s %ld %d :%s",
|
||||
get_oper_name(source_p), (long int)rb_current_time(), perm, reason);
|
||||
|
||||
if(!EmptyString(oper_reason))
|
||||
rb_snprintf_append(buf, sizeof(buf), "|%s", oper_reason);
|
||||
snprintf_append(buf, sizeof(buf), "|%s", oper_reason);
|
||||
|
||||
rb_helper_write(bandb_helper, "%s", buf);
|
||||
}
|
||||
|
@ -150,10 +150,10 @@ bandb_del(bandb_type type, const char *mask1, const char *mask2)
|
|||
|
||||
buf[0] = '\0';
|
||||
|
||||
rb_snprintf_append(buf, sizeof(buf), "%c %s", bandb_del_letter[type], mask1);
|
||||
snprintf_append(buf, sizeof(buf), "%c %s", bandb_del_letter[type], mask1);
|
||||
|
||||
if(!EmptyString(mask2))
|
||||
rb_snprintf_append(buf, sizeof(buf), " %s", mask2);
|
||||
snprintf_append(buf, sizeof(buf), " %s", mask2);
|
||||
|
||||
rb_helper_write(bandb_helper, "%s", buf);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -565,7 +565,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
|
|||
if(ShowChannel(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,
|
||||
channel_pub_or_secret(chptr), chptr->chname);
|
||||
|
||||
|
@ -586,7 +586,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
|
|||
t = lbuf + mlen;
|
||||
}
|
||||
|
||||
tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack),
|
||||
tlen = sprintf(t, "%s%s ", find_channel_status(msptr, stack),
|
||||
target_p->name);
|
||||
|
||||
cur_len += tlen;
|
||||
|
@ -648,8 +648,8 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
|
|||
|
||||
/* if the buffers havent been built, do it here */
|
||||
if(s == NULL) {
|
||||
rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
|
||||
rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
|
||||
sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
|
||||
sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
|
||||
|
||||
s = src_host;
|
||||
s2 = src_iphost;
|
||||
|
@ -657,13 +657,13 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
|
|||
if(who->localClient->mangledhost != NULL) {
|
||||
/* if host mangling mode enabled, also check their real host */
|
||||
if(!strcmp(who->host, who->localClient->mangledhost)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
|
||||
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
|
||||
s3 = src_althost;
|
||||
}
|
||||
/* if host mangling mode not enabled and no other spoof,
|
||||
* also check the mangled form of their host */
|
||||
else if (!IsDynSpoof(who)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
|
||||
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
|
||||
s3 = src_althost;
|
||||
}
|
||||
}
|
||||
|
@ -741,8 +741,8 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
|
|||
|
||||
/* if the buffers havent been built, do it here */
|
||||
if(s == NULL) {
|
||||
rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
|
||||
rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
|
||||
sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
|
||||
sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
|
||||
|
||||
s = src_host;
|
||||
s2 = src_iphost;
|
||||
|
@ -750,13 +750,13 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
|
|||
if(who->localClient->mangledhost != NULL) {
|
||||
/* if host mangling mode enabled, also check their real host */
|
||||
if(!strcmp(who->host, who->localClient->mangledhost)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
|
||||
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
|
||||
s3 = src_althost;
|
||||
}
|
||||
/* if host mangling mode not enabled and no other spoof,
|
||||
* also check the mangled form of their host */
|
||||
else if (!IsDynSpoof(who)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
|
||||
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
|
||||
s3 = src_althost;
|
||||
}
|
||||
}
|
||||
|
@ -834,18 +834,18 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
|||
|
||||
s_assert(source_p->localClient != NULL);
|
||||
|
||||
rb_sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
|
||||
rb_sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost);
|
||||
sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
|
||||
sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost);
|
||||
if(source_p->localClient->mangledhost != NULL) {
|
||||
/* if host mangling mode enabled, also check their real host */
|
||||
if(!strcmp(source_p->host, source_p->localClient->mangledhost)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost);
|
||||
sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost);
|
||||
use_althost = 1;
|
||||
}
|
||||
/* if host mangling mode not enabled and no other spoof,
|
||||
* also check the mangled form of their host */
|
||||
else if (!IsDynSpoof(source_p)) {
|
||||
rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost);
|
||||
sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost);
|
||||
use_althost = 1;
|
||||
}
|
||||
}
|
||||
|
@ -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()))
|
||||
|
@ -1036,8 +1036,8 @@ find_bannickchange_channel(struct Client *client_p)
|
|||
if (!MyClient(client_p) || IsOverride(client_p))
|
||||
return NULL;
|
||||
|
||||
rb_sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host);
|
||||
rb_sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost);
|
||||
sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host);
|
||||
sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost);
|
||||
|
||||
RB_DLINK_FOREACH(ptr, client_p->user->channel.head) {
|
||||
msptr = ptr->data;
|
||||
|
@ -1289,21 +1289,21 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
|
|||
*mbuf++ = 'l';
|
||||
|
||||
if(!IsClient(client_p) || IsMember(client_p, chptr))
|
||||
pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit);
|
||||
pbuf += sprintf(pbuf, " %d", chptr->mode.limit);
|
||||
}
|
||||
|
||||
if(*chptr->mode.key) {
|
||||
*mbuf++ = 'k';
|
||||
|
||||
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
|
||||
pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key);
|
||||
pbuf += sprintf(pbuf, " %s", chptr->mode.key);
|
||||
}
|
||||
|
||||
if(chptr->mode.join_num) {
|
||||
*mbuf++ = 'j';
|
||||
|
||||
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
|
||||
pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num,
|
||||
pbuf += sprintf(pbuf, " %d:%d", chptr->mode.join_num,
|
||||
chptr->mode.join_time);
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
|
|||
*mbuf++ = 'f';
|
||||
|
||||
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
|
||||
pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward);
|
||||
pbuf += sprintf(pbuf, " %s", chptr->mode.forward);
|
||||
}
|
||||
|
||||
*mbuf = '\0';
|
||||
|
@ -1453,7 +1453,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
|
|||
cap = chcap_combos[j].cap_yes;
|
||||
nocap = chcap_combos[j].cap_no;
|
||||
|
||||
mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ",
|
||||
mbl = preflen = sprintf(modebuf, ":%s TMODE %ld %s ",
|
||||
use_id(source_p), (long) chptr->channelts,
|
||||
chptr->chname);
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
|
|||
nc++;
|
||||
|
||||
if(arg != NULL) {
|
||||
len = rb_sprintf(pbuf, "%s ", arg);
|
||||
len = sprintf(pbuf, "%s ", arg);
|
||||
pbuf += len;
|
||||
pbl += len;
|
||||
mc++;
|
||||
|
|
22
src/chmode.c
22
src/chmode.c
|
@ -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" : "",
|
||||
|
@ -219,7 +219,7 @@ get_channel_access(struct Client *source_p, struct membership *msptr)
|
|||
/* check_bans_number()
|
||||
*
|
||||
* inputs - client, channel ban list
|
||||
* outputs - 1 on ban being allowed, 0 on ban being disallowed
|
||||
* outputs - 0 on ban being allowed, 1 on ban being disallowed
|
||||
* side effects - none
|
||||
*/
|
||||
int
|
||||
|
@ -227,10 +227,10 @@ check_bans_number(struct Client *source_p, struct Channel *chptr, rb_dlink_list
|
|||
{
|
||||
if (rb_dlink_list_length(list) >= (chptr->mode.mode & MODE_EXLIMIT ?
|
||||
ConfigChannel.max_bans_large : ConfigChannel.max_bans)) {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* add_id()
|
||||
|
@ -277,7 +277,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
|
|||
|
||||
|
||||
if(IsPerson(source_p))
|
||||
rb_sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
|
||||
sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
|
||||
else
|
||||
rb_strlcpy(who, source_p->name, sizeof(who));
|
||||
|
||||
|
@ -383,7 +383,7 @@ pretty_mask(const char *idmask)
|
|||
old_mask_pos = mask_pos;
|
||||
|
||||
if (*mask == '$') {
|
||||
mask_pos += rb_sprintf(mask_buf + mask_pos, "%s", mask) + 1;
|
||||
mask_pos += sprintf(mask_buf + mask_pos, "%s", mask) + 1;
|
||||
t = mask_buf + old_mask_pos + 1;
|
||||
if (*t == '!')
|
||||
*t = '~';
|
||||
|
@ -440,7 +440,7 @@ pretty_mask(const char *idmask)
|
|||
host[HOSTLEN] = '\0';
|
||||
}
|
||||
|
||||
mask_pos += rb_sprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1;
|
||||
mask_pos += sprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1;
|
||||
|
||||
/* restore mask, since we may need to use it again later */
|
||||
if(at)
|
||||
|
@ -1462,7 +1462,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
|||
if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0)
|
||||
return;
|
||||
|
||||
rb_sprintf(limitstr, "%d", limit);
|
||||
sprintf(limitstr, "%d", limit);
|
||||
|
||||
mode_changes[mode_count].letter = c;
|
||||
mode_changes[mode_count].dir = MODE_ADD;
|
||||
|
@ -2102,9 +2102,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
|||
return;
|
||||
|
||||
if(IsServer(source_p))
|
||||
rb_sprintf(cmdbuf, ":%s MODE %s ", fakesource_p->name, chptr->chname);
|
||||
sprintf(cmdbuf, ":%s MODE %s ", fakesource_p->name, chptr->chname);
|
||||
else
|
||||
rb_sprintf(cmdbuf, ":%s!%s@%s MODE %s ",
|
||||
sprintf(cmdbuf, ":%s!%s@%s MODE %s ",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, chptr->chname);
|
||||
|
||||
|
@ -2186,7 +2186,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
|||
|
||||
if(mode_changes[i].arg != NULL) {
|
||||
paracount++;
|
||||
len = rb_sprintf(pbuf, "%s ", mode_changes[i].arg);
|
||||
len = sprintf(pbuf, "%s ", mode_changes[i].arg);
|
||||
pbuf += len;
|
||||
paralen += len;
|
||||
}
|
||||
|
|
22
src/client.c
22
src/client.c
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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';
|
||||
|
|
18
src/logger.c
18
src/logger.c
|
@ -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);
|
||||
|
@ -165,10 +165,10 @@ ilog(ilogfile dest, const char *format, ...)
|
|||
return;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buf, sizeof(buf), format, args);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
|
||||
rb_snprintf(buf2, sizeof(buf2), "%s %s\n",
|
||||
snprintf(buf2, sizeof(buf2), "%s %s\n",
|
||||
smalldate(rb_current_time()), buf);
|
||||
|
||||
if(fputs(buf2, logfile) < 0) {
|
||||
|
@ -196,7 +196,7 @@ inotice(const char *format, ...)
|
|||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buf, sizeof(buf), format, args);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
|
||||
_iprint("notice", buf);
|
||||
|
@ -211,7 +211,7 @@ iwarn(const char *format, ...)
|
|||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buf, sizeof(buf), format, args);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
|
||||
_iprint("warning", buf);
|
||||
|
@ -226,7 +226,7 @@ ierror(const char *format, ...)
|
|||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buf, sizeof(buf), format, args);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
|
||||
_iprint("error", buf);
|
||||
|
@ -261,7 +261,7 @@ smalldate(time_t ltime)
|
|||
|
||||
lt = localtime(<ime);
|
||||
|
||||
rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
|
||||
snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
|
||||
lt->tm_year + 1900, lt->tm_mon + 1,
|
||||
lt->tm_mday, lt->tm_hour, lt->tm_min);
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1814,7 +1814,7 @@ conf_report_error(const char *fmt, ...)
|
|||
char msg[IRCD_BUFSIZE + 1] = { 0 };
|
||||
|
||||
va_start(ap, fmt);
|
||||
rb_vsnprintf(msg, IRCD_BUFSIZE, fmt, ap);
|
||||
vsnprintf(msg, IRCD_BUFSIZE, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (testing_conf) {
|
||||
|
|
|
@ -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);
|
||||
|
@ -567,10 +567,10 @@ do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int
|
|||
int i;
|
||||
int tl; /* current length of presently being built string in t */
|
||||
for (i = 2; i < (parc - 1); i++) {
|
||||
tl = rb_sprintf(t, " %s", parv[i]);
|
||||
tl = sprintf(t, " %s", parv[i]);
|
||||
t += tl;
|
||||
}
|
||||
rb_sprintf(t, " :%s", parv[parc - 1]);
|
||||
sprintf(t, " :%s", parv[parc - 1]);
|
||||
}
|
||||
|
||||
if((target_p = find_client(parv[1])) != NULL) {
|
||||
|
|
|
@ -444,7 +444,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
|
|||
const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr;
|
||||
cp = (const unsigned char *)&v4->sin_addr.s_addr;
|
||||
|
||||
rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
|
||||
sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
|
||||
(unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0]));
|
||||
}
|
||||
#ifdef RB_IPV6
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -193,7 +193,7 @@ propagate_generic(struct Client *source_p, const char *command,
|
|||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
va_end(args);
|
||||
|
||||
sendto_match_servs(source_p, target, cap, NOCAPS,
|
||||
|
@ -214,7 +214,7 @@ cluster_generic(struct Client *source_p, const char *command,
|
|||
rb_dlink_node *ptr;
|
||||
|
||||
va_start(args, format);
|
||||
rb_vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
va_end(args);
|
||||
|
||||
RB_DLINK_FOREACH(ptr, cluster_conf_list.head) {
|
||||
|
|
26
src/s_serv.c
26
src/s_serv.c
|
@ -29,6 +29,8 @@
|
|||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
|
||||
#include <rb_snprintf.h>
|
||||
|
||||
#include "s_serv.h"
|
||||
#include "class.h"
|
||||
#include "client.h"
|
||||
|
@ -375,7 +377,7 @@ send_capabilities(struct Client *client_p, int cap_can_send)
|
|||
|
||||
for (cap = captab; cap->name; ++cap) {
|
||||
if(cap->cap & cap_can_send) {
|
||||
tl = rb_sprintf(t, "%s ", cap->name);
|
||||
tl = sprintf(t, "%s ", cap->name);
|
||||
t += tl;
|
||||
}
|
||||
}
|
||||
|
@ -470,8 +472,8 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
|
|||
int mlen;
|
||||
int cur_len;
|
||||
|
||||
cur_len = mlen = rb_sprintf(buf, ":%s BMASK %ld %s %c :",
|
||||
me.id, (long) chptr->channelts, chptr->chname, flag);
|
||||
cur_len = mlen = sprintf(buf, ":%s BMASK %ld %s %c :",
|
||||
me.id, (long) chptr->channelts, chptr->chname, flag);
|
||||
t = buf + mlen;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, list->head) {
|
||||
|
@ -494,7 +496,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
rb_sprintf(t, "%s ", banptr->banstr);
|
||||
sprintf(t, "%s ", banptr->banstr);
|
||||
t += tlen;
|
||||
cur_len += tlen;
|
||||
}
|
||||
|
@ -598,9 +600,9 @@ burst_TS6(struct Client *client_p)
|
|||
if(*chptr->chname != '#')
|
||||
continue;
|
||||
|
||||
cur_len = mlen = rb_sprintf(buf, ":%s SJOIN %ld %s %s :", me.id,
|
||||
(long) chptr->channelts, chptr->chname,
|
||||
channel_modes(chptr, client_p));
|
||||
cur_len = mlen = sprintf(buf, ":%s SJOIN %ld %s %s :", me.id,
|
||||
(long) chptr->channelts, chptr->chname,
|
||||
channel_modes(chptr, client_p));
|
||||
|
||||
t = buf + mlen;
|
||||
|
||||
|
@ -626,8 +628,8 @@ burst_TS6(struct Client *client_p)
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
rb_sprintf(t, "%s%s ", find_channel_status(msptr, 1),
|
||||
use_id(msptr->client_p));
|
||||
sprintf(t, "%s%s ", find_channel_status(msptr, 1),
|
||||
use_id(msptr->client_p));
|
||||
|
||||
cur_len += tlen;
|
||||
t += tlen;
|
||||
|
@ -704,7 +706,7 @@ show_capabilities(struct Client *target_p)
|
|||
|
||||
for (cap = captab; cap->cap; ++cap) {
|
||||
if(cap->cap & target_p->serv->caps)
|
||||
rb_snprintf_append(msgbuf, sizeof(msgbuf), " %s", cap->name);
|
||||
snprintf_append(msgbuf, sizeof(msgbuf), " %s", cap->name);
|
||||
}
|
||||
|
||||
return msgbuf + 1;
|
||||
|
@ -839,7 +841,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 +1109,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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
|
|||
ServerStats.is_ref++;
|
||||
sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains "
|
||||
"only alphanumeric characters.");
|
||||
rb_sprintf(tmpstr2, "Invalid username [%s]", source_p->username);
|
||||
sprintf(tmpstr2, "Invalid username [%s]", source_p->username);
|
||||
exit_client(client_p, source_p, &me, tmpstr2);
|
||||
return (CLIENT_EXITED);
|
||||
}
|
||||
|
|
12
src/send.c
12
src/send.c
|
@ -460,7 +460,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
current_serial++;
|
||||
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
|
||||
if(IsServer(source_p))
|
||||
|
@ -881,7 +881,7 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
|
|||
rb_linebuf_newbuf(&rb_linebuf_id);
|
||||
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
|
||||
if(IsServer(source_p))
|
||||
|
@ -946,7 +946,7 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
|
|||
rb_linebuf_newbuf(&rb_linebuf_id);
|
||||
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
|
||||
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL,
|
||||
|
@ -1082,7 +1082,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...)
|
|||
if (level & L_NETWIDE && ConfigFileEntry.global_snotices) {
|
||||
/* rather a lot of copying around, oh well -- jilles */
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
rb_linebuf_putmsg(&linebuf, pattern, NULL,
|
||||
":%s NOTICE * :*** Notice -- %s", me.name, buf);
|
||||
|
@ -1094,7 +1094,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...)
|
|||
} else if (remote_rehash_oper_p != NULL) {
|
||||
/* rather a lot of copying around, oh well -- jilles */
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
rb_linebuf_putmsg(&linebuf, pattern, NULL,
|
||||
":%s NOTICE * :*** Notice -- %s", me.name, buf);
|
||||
|
@ -1252,7 +1252,7 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char
|
|||
rb_linebuf_newbuf(&rb_linebuf_id);
|
||||
|
||||
va_start(args, pattern);
|
||||
rb_vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
||||
va_end(args);
|
||||
|
||||
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s",
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...)
|
|||
rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn);
|
||||
rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL);
|
||||
va_start(ap, fmt);
|
||||
rb_vsnprintf(reason, sizeof(reason), fmt, ap);
|
||||
vsnprintf(reason, sizeof(reason), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
buf[0] = 'D';
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue