static bool GetKeyValueFromBuffer( CUtlBuffer &buf, char **key, char **val ) { char stringBuf[2048]; while( buf.IsValid() ) { buf.GetLine( stringBuf, sizeof(stringBuf) ); char *scan = stringBuf; // search for the first quote for the key. while( 1 ) { if( *scan == '\"' ) { *key = ++scan; break; } if( *scan == '#' ) { goto next_line; // comment } if( *scan == '\0' ) { goto next_line; // end of line. } scan++; } // read the key until another quote. while( 1 ) { if( *scan == '\"' ) { *scan = '\0'; scan++; break; } if( *scan == '\0' ) { goto next_line; } scan++; } // search for the first quote for the value. while( 1 ) { if( *scan == '\"' ) { *val = ++scan; break; } if( *scan == '#' ) { goto next_line; // comment } if( *scan == '\0' ) { goto next_line; // end of line. } scan++; } // read the value until another quote. while( 1 ) { if( *scan == '\"' ) { *scan = '\0'; scan++; // got a key and a value, so get the hell out of here. return true; } if( *scan == '\0' ) { goto next_line; } scan++; } next_line: ; } return false; }