1/*
2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <camkes.h>
8#include <string.h>
9
10void l__init(void) {
11}
12
13static struct {
14    const char *key;
15    const char *value;
16} dict[] = {
17    {
18        .key = "foo",
19        .value = "bar",
20    },
21    {
22        .key = "secret",
23        .value = "baz",
24    }
25};
26
27/* Lookup and return the value associated with 'key' */
28char *l_get_value(const char *key) {
29    for (unsigned int i = 0; i < sizeof(dict) / sizeof(dict[0]); ++i) {
30        if (!strcmp(key, dict[i].key)) {
31            return strdup(dict[i].value);
32        }
33    }
34    /* Not found */
35    return strdup("");
36}
37