diff options
author | drh <drh@noemail.net> | 2018-10-10 18:56:40 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-10-10 18:56:40 +0000 |
commit | a9e4be3b08123dcb20d506f3c4429e4f25961498 (patch) | |
tree | 4a1d9af1f7f7ea9c5bc6d3bdbbfd40c16bf3bb5d /src | |
parent | 7dd630a893454538092cce2ac811e85e6fb95190 (diff) | |
download | sqlite-a9e4be3b08123dcb20d506f3c4429e4f25961498.tar.gz sqlite-a9e4be3b08123dcb20d506f3c4429e4f25961498.zip |
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.
FossilOrigin-Name: 696e82f7c82d1720756078e73f3b15b4cafc202ec290e66f9095a3246c65a3cb
Diffstat (limited to 'src')
-rw-r--r-- | src/shell.c.in | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shell.c.in b/src/shell.c.in index fe242af13..a5ab14383 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -8858,7 +8858,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ */ if( stdin_is_interactive ){ char *zHome; - char *zHistory = 0; + char *zHistory; int nHistory; printf( "SQLite version %s %.19s\n" /*extra-version-info*/ @@ -8871,8 +8871,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ printf(".\nUse \".open FILENAME\" to reopen on a " "persistent database.\n"); } - zHome = find_home_dir(0); - if( zHome ){ + zHistory = getenv("SQLITE_HISTORY"); + if( zHistory ){ + zHistory = strdup(zHistory); + }else if( (zHome = find_home_dir(0))!=0 ){ nHistory = strlen30(zHome) + 20; if( (zHistory = malloc(nHistory))!=0 ){ sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome); |