On Wed, 2004-07-28 at 17:48 +0100, Jonathan Andrews wrote: > On Wed, 2004-07-28 at 17:33, Felipe Alfaro Solana wrote: > > On Wed, 2004-07-28 at 15:38 +0100, Jonathan Andrews wrote: > > > If it cant be edited by a text editor its a bad idea. > > > > No, it's not... If something is damaged, broken or corrupted, it can be > > easily fixed by using a simple line or text editor. You can even boot > > from a bootable recue CD and fix the problem. Can you do that with > > Windoze propietary, binary, monolithic registry? No. > > > Errrrr .... so like I said > > "If it CANT be edited by a text editor its a BAD idea" ??? > > You have just argued that you agree with that I said ? My original post > was poor English, I apologise - but I think you have miss understood. Im > pushing for plain text - but with an API for manipulating text. My key > point is that the API should be common to all Linux, not left for people > to write the same code over and over again .... > > 1) reading VARIABLE=value pairs and > 2) writing VARIABLE=value pairs. > > > So the plain text file with this > > DEVICE=eth0 > BOOTPROTO=none > ONBOOT=yes > IPADDR=10.10.10.5 > NETMASK=255.255.255.0 > USERCTL=no > PEERDNS=no > GATEWAY=10.10.10.1 > TYPE=Ethernet > > could be altered with a function like this > > result=write_configfile("/etc/sysconfig/networking/ifcfg-eth0","ONBOOT","no"); > > and > > result=read_configfile("/etc/sysconfig/networking/ifcfg-eth0","ONBOOT",&mystring); > > See ... simple for programmer - and all plain text. This is probably a perverse viewpoint (I'm an XML junkie), but I don't think this is simple. Some awkward questions: - What encoding are the names? the values? - What if a name or a value needs to contain an equals sign, a carriage return, or a line feed? (What about DOS vs UNIX linefeeds for that matter?) - How long can a name be? - How long can a value be? - Is case significant? - What happens if a text file contains multiple lines with the same VARIABLE name? - What happens if a text file contains multiple lines with variables that map to the same unicode string after canonicalisation, but which are different before canonicalisation? - Do you canonicalise variable names when testing for equality? - Does ordering matter? How is this expressed in the API? - What whitespace (if any) are you allowed in the file? Can this be represented/manipulated within the API? - Can the text file contain comments? Can it contain blank lines? Can these be represented/manipulated within the API? > > Jon > > >