mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-05 04:30:38 +03:00
In the ".output" command-line shell, if the first character of the output
filename is '|' then use popen() instead of fopen(). FossilOrigin-Name: fa82062c659ffbe7ad01106d3ef54d7bb44f1f44
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\scompiler\swarnings\son\sGCC\sand\sMSVC\sand\sfix\sa\sC89-ism\sthat\nbroke\sthe\sbuild\sfor\sMSVC.
|
||||
D 2012-03-30T00:00:36.020
|
||||
C In\sthe\s".output"\scommand-line\sshell,\sif\sthe\sfirst\scharacter\sof\sthe\soutput\nfilename\sis\s'|'\sthen\suse\spopen()\sinstead\sof\sfopen().
|
||||
D 2012-03-30T00:05:57.960
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -182,7 +182,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||
F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c f6f141cb1ea13f1e6564d3e162700e4937baa2a1
|
||||
F src/shell.c 3179db5d4ff33d62d59a024dbfd2a116390ef7b0
|
||||
F src/shell.c abf18d6ee54f2631860a98fdd7ab1327f470db67
|
||||
F src/sqlite.h.in 11a883919b0baf4ffaa7550cfeef99be613ec2bf
|
||||
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
||||
F src/sqliteInt.h 3756ece33f1e7f8fe2adf8e523566825c809316e
|
||||
@@ -999,7 +999,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
P 4d6de3e9bef3487f2d89167939ab2c42872d05b3
|
||||
R 6a2a98746d07ae9d5d747d484bebf83b
|
||||
P b451c0f97f0abe78ebe6c62ff489ec1ad8a1f767
|
||||
R c9f2c82ab656ee1565b2ea7a350213e8
|
||||
U drh
|
||||
Z 63420a987b6627df7e88c714721af80a
|
||||
Z 500f8e52607292e3d3c61e303b3bc0be
|
||||
|
||||
@@ -1 +1 @@
|
||||
b451c0f97f0abe78ebe6c62ff489ec1ad8a1f767
|
||||
fa82062c659ffbe7ad01106d3ef54d7bb44f1f44
|
||||
15
src/shell.c
15
src/shell.c
@@ -68,6 +68,8 @@
|
||||
# include <io.h>
|
||||
#define isatty(h) _isatty(h)
|
||||
#define access(f,m) _access((f),(m))
|
||||
#define popen(a,b) _popen((a),(b))
|
||||
#define pclose(x) _pclose(x)
|
||||
#else
|
||||
/* Make sure isatty() has a prototype.
|
||||
*/
|
||||
@@ -1999,11 +2001,24 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
|
||||
if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
|
||||
if( p->out!=stdout ){
|
||||
if( p->outfile[0]=='|' ){
|
||||
pclose(p->out);
|
||||
}else{
|
||||
fclose(p->out);
|
||||
}
|
||||
}
|
||||
if( strcmp(azArg[1],"stdout")==0 ){
|
||||
p->out = stdout;
|
||||
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "stdout");
|
||||
}else if( azArg[1][0]=='|' ){
|
||||
p->out = popen(&azArg[1][1], "w");
|
||||
if( p->out==0 ){
|
||||
fprintf(stderr,"Error: cannot open pipe \"%s\"\n", &azArg[1][1]);
|
||||
p->out = stdout;
|
||||
rc = 1;
|
||||
}else{
|
||||
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
|
||||
}
|
||||
}else{
|
||||
p->out = fopen(azArg[1], "wb");
|
||||
if( p->out==0 ){
|
||||
|
||||
Reference in New Issue
Block a user