26 Jul 2001 jum   » (Master)

For quite some time we have used a system named Preferences to consolidate all the configuartion information we have into one place. It was initially used only by the OPI subsystem and over the years other programs migrated to Preferences as well. Currently we are progressing for the next version to have nearly no ASCII readable configuration any more, everything is stored in the hierarchical Preferences data base (which happens to be some HFS deriative for those who know what HFS is).

So this decision will probably make the Unix old timers cringe as one of the hallmarks of Unix is the abundance of text config files. It also smells in particular like Windows Registry, which will not necessarily attract Unix wizards. But it really makes quite a few things easier. For example setting a single parameter is just a single command:


prefvalue -k Programs/atalkd/if -t strlist "hme0,le0"

Similarily it is easy do delete one parameter by using a command like this:

prefvalue -k Programs/atalkd/debug -d

All this can be entered on the command line without needing an editor, hunting down for the proper line and editing the line while not messing up the syntax. And internally the API is really easy to extract these parameters or iterate over the tree. The tree form also makes some more advanced usage possible, like having the same tree structure rooted at various points in the tree needs just one parameter changed in the API.

One of major complaints against binary configuration files is the inability to fix the file if something goes wrong. We added two commands named prefdump and prefrestore to help with that, prefdump dumps all the Preferences into an ASCII file and prefrestore restores it. In particular on system start we always save one prefdump away. On the modification side we do always completely rewrite the file under a new name and rename it after it is complete to avoid partial updates.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!