X-Git-Url: http://git.itanic.dy.fi/?p=log-plotter;a=blobdiff_plain;f=config.h;h=c4df7108213c67a20a962fe0540f5ae9d5663c47;hp=9f817fc7166d88aac450c34920e50bf69b6b370c;hb=HEAD;hpb=84ab13170c021724847f80663c9136ec8badac57 diff --git a/config.h b/config.h index 9f817fc..c4df710 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,17 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ +struct variable_value { + char *name; + int type; + void *ptr; +}; + +enum { + TYPE_INT, + TYPE_STRING, +}; + struct plotter_config { char *charger_name; @@ -10,9 +21,20 @@ struct plotter_config { char *device_path; int baudrate; char *log_path; + char *config_file_path; + + struct variable_value *variables; }; +int read_args(int argc, char *argv[], struct plotter_config *cfg); int populate_config_data_from_file(const char *path, struct plotter_config *cfg); +int store_str_variable_value_to_array(const char *variable, const char *value, + struct plotter_config *cfg); +int store_int_variable_value_to_array(const char *variable, int value, + struct plotter_config *cfg); +int replace_variables_with_values(char *str, size_t len, + const struct plotter_config *cfg); + #endif