-C Only\sprint\sthe\s"Loading\sresources\sfrom..."\sline\swhen\sthe\soutput\sis\sa\sTTY.\nTicket\s#168.\s(CVS\s939)
-D 2003-04-26T02:50:11
+C Fix\sthe\sshell\stool\sto\sdo\sa\sbetter\sjob\sof\signoring\swhitespace.\s\sTicket\s#234.\s(CVS\s940)
+D 2003-04-26T03:03:07
F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/printf.c fc5fdef6e92ad205005263661fe9716f55a49f3e
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c dfc13cb62ba658c4463179713c40ee25a062b2ba
-F src/shell.c 137f4a1e3abe9da97c32d07f78fb0d60e4764fe2
+F src/shell.c 6557e37e6c34564b72d6b98da23a88eb6ed88d59
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in eec06462cba262c0ee03f38462a18a4bc66dda4e
F src/sqliteInt.h 0c7474068c37a5aad715810c8190266edcbd4f4c
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P acf9e9802fa6396df5653ca4e72ab4ec2333509d
-R 73d63156ebfdfb609f263f8398d35bd9
+P 92ded93376635f37e2f5a7a8f4077c85d5bce735
+R a6549a02bf88e45588d8dc89d4315963
U drh
-Z dce4473556dffe669a617d39555a8689
+Z 2a7401700105d8209d91c7c271e81f42
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
-** $Id: shell.c,v 1.72 2003/04/26 02:50:11 drh Exp $
+** $Id: shell.c,v 1.73 2003/04/26 03:03:07 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
return rc;
}
-/*
-** Skip over an SQL comments and whitespace. Return a pointer to the text that
-** follows the comments and whitespace.
-*/
-static char *skip_whitespace(char *z){
- while( isspace(*z) ){ z++; }
- while( z[0]=='-' && z[1]=='-' ){
- z += 2;
- while( *z && *z!='\n' ){ z++; }
- while( isspace(*z) ){ z++; }
- }
- return z;
-}
-
/*
** Return TRUE if the last non-whitespace character in z[] is a semicolon.
** z[] is N characters long.
return N>0 && z[N-1]==';';
}
+/*
+** Test to see if a line consists entirely of whitespace.
+*/
+static int _all_whitespace(const char *z){
+ for(; *z; z++){
+ if( isspace(*z) ) continue;
+ if( *z=='/' && z[1]=='*' ){
+ z += 2;
+ while( *z && (*z!='*' || z[1]!='/') ){ z++; }
+ if( *z==0 ) return 0;
+ z++;
+ continue;
+ }
+ if( *z=='-' && z[1]=='-' ){
+ z += 2;
+ while( *z && *z!='\n' ){ z++; }
+ if( *z==0 ) return 1;
+ continue;
+ }
+ return 0;
+ }
+ return 1;
+}
+
/*
** Read input from *in and process it. If *in==0 then input
** is interactive - the user is typing it it. Otherwise, input
seenInterrupt = 0;
}
if( p->echoOn ) printf("%s\n", zLine);
+ if( _all_whitespace(zLine) ) continue;
if( zLine && zLine[0]=='.' && nSql==0 ){
int rc = do_meta_command(zLine, db, p);
free(zLine);
}
}
if( zSql ){
- char *zTail = skip_whitespace(zSql);
- if( zTail && zTail[0] ) printf("Incomplete SQL: %s\n", zSql);
+ if( !_all_whitespace(zSql) ) printf("Incomplete SQL: %s\n", zSql);
free(zSql);
}
}