Yann POUPET wrote:
why not having a lib function that would help3 parsing/reading/writing such a file ? With a configuration file such as the example above, one could think about a function that would return the value of arg1 arg = cfgfile_readparam("/file/location",param1) We could also have a function to write the conf cfgfile_writeparam("/file/location",param1,newarg1) cfgfile_replaceparam("/file/location",param2,newarg2) cfgfile_addcomment(....)
Having a config file library which parses config files and works with name-value pairs (see libnvpair(3LIB)) seems like an excellent idea to me.
One big advantage I can see over the current proliferation of parsers is that such a library would provide a centralized place for future expansion. For instance, I would like to replace the configuration files stored on each of my machines with an LDAP respository, so that I can administer my systems via a database rather than at the individual machine level. A libconfig or whatever would be a logical stepping stone toward adding such features.
Furthermore, as I said before, there may be a lot of config files. Why not have ALL configuration into a single file ? That could be a hash, a berkeleydb file (I think E17 uses such files for conf), or whatever. (isn't it the way MS Win does with is registry ?) For files needed by everyone, this file would be /config (or /etc/config), for personnal config that could be ~/config. Thus only two locations for all configs.
Many of these config files have stable-enough commitment levels that this will be challenging. Plus, I don't see any advantage to such an architecture, other than the fact that going that route would force our hand in preventing bad applications from directly parsing and manipulating config files. ;) And there's also the drawback of putting your eggs in one basket (if the central respository gets corrupted, you're toast).
- Eric _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org