diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:10 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:10 +0000 |
commit | ca8996472c5e855087bacf947186d919b653ab7d (patch) | |
tree | f7d9b19554194fa2b1119e762ebc89ab27e38907 /src/send.c | |
parent | b3df8dbfb1943030adb6f72f5c3cee509d6ffa5e (diff) |
Merge send_cmd() and vsend_cmd().
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1205 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/send.c')
-rw-r--r-- | src/send.c | 63 |
1 files changed, 23 insertions, 40 deletions
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; - - if (fmt) { - va_start(args, fmt); - vsend_cmd(source, fmt, args); - va_end(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 (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_list args; + static char buf[BUFSIZE]; + + va_start(args, 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); } /*************************************************************************/ |