Re: [LHA-misc] Line parsing routine
Status: Beta
Brought to you by:
ncherry
From: Neil C. <nc...@ho...> - 2000-11-26 18:38:03
|
Tom Hull wrote: > > Neil Cherry wrote: > > > > I need a line parsing routine, the one I'm currently using is Dan > > Lanciaci's and his Licensing differs from the GPL. Besides we will be > > going with Jay's suggestion of set addr=<BLAH> value=<yadayada>. The > > format is not exactly worked out at this time. So does anyone have any > > code? > > I have lots of command line scanning code -- split string into argc/argv, > various quoting, escape sequences, up through substitutions, expression > evaluation, full-bore scripting languages. What do you want? Sorry it took so long I've been hack a bunch of code. I need something that will take a line and determine what command the user want to attempt. I will guess there are only 2 commands a set and a get (If anyone can think of others let me know). The next part is the addr= and the last part is the value=. The addr= has format of <interface>.<point>[.<item>[.<item> ...] Each entry will be ascii numbers (literals 0-9 n amount of times up to the '.') so it can be typed in from a telnet. The value= has a string format terminated by a null (the null will not need to be sent). The string may need to be converted into a number or stored as a string. This way we can send strings with escape sequences, hmm we may need to support being able to send \xxx sequences. Should we translate them of just accept the 8 bit character? I know there are some 8 bit characters I can't send from telnet. So I guess we need escape character support. This was taken from Jay Hogg's recommendation, I hate it because it's hard to remember (and !12000200 is?) but it is simple and I think it covers all types of commands that can be sent. Maybe instead of value we can change that to num= , str=, hex=, oct=, etc? Hey this is becoming more object oriented! -- Linux Home Automation Neil Cherry nc...@ho... http://members.home.net/ncherry (Text only) http://meltingpot.fortunecity.com/lightsey/52 (Graphics) http://linuxha.sourceforge.net/ (SourceForge) |