29 #include "../common/common.h"
43 static char value[2][512] = {
"",
""};
46 static int valueindex = 0;
49 if (*s ==
'\\' && *s !=
'\n')
53 while (*s !=
'\\' && *s !=
'\n') {
61 o = value[valueindex];
63 while (*s !=
'\\' && *s !=
'\n' && *s)
68 return value[valueindex];
79 if (boolStr[0] ==
'0' || boolStr[0] ==
'\0' ||
Q_streq(boolStr,
"No"))
100 if (strstr(key,
"\\")) {
119 while (*s !=
'\\' && *s) {
126 if (!strncmp(key, pkey,
sizeof(pkey))) {
127 const size_t size = strlen(s);
128 memmove(start, s, size);
173 if (strstr(key,
"\\") || strstr(value,
"\\")) {
174 Com_Printf(
"Can't use keys or values with a \\\n");
178 if (strstr(key,
";")) {
179 Com_Printf(
"Can't use keys or values with a semicolon\n");
183 if (strstr(key,
"\"") || strstr(value,
"\"")) {
184 Com_Printf(
"Can't use keys or values with a \"\n");
202 Com_sprintf(newi,
sizeof(newi),
"\\%s\\%s%s", key, value, s);
220 while (*s && *s !=
'\\') {
226 Com_Printf(
"%-40.*sMISSING VALUE\n", key_len, key);
231 while (*s && *s !=
'\\') {
239 Com_Printf(
"%-40.*s%.*s\n", key_len, key, value_len, value);
bool Q_strnull(const char *string)
void Info_SetValueForKeyAsInteger(char *s, const size_t size, const char *key, const int value)
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
void Com_Printf(const char *const fmt,...)
const char * Info_ValueForKey(const char *s, const char *key)
Searches the string for the given key and returns the associated value, or an empty string...
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Info_Validate(const char *s)
Some characters are illegal in info strings because they can mess up the server's parsing...
#define Q_strcasecmp(a, b)
void Info_SetValueForKey(char *s, const size_t size, const char *key, const char *value)
Adds a new entry into string with given value.
void Info_RemoveKey(char *s, const char *key)
Searches through s for key and remove is.
void Info_Print(const char *s)
Prints info strings (like userinfo or serverinfo - CVAR_USERINFO, CVAR_SERVERINFO) ...
const char * Info_BoolForKey(const char *s, const char *key)
int Info_IntegerForKey(const char *s, const char *key)