Skip to content

constmap.3

Manvendra Bhangui edited this page Nov 22, 2023 · 3 revisions

NAME

constmap - create, search constant search maps

SYNTAX

#include <constmap.h>

int constmap_init(struct constmap *cm, char *str, int size, int delimiter);
int constmap(struct constmap *cm, char *str, int len);
int constmap_free(struct constmap *cm);

DESCRIPTION

constmap_init() initializes a constmap database with content in str of size size. You can prepare str using

control_readfile(&str, "filename");

constmap_init() converts the data into a constant search map. You can specify if the records are unstructured or in key/value pair separated by colon ':' character by using 1 for delimiter. If you want to change the delimiter to something else, specify the character in delimiter. You can specifiy an ASCII character from SPACE ' ' to TILDE '~'. Any other value sets the delimiter to the colon character ':'.

constmap() returns a pointer to data pointed by str if found else it returns NULL.

constmap_free() frees memory allocated my constmap_init().

See Also

ascii(7)

Clone this wiki locally