RE: [Sablevm-developer] Re: Config File Parsing
Brought to you by:
egagnon
From: Brent F. <bre...@xp...> - 2000-12-07 19:04:02
|
> A very simple program could read options from a configuration > file, strip leading/trailing space characters (at the line > beginning/end, and around the first "=" character) then add > a "--" prefix, then store the result in an array of strings, > then simply add to this array the strings of argv[]. As > usual, empty lines (after stripping) and comment lines > (starting with #) would be ignored. Line continuation > support would be nice to have, too;-) > I've got this pretty much coded up. One thing I'm curious about is this: Let's say I have a master config file in e.g., /etc/sablevmrc: boot-class-path = /usr/share/sable/classes boot-library-path = /usr/lib/sable And I have my own config file in $HOME/.sablevmrc: boot-class-path = /usr/src/sablepath/classes boot-library-path = /usr/src/sablepath/lib And I write my command line: #>sablevm --boot-class-path=/usr/src/sable2/classes -- HelloWorld I believe that the command line should take precedence over the $HOME sable config file, and the $HOME config file over the system config file. If so, I think I'll have to take a pass through the files first, tossing out duplicates per the above rules of precedence. What do you think? -Brent |