SQLite Forum

a teensy .help nit
Login

a teensy .help nit

(1.1) By Larry Brasfield (LarryBrasfield) on 2020-04-06 14:52:12 edited from 1.0 [source]

I have found an almost trivial bug in the shell's .help code.

The .help command, when given a pattern, shows help just for commands matching that pattern. And, if only one matches, it was intended to show all lines of that command's help, which are detected by lack of a leading '.'.

For all commands except the last, it does just that. But for the last, it does not show the last line of help. This is due to an off-by-1 error, fixed thusly:

The code near line 33 in showHelp(...) which reads

  while( j<ArraySize(azHelp)-1 && azHelp[j][0]!='.' ){
should instead read
  while( j<ArraySize(azHelp) && azHelp[j][0]!='.' ){
This cures the problem and meets the concern which drove the j comparison.