Commit Graph

4 Commits (e82f9032ebf3d9fabae38cf58dc0255250266019)

Author SHA1 Message Date
nirenjan e82f9032eb Add 'config get' command to retrieve configuration
The command allows the client to retrieve individual parameters from the
configuration. This follows a similar syntax to the 'config set'
command, with the client supplying the section and key, and if there is
a matching entry in the configuration, it will return the corresponding
value.
2021-11-07 07:52:11 -08:00
nirenjan 6c3efa44f5 Simplify configuration dumping
Prior to this change, there was a lot of duplicated code within the dump
routines, which would call out to a common `print_section` routine that
had global state. This causes problems from a multi-threaded perspective
in that multiple calls to `x52d_config_save_file` were not MT-safe.

In addition, the dump logic was written such that it could only be used
in the config dump. It is desired that we add functionality to return
the formatted config value as a string in a different part of the code
as well.

This change brings in the shared state into a stack variable, and
changes the dump functions to return a const char *, thereby allowing
for greater reuse, as well as getting rid of the shared state. However,
there is still a little bit of shared state in the `int_dumper` routine.
This can be ignored for now, but we should possibly figure out how to
get rid of the shared state altogether.
2021-11-02 23:25:55 -07:00
nirenjan 76b1b99717 Make sure config file is closed after dumping configuration 2021-08-30 10:28:26 -07:00
nirenjan 874c46705a Add config save routines 2021-08-09 22:16:30 -07:00