]> git.itanic.dy.fi Git - log-plotter/blob - config.h
config.c: Export store_str_variable_value_to_array()
[log-plotter] / config.h
1 #ifndef _CONFIG_H_
2 #define _CONFIG_H_
3
4 struct variable_value {
5         char *name;
6         int type;
7         void *ptr;
8 };
9
10 enum {
11         TYPE_INT,
12         TYPE_STRING,
13 };
14
15 struct plotter_config {
16         char *charger_name;
17
18         char *plotter_scripts_dir;
19         char *images_output_dir;
20
21         char *device_path;
22         int baudrate;
23         char *log_path;
24         char *config_file_path;
25
26         struct variable_value *variables;
27 };
28
29 int read_args(int argc, char *argv[], struct plotter_config *cfg);
30 int populate_config_data_from_file(const char *path,
31                                 struct plotter_config *cfg);
32
33 int store_str_variable_value_to_array(const char *variable, const char *value,
34                                 struct plotter_config *cfg);
35 int store_int_variable_value_to_array(const char *variable, int value,
36                                 struct plotter_config *cfg);
37 int replace_variables_with_values(char *str, size_t len,
38                                 const struct plotter_config *cfg);
39
40 #endif