[PATCH 2/3] ifupdown: Add ifparser_haskey function
- From: Guido Günther <agx sigxcpu org>
- To: networkmanager-list gnome org
- Subject: [PATCH 2/3] ifupdown: Add ifparser_haskey function
- Date: Mon, 12 Dec 2011 08:34:22 +0100
---
src/settings/plugins/ifupdown/interface_parser.c | 12 ++++++++++++
src/settings/plugins/ifupdown/interface_parser.h | 3 +++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/settings/plugins/ifupdown/interface_parser.c b/src/settings/plugins/ifupdown/interface_parser.c
index b7c6424..9abf505 100644
--- a/src/settings/plugins/ifupdown/interface_parser.c
+++ b/src/settings/plugins/ifupdown/interface_parser.c
@@ -294,6 +294,18 @@ const char *ifparser_getkey(if_block* iface, const char *key)
return NULL;
}
+gboolean
+ifparser_haskey(if_block* iface, const char *key)
+{
+ if_data *curr = iface->info;
+ while(curr!=NULL) {
+ if (strcmp(curr->key,key)==0)
+ return TRUE;
+ curr = curr->next;
+ }
+ return FALSE;
+}
+
int ifparser_get_num_info(if_block* iface)
{
int i = 0;
diff --git a/src/settings/plugins/ifupdown/interface_parser.h b/src/settings/plugins/ifupdown/interface_parser.h
index 0c1de23..e68abcf 100644
--- a/src/settings/plugins/ifupdown/interface_parser.h
+++ b/src/settings/plugins/ifupdown/interface_parser.h
@@ -24,6 +24,8 @@
#ifndef _INTERFACE_PARSER_H
#define _INTERFACE_PARSER_H
+#include <glib.h>
+
typedef struct _if_data
{
char *key;
@@ -45,6 +47,7 @@ void ifparser_destroy(void);
if_block *ifparser_getif(const char* iface);
if_block *ifparser_getfirst(void);
const char *ifparser_getkey(if_block* iface, const char *key);
+gboolean ifparser_haskey(if_block* iface, const char *key);
int ifparser_get_num_blocks(void);
int ifparser_get_num_info(if_block* iface);
--
1.7.7.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]