Rainer Weikusat: ... > But "avoid writing parsers where feasible" is IMHO a sound piece > of advice. Eg, in case some sort of 'config file format' is needed, it's > often possible to get by by writing a set of > > variable=value > > statements in Bourne shell syntax and replace the 'start the program' > command with a shell script sourcing the config file and starting the > real program with command-line arguments corresponding to the values > from the config file: The shell already has a parser and since typical ...
Ack, but sometimes you get data from files which are not disk files, and you could get it at runtime, and not at start time. > [*] I once wrote a parser for SMTP headers which actually required an > additional state-stack in order to be able to 'go back to where we were > before encountering this'. I have not a parser, but a string splitter in: http://turkos.aspodata.se/git/c/libaspoutil/parse.c http://turkos.aspodata.se/git/c/libaspoutil/parse.h It splits a string in what I belive shell style. What you do with the tokens that is your business. It could use some love on the doc side and some real world testing. Regards, /Karl Hammar ----------------------------------------------------------------------- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57 _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
