EMILE/libconfig/config_find_entry.c

37 lines
686 B
C
Raw Normal View History

2007-08-26 09:16:23 +00:00
/*
*
* (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
*
*/
#include <stdio.h>
#include <string.h>
#include "libconfig.h"
2007-09-08 23:09:14 +00:00
int config_find_entry(int8_t *configuration, char *name, char *property)
2007-08-26 09:16:23 +00:00
{
int index = 0;
int last_index;
char current_name[256];
char current_property[256];
if (name == NULL)
return -1;
2007-08-26 09:16:23 +00:00
while (configuration[index])
{
last_index = index;
index = config_get_next_property(configuration, index,
current_name, current_property);
if (index == -1)
return -1;
if ( (strcmp(name, current_name) == 0) &&
((property == NULL) ||
(strcmp(property, current_property) == 0)))
return last_index;
2007-08-26 09:16:23 +00:00
}
return -1;
}