#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include "lcas_log.h"
#include "_lcas_db_read.h"
Go to the source code of this file.
Defines | |
#define | MAXDBENTRIES 250 |
#define | MAXPAIRS 2 |
#define | PAIR_SEP_CHARS "," |
#define | VARVAL_SEP_CHARS "=" |
#define | PAIR_TERMINATOR_CHARS PAIR_SEP_CHARS WHITESPACE_CHARS |
#define | VARVAL_TERMINATOR_CHARS VARVAL_SEP_CHARS WHITESPACE_CHARS |
Functions | |
int | lcas_db_read_entries (FILE *) |
Read db entries from stream and fill a lsit of db entries. | |
int | lcas_db_parse_line (char *, lcas_db_entry_t **) |
Parses database line and fills database structure. | |
int | lcas_db_parse_pair (char *, char **, char **) |
Parses a database variable-value pair and returns the variable name and its value. | |
int | lcas_db_parse_string (char **) |
Takes a string and removes prepending and trailing spaces and quotes (unless escaped). | |
lcas_db_entry_t ** | lcas_db_read (char *lcas_db_fname) |
Read database from file. | |
lcas_db_entry_t * | lcas_db_fill_entry (lcas_db_entry_t **list, lcas_db_entry_t *entry) |
Add a database entry to a list. | |
int | lcas_db_clean_list (lcas_db_entry_t **list) |
Clean/remove the database list. | |
int | lcas_db_clean () |
Clean/remove the database structure. | |
Variables | |
lcas_db_entry_t * | lcas_db_list = NULL |
Definition in file lcas_db_read.c.
|
maximum number of LCAS database entries Definition at line 37 of file lcas_db_read.c. Referenced by lcas_db_read(), and lcas_db_read_entries(). |
|
maximum number of variable-value pairs that will be parsed per line Definition at line 38 of file lcas_db_read.c. Referenced by lcas_db_parse_line(). |
|
Characters separating variable-value pairs in the lcas database file Definition at line 47 of file lcas_db_read.c. Referenced by lcas_db_parse_line(). |
|
Characters that terminate pairs in the lcas database file. This is a combination of whitespace and separators. Definition at line 59 of file lcas_db_read.c. |
|
Characters separating variables from values Definition at line 49 of file lcas_db_read.c. Referenced by lcas_db_parse_pair(). |
|
Characters that terminate variables and values in the lcas database file. This is a combination of whitespace and separators. Definition at line 64 of file lcas_db_read.c. |
|
Clean/remove the database structure.
Definition at line 552 of file lcas_db_read.c. References lcas_db_clean_list(), lcas_db_list, and lcas_log(). Referenced by lcas_init_and_logfile(). |
|
Clean/remove the database list.
Definition at line 529 of file lcas_db_read.c. References lcas_db_entry_t, lcas_log_debug(), lcas_db_entry_s::next, and lcas_db_entry_s::pluginname. Referenced by lcas_db_clean(), and lcas_init_and_logfile(). |
|
Add a database entry to a list.
Definition at line 185 of file lcas_db_read.c. References lcas_db_entry_t, lcas_log(), lcas_log_debug(), LCAS_MAXARGSTRING, LCAS_MAXPATHLEN, lcas_db_entry_s::next, NUL, lcas_db_entry_s::pluginargs, and lcas_db_entry_s::pluginname. Referenced by lcas_db_read_entries(), and lcas_init_and_logfile(). |
|
Parses database line and fills database structure.
Definition at line 248 of file lcas_db_read.c. References lcas_db_entry_t, lcas_db_parse_pair(), lcas_log(), lcas_log_debug(), LCAS_MAXARGSTRING, LCAS_MAXPATHLEN, MAXPAIRS, NUL, PAIR_SEP_CHARS, lcas_db_entry_s::pluginargs, and lcas_db_entry_s::pluginname. Referenced by lcas_db_read_entries(). |
|
Parses a database variable-value pair and returns the variable name and its value.
Definition at line 381 of file lcas_db_read.c. References lcas_db_parse_string(), lcas_log(), NUL, and VARVAL_SEP_CHARS. Referenced by lcas_db_parse_line(). |
|
Takes a string and removes prepending and trailing spaces and quotes (unless escaped).
Definition at line 478 of file lcas_db_read.c. References lcas_log(), and NUL. Referenced by lcas_db_parse_pair(). |
|
Read database from file.
Definition at line 87 of file lcas_db_read.c. References lcas_db_entry_t, lcas_db_list, lcas_db_read_entries(), lcas_log(), and MAXDBENTRIES. Referenced by lcas_init_and_logfile(). |
|
Read db entries from stream and fill a lsit of db entries.
Definition at line 130 of file lcas_db_read.c. References lcas_db_entry_t, lcas_db_fill_entry(), lcas_db_list, lcas_db_parse_line(), lcas_log_debug(), MAXDBENTRIES, lcas_db_entry_s::pluginargs, and lcas_db_entry_s::pluginname. Referenced by lcas_db_read(). |
|
list of database entries Definition at line 81 of file lcas_db_read.c. Referenced by lcas_db_clean(), lcas_db_read(), and lcas_db_read_entries(). |