Jonathan Andrews wrote:
On Wed, 2004-07-28 at 17:56, Neal D. Becker wrote:
> Neal D. Becker wrote:
>
> > Yes, here's the linux registry topic again. This project looks
> > interesting. Any comments?
> >
> >
http://registry.sourceforge.net/
> >
> >
>
> One motivation that I didn't hear anyone mention:
>
> It is difficult to add entries/edit a flat file.
^^^Bingo !!! Somebody else hits the nail on the head
Hence the need for "A COMMON API FOR MANIPULATING TEXT IN FLAT FILES"
I've written a utility in plain'Ol C. Its got two functions for reading
and writing flat file config files and a utility that uses them. I'm not
suggesting this become a standard, but something like it should exist in
the core libs??
This is the same type of code I see done over and over again because its
missing from the core API for Unix.
My util....
********
[root@localhost onsight-utils]# readwriteconfig
readwriteconfig -r filename variable
readwriteconfig -w filename variable=value
Examples:
readwriteconfig -w
/etc/sysconfig/networking/profiles/default/ifcfg-eth0
IPADDR=192.168.1.113
Writing will return a single character A=appended C=Changed N=File to
large. Reading will return the variables value only or nothing if the
string is not found
[root@localhost onsight-utils]#
I think you have an interesting idea. Problem is, it would have to assume a
particular structure/format for the file.
Now, suppose you combine your editor (that's what I'm calling your util)
with a pluggable language to describe the format. Then you can keep the
existing config files as they are, don't modify the client programs, yet
have a common front end to do the configuration. But then, isn't that what
Yast and friends are already doing?