summaryrefslogtreecommitdiff
path: root/tracker/common/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker/common/util.cpp')
-rw-r--r--tracker/common/util.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/tracker/common/util.cpp b/tracker/common/util.cpp
new file mode 100644
index 0000000..d28b1c7
--- /dev/null
+++ b/tracker/common/util.cpp
@@ -0,0 +1,70 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#include "util.h"
+#include <string.h>
+
+#define NUM_BUFFERS 4
+#define MAX_INFO_TOKEN_LENGTH 512
+const char *CUtil::InfoGetValue( const char *s, const char *key )
+{
+ char pkey[MAX_INFO_TOKEN_LENGTH];
+ // Use multiple buffers so compares
+ // work without stomping on each other
+ static char value[NUM_BUFFERS][MAX_INFO_TOKEN_LENGTH];
+ static int valueindex;
+ char *o;
+
+ valueindex = (valueindex + 1) % NUM_BUFFERS;
+
+ if (*s == '\\')
+ s++;
+ while (1)
+ {
+ o = pkey;
+ while (*s != '\\')
+ {
+ if (!*s)
+ return "";
+ *o++ = *s++;
+ }
+ *o = 0;
+ s++;
+
+ o = value[valueindex];
+
+ while (*s != '\\' && *s)
+ {
+ if (!*s)
+ return "";
+ *o++ = *s++;
+ }
+ *o = 0;
+
+ if (!strcmp (key, pkey) )
+ return value[valueindex];
+
+ if (!*s)
+ return "";
+ s++;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: This function is supposed to localise the strings, but for now just return internal value
+// Input : *stringName -
+// Output : const char
+//-----------------------------------------------------------------------------
+const char *CUtil::GetString(const char *stringName)
+{
+ return stringName;
+}
+
+static CUtil g_Util;
+CUtil *util = &g_Util;
+
+