Index: src/shell.c ================================================================== --- src/shell.c +++ src/shell.c @@ -4997,11 +4997,11 @@ #if SQLITE_SHELL_IS_UTF8 int SQLITE_CDECL main(int argc, char **argv){ #else int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ - char **argv = 0; + char **argv; #endif char *zErrMsg = 0; ShellState data; const char *zInitFile = 0; int i; @@ -5011,10 +5011,12 @@ int nCmd = 0; char **azCmd = 0; setBinaryMode(stdin, 0); setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ + stdin_is_interactive = isatty(0); + stdout_is_console = isatty(1); #if USE_SYSTEM_SQLITE+0!=1 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", sqlite3_sourceid(), SQLITE_SOURCE_ID); @@ -5035,13 +5037,12 @@ raw_printf(stderr, "out of memory\n"); exit(1); } } #endif + assert( argc>=1 && argv && argv[0] ); Argv0 = argv[0]; - stdin_is_interactive = isatty(0); - stdout_is_console = isatty(1); /* Make sure we have a valid signal handler early, before anything ** else is done. */ #ifdef SIGINT Index: test/shell1.test ================================================================== --- test/shell1.test +++ test/shell1.test @@ -909,11 +909,11 @@ } } } {} do_test shell1-6.0 { - # The file name here is the word "test" in Chinese. + # The base file name here is the word "test" in Chinese. # In UTF-8, it is encoded as: \xE6\xB5\x8B\xE8\xAF\x95 set fileName \u6D4B\u8BD5; append fileName .db set x [catchcmdex $fileName "CREATE TABLE t1(x);\n.schema\n"] set code [lindex $x 0] set res [string trim [lindex $x 1]] @@ -922,11 +922,11 @@ } if {$res ne "CREATE TABLE t1(x);"} { error "failed with mismatch: $res" } if {![file exists $fileName]} { - error "file \"$fileName\" (MBCS) does not exist" + error "file \"$fileName\" (Unicode) does not exist" } forcedelete $fileName } {} finish_test