OregonCore  revision 3611e8a-git
Your Favourite TBC server
Chat.h File Reference
#include "SharedDefines.h"

Go to the source code of this file.

Classes

class  ChatCommand
 
class  ChatHandler
 
struct  ChatHandler::DeletedInfo
 
class  CliHandler
 

Functions

char const * fmtstring (char const *format,...)
 

Function Documentation

char const* fmtstring ( char const *  format,
  ... 
)

Definition at line 1746 of file Chat.cpp.

References MAX_FMT_STRING, and vsnprintf.

Referenced by ChatHandler::getCommandTable().

1747 {
1748  va_list argptr;
1749 #define MAX_FMT_STRING 32000
1750  static char temp_buffer[MAX_FMT_STRING];
1751  static char string[MAX_FMT_STRING];
1752  static int index = 0;
1753  char* buf;
1754  int len;
1755 
1756  va_start(argptr, format);
1757  vsnprintf(temp_buffer, MAX_FMT_STRING, format, argptr);
1758  va_end(argptr);
1759 
1760  len = strlen(temp_buffer);
1761 
1762  if (len >= MAX_FMT_STRING)
1763  return "ERROR";
1764 
1765  if (len + index >= MAX_FMT_STRING - 1)
1766  index = 0;
1767 
1768  buf = &string[index];
1769  memcpy(buf, temp_buffer, len + 1);
1770 
1771  index += len + 1;
1772 
1773  return buf;
1774 }
#define MAX_FMT_STRING
#define vsnprintf
Definition: Common.h:131