Add the ".shell" and the ".system" commands (aliases for the same thing)

to the command-line shell.

FossilOrigin-Name: d018a34a05cec6adda61ed225d084c587343f2a6
This commit is contained in:
drh 2014-05-28 20:22:28 +00:00
parent 3b21f6d62d
commit 62cdde539c
3 changed files with 26 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Add\san\sextra\stest\sto\sverify\sthat\sthe\sFTS\snotindexed\soption\sis\sworking.
D 2014-05-28T10:00:38.278
C Add\sthe\s".shell"\sand\sthe\s".system"\scommands\s(aliases\sfor\sthe\ssame\sthing)\nto\sthe\scommand-line\sshell.
D 2014-05-28T20:22:28.746
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -221,7 +221,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66
F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be
F src/select.c 7df17ec5506c2427576d412bee0e6ea740e12563
F src/shell.c bfac06fb15f3cd0d447e2e72ab3a283fac301813
F src/shell.c 8a0f8f4cd354a1b9f8181d747943c86c678dccfc
F src/sqlite.h.in 564fc23db33870b5096b20d72df7491ce0b8b74f
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@ -1173,7 +1173,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P c405f971cf03e29110019ff863cbfb026d97e1e6
R e5a9e845a94856ba3834be3d275aa741
U dan
Z 682e816d8cc7267dd27dd1b8bd8b3242
P c461c0fe051d33cc8b4fede4eca13cd71f28126a
R fb95d3a0c98ad15d709d47a9c08467f3
U drh
Z 7af2c566de91be5522e4d89625d0c4dc

View File

@ -1 +1 @@
c461c0fe051d33cc8b4fede4eca13cd71f28126a
d018a34a05cec6adda61ed225d084c587343f2a6

View File

@ -1580,7 +1580,7 @@ static char zHelp[] =
".exit Exit this program\n"
".explain ?ON|OFF? Turn output mode suitable for EXPLAIN on or off.\n"
" With no args, it turns EXPLAIN on.\n"
".header(s) ON|OFF Turn display of headers on or off\n"
".headers ON|OFF Turn display of headers on or off\n"
".help Show this message\n"
".import FILE TABLE Import data from FILE into TABLE\n"
".indices ?TABLE? Show names of all indices\n"
@ -1616,8 +1616,10 @@ static char zHelp[] =
" If TABLE specified, only show tables matching\n"
" LIKE pattern TABLE.\n"
".separator STRING Change separator used by output mode and .import\n"
".shell CMD ARGS... Run CMD ARGS... in a system shell\n"
".show Show the current values for various settings\n"
".stats ON|OFF Turn stats on or off\n"
".system CMD ARGS... Run CMD ARGS... in a system shell\n"
".tables ?TABLE? List names of tables\n"
" If TABLE specified, only list tables matching\n"
" LIKE pattern TABLE.\n"
@ -1625,6 +1627,7 @@ static char zHelp[] =
".trace FILE|off Output each SQL statement as it is run\n"
".vfsname ?AUX? Print the name of the VFS stack\n"
".width NUM1 NUM2 ... Set column widths for \"column\" mode\n"
" Negative values right-justify\n"
;
static char zTimerHelp[] =
@ -2900,6 +2903,20 @@ static int do_meta_command(char *zLine, struct callback_data *p){
"%.*s", (int)sizeof(p->separator)-1, azArg[1]);
}else
if( c=='s'
&& (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
&& nArg>=2
){
char *zCmd;
int i;
zCmd = sqlite3_mprintf("\"%s\"", azArg[1]);
for(i=2; i<nArg; i++){
zCmd = sqlite3_mprintf("%z \"%s\"", zCmd, azArg[i]);
}
system(zCmd);
sqlite3_free(zCmd);
}else
if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
int i;
fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");