Index: src/shell.c ================================================================== --- src/shell.c +++ src/shell.c @@ -1581,10 +1581,11 @@ ".print STRING... Print literal STRING\n" ".prompt MAIN CONTINUE Replace the standard prompts\n" ".quit Exit this program\n" ".read FILENAME Execute SQL in FILENAME\n" ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n" + ".save FILE Write in-memory database into FILE\n" ".schema ?TABLE? Show the CREATE statements\n" " If TABLE specified, only show tables matching\n" " LIKE pattern TABLE.\n" ".separator STRING Change separator used by output mode and .import\n" ".show Show the current values for various settings\n" @@ -2150,11 +2151,13 @@ /* Process the input line. */ if( nArg==0 ) return 0; /* no tokens, no error */ n = strlen30(azArg[0]); c = azArg[0][0]; - if( c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0 ){ + if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0) + || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0) + ){ const char *zDestFile = 0; const char *zDb = 0; sqlite3 *pDest; sqlite3_backup *pBackup; int j; @@ -3499,29 +3502,26 @@ sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); } /* -** Arrange for subsequent text console output to be RED or normal. Use -** the SetConsoleTextAttribute() function on windows. On all other -** platforms, assume VT100 escape sequences are recognized. +** Output text to the console in a font that attracts extra attention. */ #ifdef _WIN32 -static void outputRed(void){ - SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), - FOREGROUND_RED|FOREGROUND_INTENSITY); -} -static void outputNormal(void){ - SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), - FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); +static void printBold(const char *zText){ + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo; + GetConsoleScreenBufferInfo(out, &defaultScreenInfo); + SetConsoleTextAttribute(out, + FOREGROUND_RED|FOREGROUND_INTENSITY + ); + printf("%s", zText); + SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes); } #else -static void outputRed(void){ - printf("\033[1m"); -} -static void outputNormal(void){ - printf("\033[0m"); +static void printBold(const char *zText){ + printf("\033[1m%s\033[0m", zText); } #endif /* ** Get the argument to an --option. Throw an error and die if no argument @@ -3778,14 +3778,12 @@ "Enter \".help\" for usage hints.\n", sqlite3_libversion(), sqlite3_sourceid() ); if( warnInmemoryDb ){ printf("Connected to a "); - outputRed(); - printf("transient in-memory database"); - outputNormal(); - printf(".\nUse \".open FILENAME\" to reopen on a " + printBold("transient in-memory database."); + printf("\nUse \".open FILENAME\" to reopen on a " "persistent database.\n"); } zHome = find_home_dir(); if( zHome ){ nHistory = strlen30(zHome) + 20;