NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: reading config files from C
Hi Mark,
On Wed, Jan 29, 2020 at 2:07 PM MJ <mafsys1234%gmail.com@localhost> wrote:
> On 30/01/2020 5:19 am, George Georgalis wrote:
> > Hi, I would like to introduce configuration files to a software
> > project I am supporting with build infrastructure. The C programs
> > depend on quite a few libraries from different sources. As a result of
> > development evolution, we have hardcoded paths in the source which
> > would be better served as parameters read from configuration files, so
> > the location of dependencies can be adjusted without modifying the
> > code. We need this functionality for runtime as well as compile time.
>
> Can you not just change all the hardcoded paths to defines and then pass those defines to the programs via make?
...
> Am I over-simplifying the issue?
That sounds like a great solution, compile time defines solves the
immediate problem of getting it to work on another platform, accept
that I'm not proficient enough in C to just code it out. How do you
pass make env to programs at compile time? Would you provide an
example?
What about runtime paths and parameters? I guess a config file still
needs parsing from C, for that? I know a lot of compiled programs do
this, but in the source I've looked at, I'm not seeing exactly
how/where. :-\ ...this would be the first thing I would make templates
for, but I'm not seeing any templates either....
Thanks,
-George
--
George Georgalis, (415) 894-2710, http://www.galis.org/
Home |
Main Index |
Thread Index |
Old Index