Source/ThunderBeast/QuakeToon/game/q_shared.c
char *Info_ValueForKey (char *s, char *key)
{
	char	pkey[512];
	static	char value[2][512];	// use two buffers so compares
								// work without stomping on each other
	static	int	valueindex;
	char	*o;
	
	valueindex ^= 1;
	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++;
	}
}
/*
===============
Info_ValueForKey

Searches the string for the given
key and returns the associated value, or an empty string.
===============
*/
Info_ValueForKey
Searches the string for the given
key and returns the associated value, or an empty string.
Info_ValueForKey Searches the string for the given key and returns the associated value or an empty string .
char *Info_ValueForKey (char *s, char *key)
{
	char	pkey[512];
	static	char value[2][512];	
	static	int	valueindex;
	char	*o;
	valueindex ^= 1;
	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++;
	}
}
char * Info_ValueForKey ( char * s , char * key ) { char pkey [ 512 ] ; static char value [ 2 ] [ 512 ] ; static int valueindex ; char * o ; valueindex ^= 1 ; 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 ++ ; } }
Info_ValueForKey
Searches the string for the given
key and returns the associated value, or an empty string.
Info_ValueForKey Searches the string for the given key and returns the associated value or an empty string .
// use two buffers so compares // work without stomping on each other