Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3154947
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/conf.c b/conf.c
index d0524724..9618090d 100644
--- a/conf.c
+++ b/conf.c
@@ -1,21 +1,45 @@
#include "conf.h"
#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
-int readconf(char *conffile, struct peer **head)
+static int parse_config(FILE *fp, struct peer **head)
{
+
+
return 0;
}
+int readconf(const char *conffile, struct peer **head)
+{
+ FILE *fp;
+ int res = 0;
+
+ fp = fopen (conffile, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "Unable to open config file [%s] reason [%s]\n",
+ conffile, strerror(errno));
+ return -1;
+ }
+
+ res = parse_config(fp, head);
+
+ fclose(fp);
+
+ return res;
+}
+
void freeconf(struct peer *head)
{
struct peer *next;
while(head) {
next = head->next;
free(head);
head = next;
}
return;
}
diff --git a/conf.h b/conf.h
index b8828a3e..62a2c659 100644
--- a/conf.h
+++ b/conf.h
@@ -1,12 +1,13 @@
#ifndef __CONF_H__
#define __CONF_H__
struct peer {
struct peer *next;
struct peer *tail;
+ const char *line;
};
-int readconf(char *conffile, struct peer **head);
+int readconf(const char *conffile, struct peer **head);
void freeconf(struct peer *head);
#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Feb 26, 6:02 PM (1 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1465615
Default Alt Text
(1 KB)
Attached To
Mode
rK kronosnet
Attached
Detach File
Event Timeline
Log In to Comment