From 04c0c4fdf84bb7b9e89604e8b9a6079016d5968c Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Wed, 04 Jul 2018 16:06:41 +0000
Subject: [PATCH] Merge pull request #1132 from tinohager/master

---
 src/option_list.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/option_list.c b/src/option_list.c
index f935af3..3e835de 100644
--- a/src/option_list.c
+++ b/src/option_list.c
@@ -12,7 +12,7 @@
     int nu = 0;
     list *options = make_list();
     while((line=fgetl(file)) != 0){
-        ++ nu;
+        ++nu;
         strip(line);
         switch(line[0]){
             case '\0':
@@ -32,6 +32,25 @@
     return options;
 }
 
+metadata get_metadata(char *file)
+{
+	metadata m = { 0 };
+	list *options = read_data_cfg(file);
+
+	char *name_list = option_find_str(options, "names", 0);
+	if (!name_list) name_list = option_find_str(options, "labels", 0);
+	if (!name_list) {
+		fprintf(stderr, "No names or labels found\n");
+	}
+	else {
+		m.names = get_labels(name_list);
+	}
+	m.classes = option_find_int(options, "classes", 2);
+	free_list(options);
+	printf("Loaded - names_list: %s, classes = %d \n", name_list, m.classes);
+	return m;
+}
+
 int read_option(char *s, list *options)
 {
     size_t i;

--
Gitblit v1.10.0