Skip to content

Commit

Permalink
Added version info to shell application
Browse files Browse the repository at this point in the history
  • Loading branch information
utelle committed Dec 10, 2020
1 parent e27c041 commit 9b613b4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The code was mainly developed under Windows, but was tested under Linux as well.

* 1.1.2 - *December 2020*
- Fixed a bug on cipher configuration via PRAGMA commands or URI parameters
- Added SQLite3 Multple Ciphers version info to shell application
* 1.1.1 - *December 2020*
- Fixed a bug on removing encryption from an encrypted database
* 1.1.0 - *December 2020*
Expand Down
18 changes: 18 additions & 0 deletions scripts/patchshell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
# Generate patched shell.c from SQLite3 amalgamation distribution and write it to stdout.
# Usage: ./script/patchshell.sh shell.c >shellpatched.c

INPUT="$([ "$#" -eq 1 ] && echo "$1" || echo "shell.c")"
if ! [ -f "$INPUT" ]; then
echo "Usage: $0 <SQLITE3_SHELL_AMALGAMATION>" >&2
echo " e.g.: $0 shell.c" >&2
exit 1
fi

die() {
echo "[-]" "$@" >&2
exit 2
}

sed -e '/int nHistory;/{n;N;N;N;N;d}' "$INPUT" \
| sed '/int nHistory;/a \ extern char* sqlite3mc_version();\n printf(\n "SQLite version \%s \%.19s" \/\*extra-version-info\*\/\n " (\%s)\\n" \/\*SQLite3-Multiple-Ciphers-version-info\*\/\n "Enter \\".help\\" for usage hints.\\n\",\n sqlite3_libversion(), sqlite3_sourceid(), sqlite3mc_version()\n );'
6 changes: 4 additions & 2 deletions src/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -21323,10 +21323,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
char *zHome;
char *zHistory;
int nHistory;
extern char* sqlite3mc_version();
printf(
"SQLite version %s %.19s\n" /*extra-version-info*/
"SQLite version %s %.19s" /*extra-version-info*/
" (%s)\n" /*SQLite3-Multiple-Ciphers-version-info*/
"Enter \".help\" for usage hints.\n",
sqlite3_libversion(), sqlite3_sourceid()
sqlite3_libversion(), sqlite3_sourceid(), sqlite3mc_version()
);
if( warnInmemoryDb ){
printf("Connected to a ");
Expand Down

0 comments on commit 9b613b4

Please sign in to comment.