Pedro Alves wrote: > On Thursday 24 February 2011 19:11:02, Michael Snyder wrote: >> + if (isdigit (h[1]) || h[1] == '\0' || h[1] == ' ' || h[1] == '\t') >> + /* single-dollar history value */ >> + index = strtol (&h[1], endp, 10); > > Is this correct for the ' ' and '\t' cases? It looks > like it will accept "$ 3" as history value 3, but > it should parsed as "$" -- the last history value. > > You're also not checking if the string is all > digits, so $123asdf is being accepted as $123, while > the language parsers treat that as an internal > variable. Maybe you should take a look at write_dollar_variable, > and factor out or borrow code from there to avoid these > discrepancies? > >> + else if (h[1] == '$' >> + && (isdigit (h[2]) || h[2] == '\0' >> + || h[2] == ' ' || h[2] == '\t')) >> + /* double-dollar history value */ >> + index = -strtol (&h[2], endp, 10); > OK, a major re-write! ;-)