Shaul Karl wrote:

On Wed, Mar 23, 2005 at 07:46:24PM +0200, Shachar Shemesh wrote:


There is no other explanation.

Just about every free program on Linux keeps a configuration file in /etc. They all fairly much carry the same format. It simply defies logic that there would be no standard library to read this configuration file in.





Not sure I understand what you are after. Suppose there would have been # include <configuration_files.h>. What API would you expect to
find in it?


The most basic API is "get me the value this key has". So that if I have
"PermiteRootLogin Yes"
I could do GetValue("PermitRootLogin"), or even "GetValue("PermitRootLogin", TYPE_BOOL)". The details will need to be sorted out, of course.


More advance API would also let me say "Here is a section with a bunch of keys, tell me what they are and what their values are". Also, there should be an option to have more than one value per key.

What output would you expect to get from reading fstab?
timezone? whatever?


Obviously, that would only apply to a certain format of file. Most files, however, use a "key value" or "key=value" format, with minor variants. Answering Nadav's question - yes, even sendmail and apache. Apache segments the config file, which may or may not be supported, but still uses the same basic format. Example of files that don't use the same basic format:
fstab - uses tabular representation.
bind - uses a C style syntax.


Does this standard library exists on other OSs?


Windows has (how typical) two:
The registry, and the older "INI" one (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mslu/winprog/unicode_layer_ini_file_functions.asp).


         Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to