#ifndef MSG_FILE_H
#define MSG_FILE_H
-#include "linuxlist.h"
+#include <osmocom/core/linuxlist.h>
/**
* One message in the list.
*/
-struct msg_entry {
+struct osmo_config_entry {
struct llist_head list;
/* number for everyone to use */
char *text;
};
-struct msg_entries {
+struct osmo_config_list {
struct llist_head entry;
};
-struct msg_entries *msg_entry_parse(void *ctx, const char *filename);
+struct osmo_config_list* osmo_config_list_parse(void *ctx, const char *filename);
#endif
#include <unistd.h>
#include <string.h>
-static struct msg_entry *alloc_entry(struct msg_entries *entries,
- const char *mcc, const char *mnc,
- const char *option, const char *text)
+static struct osmo_config_entry *
+alloc_entry(struct osmo_config_list *entries,
+ const char *mcc, const char *mnc,
+ const char *option, const char *text)
{
- struct msg_entry *entry = talloc_zero(entries, struct msg_entry);
+ struct osmo_config_entry *entry =
+ talloc_zero(entries, struct osmo_config_entry);
if (!entry)
return NULL;
return entry;
}
-static struct msg_entries *alloc_entries(void *ctx)
+static struct osmo_config_list *alloc_entries(void *ctx)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
- entries = talloc_zero(ctx, struct msg_entries);
+ entries = talloc_zero(ctx, struct osmo_config_list);
if (!entries)
return NULL;
/*
* split a line like 'foo:Text'.
*/
-static void handle_line(struct msg_entries *entries, char *line)
+static void handle_line(struct osmo_config_list *entries, char *line)
{
int i;
const int len = strlen(line);
/* nothing found */
}
-struct msg_entries *msg_entry_parse(void *ctx, const char *filename)
+struct osmo_config_list *osmo_config_list_parse(void *ctx, const char *filename)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
size_t n;
char *line;
FILE *file;
#include <stdio.h>
-static void dump_entries(struct msg_entries *entries)
+static void dump_entries(struct osmo_config_list *entries)
{
- struct msg_entry *entry;
+ struct osmo_config_entry *entry;
if (!entries) {
fprintf(stderr, "Failed to parse the file\n");
int main(int argc, char **argv)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
/* todo use msgfile_test.c.in and replace the path */
- entries = msg_entry_parse(NULL, "msgconfig.cfg");
+ entries = osmo_config_list_parse(NULL, "msgconfig.cfg");
dump_entries(entries);
return 0;