xl as config file, programmatic manipulation pitfall
Jeremy Shaw <[email protected]> Thu, 30 Sep 2004 09:39:23 -0700
| Newsgroups | gmane.lisp.scheme.pika.devel |
|---|---|
| Message-ID | <brfnhft0.wl%[email protected]> |
Hello, If xl is to be used in 'config files', it also seems reasonable to expect that some one will want to write a program to manipulate the config file. (Indeed, there are already several GUI frontends for gnu/arch). Looking at existing config file formats, it is clear that the authors of the file formats imagined that the files would only be modified by hand, or entirely programmatically. However, this is not always the case. One example is /etc/samba/smb.conf. This config file is often edited by hand and contains many comments, but is also manipulated by programs that allow users to share directories in their home directories. The problem becomes how to correctly preserve comments. Here is an example illustrating the problem: ----> example start <---- # Some header comments # blah blah blah blah [group1] key1=value1 ; some comment key2=value2 # comment2 key3=value3 # some header comments for group2 [group2] key1=value1 ; some internal comment for group 2 key2=value2 ; some other comment for group 2 #[group3] #key1=value1 #key2=value2 [group4] key1=value1 key2=value2 ---> end example <-- If I write a program that needs to delete group2, it should probably delete the comments associated with group2. It is fairly safe to assume that 'some internal comment for group2' can be deleted since it appears between two keys that belong to [group2]. As I person I can see that I should delete "some header comments for group2" and "some other comment for group2". But any algorithms I can devise to do this will likely delete the commented out [group3], either when I delete [group2] or [group4]. It is my suggestion that the xl comments be designed so that programs can be programmatically transformed without screwing up the comments. Jeremy Shaw. -- This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender and delete the message. Thank you.