diff --git a/include/extern.h b/include/extern.h index d92c35a4c..4708457f7 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1013,8 +1013,6 @@ E void process(void); E void send_cmd(const char *source, const char *fmt, ...) FORMAT(printf,2,3); -E void vsend_cmd(const char *source, const char *fmt, va_list args) - FORMAT(printf,2,0); E void notice_server(char *source, Server * s, char *fmt, ...) FORMAT(printf,3,4); diff --git a/src/send.c b/src/send.c index e3c443e48..bd03cc4a6 100644 --- a/src/send.c +++ b/src/send.c @@ -26,46 +26,29 @@ */ void send_cmd(const char *source, const char *fmt, ...) { - va_list args; + va_list args; + static char buf[BUFSIZE]; - if (fmt) { - va_start(args, fmt); - vsend_cmd(source, fmt, args); - va_end(args); - } -} + va_start(args, fmt); -/*************************************************************************/ + vsnprintf(buf, BUFSIZE - 1, fmt, args); -/** - * actually Send a command to the server. - * @param source Orgin of the Message (some times NULL) - * @param fmt Format of the Message - * @param args List of the arguments - * @return void - */ -void vsend_cmd(const char *source, const char *fmt, va_list args) -{ - char buf[BUFSIZE]; - *buf = '\0'; + if (source) + { + sockprintf(servsock, ":%s %s\r\n", source, buf); + eventprintf(":%s %s", source, buf); + if (debug) + alog("debug: Sent: :%s %s", source, buf); + } + else + { + sockprintf(servsock, "%s\r\n", buf); + eventprintf("%s", buf); + if (debug) + alog("debug: Sent: %s", buf); + } - if (fmt) { - vsnprintf(buf, BUFSIZE - 1, fmt, args); - - if (source) { - sockprintf(servsock, ":%s %s\r\n", source, buf); - eventprintf(":%s %s", source, buf); - if (debug) { - alog("debug: Sent: :%s %s", source, buf); - } - } else { - sockprintf(servsock, "%s\r\n", buf); - eventprintf("%s", buf); - if (debug) { - alog("debug: Sent: %s", buf); - } - } - } + va_end(args); } /*************************************************************************/