settings.c
static bool
parse_keyvalue(const char * const keyval, char **key, char **value)
{
	static const char *pattern1 = " %100[^= ] = "
	                              "\"%100[ a-zA-Z0-9<>|#%:-]\"";
	static const char *pattern2 = " %100[^= ] = "
		                      "%100[a-zA-Z0-9<>|#%:-]";
	char tkey[101] = { 0 };
	char tvalue[101] = { 0 };

	if (2 != sscanf(keyval, pattern1, tkey, tvalue)
	&&  2 != sscanf(keyval, pattern2, tkey, tvalue))
		return false;

	*key = strdup(tkey);
	*value = strdup(tvalue);
	return true;
}
/*
 * Parse a "key = value" string (value may be quoted) into its components.
 * XXX It is the callers responsibility to free() the resulting key & value
 */
Parse a "key = value" string (value may be quoted) into its components.
XXX It is the callers responsibility to free() the resulting key & value
Parse a " key = value " string ( value may be quoted ) into its components . XXX It is the callers responsibility to free () the resulting key & value
static bool
parse_keyvalue(const char * const keyval, char **key, char **value)
{
	static const char *pattern1 = " %100[^= ] = "
	                              "\"%100[ a-zA-Z0-9<>|#%:-]\"";
	static const char *pattern2 = " %100[^= ] = "
		                      "%100[a-zA-Z0-9<>|#%:-]";
	char tkey[101] = { 0 };
	char tvalue[101] = { 0 };
	if (2 != sscanf(keyval, pattern1, tkey, tvalue)
	&&  2 != sscanf(keyval, pattern2, tkey, tvalue))
		return false;
	*key = strdup(tkey);
	*value = strdup(tvalue);
	return true;
}
static bool parse_keyvalue ( const char * const keyval , char * * key , char * * value ) { static const char * pattern1 = " " " \" \" " ; static const char * pattern2 = " " " " ; char tkey [ 101 ] = { 0 } ; char tvalue [ 101 ] = { 0 } ; if ( 2 != sscanf ( keyval , pattern1 , tkey , tvalue ) && 2 != sscanf ( keyval , pattern2 , tkey , tvalue ) ) return false ; * key = strdup ( tkey ) ; * value = strdup ( tvalue ) ; return true ; }
Parse a "key = value" string (value may be quoted) into its components.
Parse a " key = value " string ( value may be quoted ) into its components .