| 8001 | int SQLITE_CDECL main(int argc, char **argv){ |
| 8002 | #else |
| 8003 | int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ |
| 8004 | char **argv; |
| 8005 | #endif |
| 8006 | char *zErrMsg = 0; |
| 8007 | ShellState data; |
| 8008 | const char *zInitFile = 0; |
| 8009 | int i; |
| 8010 | int rc = 0; |
| 8011 | int warnInmemoryDb = 0; |
| 8012 | int readStdin = 1; |
| 8013 | int nCmd = 0; |
| 8014 | char **azCmd = 0; |
| 8015 | |
| 8016 | setBinaryMode(stdin, 0); |
| 8017 | setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ |
| 8018 | stdin_is_interactive = isatty(0); |
| 8019 | stdout_is_console = isatty(1); |
| 8020 | |
| 8021 | #if USE_SYSTEM_SQLITE+0!=1 |
| 8022 | if( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){ |
| 8023 | utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", |
| 8024 | sqlite3_sourceid(), SQLITE_SOURCE_ID); |
| 8025 | exit(1); |
| 8026 | } |
| 8027 | #endif |
| 8028 | main_init(&data); |
| 8029 | #if !SQLITE_SHELL_IS_UTF8 |
| 8030 | sqlite3_initialize(); |
| 8031 | argv = sqlite3_malloc64(sizeof(argv[0])*argc); |
| 8032 | if( argv==0 ){ |
| 8033 | raw_printf(stderr, "out of memory\n"); |
| 8034 | exit(1); |
| 8035 | } |
| 8036 | for(i=0; i<argc; i++){ |
| 8037 | argv[i] = sqlite3_win32_unicode_to_utf8(wargv[i]); |
| 8038 | if( argv[i]==0 ){ |
| 8039 | raw_printf(stderr, "out of memory\n"); |
| 8040 | exit(1); |
| 8041 | } |
| 8042 | } |
| 8043 | #endif |
| 8044 | assert( argc>=1 && argv && argv[0] ); |
| 8045 | Argv0 = argv[0]; |
| 8046 | |
| 8047 | /* Make sure we have a valid signal handler early, before anything |
| 8048 | ** else is done. |
| 8049 | */ |
| 8050 | #ifdef SIGINT |
| 8051 | signal(SIGINT, interrupt_handler); |
| 8052 | #endif |
| 8053 | |
| 8054 | #ifdef SQLITE_SHELL_DBNAME_PROC |
| 8055 | { |
| 8056 | /* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name |
| 8057 | ** of a C-function that will provide the name of the database file. Use |
| 8058 | ** this compile-time option to embed this shell program in larger |
| 8059 | ** applications. */ |
| 8060 | extern void SQLITE_SHELL_DBNAME_PROC(const char**); |
nothing calls this directly
no test coverage detected