OregonCore  revision fb2a440-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 1749 of file Chat.cpp.

References MAX_FMT_STRING, and vsnprintf.

Referenced by ChatHandler::getCommandTable().

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