/ Check-in [696e82f7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the CLI, allow the SQLITE_HISTORY environment variable, if it exists, to specify an alternative file in which to store the shell edit history.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 696e82f7c82d1720756078e73f3b15b4cafc202ec290e66f9095a3246c65a3cb
User & Date: drh 2018-10-10 18:56:40
Context
2018-10-11
02:39
In the unix VFS, fix the heap shm allocator (used for unix-excl) so that it works even on systems where the page size is larger than 32KB. check-in: 7fbb083c user: drh tags: trunk
2018-10-10
18:56
In the CLI, allow the SQLITE_HISTORY environment variable, if it exists, to specify an alternative file in which to store the shell edit history. check-in: 696e82f7 user: drh tags: trunk
2018-10-08
20:04
Fix an issue with the new memstat.c extension. check-in: ce6e80b1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

  8854   8854       }
  8855   8855       free(azCmd);
  8856   8856     }else{
  8857   8857       /* Run commands received from standard input
  8858   8858       */
  8859   8859       if( stdin_is_interactive ){
  8860   8860         char *zHome;
  8861         -      char *zHistory = 0;
         8861  +      char *zHistory;
  8862   8862         int nHistory;
  8863   8863         printf(
  8864   8864           "SQLite version %s %.19s\n" /*extra-version-info*/
  8865   8865           "Enter \".help\" for usage hints.\n",
  8866   8866           sqlite3_libversion(), sqlite3_sourceid()
  8867   8867         );
  8868   8868         if( warnInmemoryDb ){
  8869   8869           printf("Connected to a ");
  8870   8870           printBold("transient in-memory database");
  8871   8871           printf(".\nUse \".open FILENAME\" to reopen on a "
  8872   8872                  "persistent database.\n");
  8873   8873         }
  8874         -      zHome = find_home_dir(0);
  8875         -      if( zHome ){
         8874  +      zHistory = getenv("SQLITE_HISTORY");
         8875  +      if( zHistory ){
         8876  +        zHistory = strdup(zHistory);
         8877  +      }else if( (zHome = find_home_dir(0))!=0 ){
  8876   8878           nHistory = strlen30(zHome) + 20;
  8877   8879           if( (zHistory = malloc(nHistory))!=0 ){
  8878   8880             sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
  8879   8881           }
  8880   8882         }
  8881   8883         if( zHistory ){ shell_read_history(zHistory); }
  8882   8884   #if HAVE_READLINE || HAVE_EDITLINE