aboutsummaryrefslogtreecommitdiff
path: root/src/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell.c')
-rw-r--r--src/shell.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/shell.c b/src/shell.c
index 79548fa1e..7b8a8ad7f 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -65,7 +65,7 @@
#define isatty(h) _isatty(h)
#define access(f,m) _access((f),(m))
#undef popen
-#define popen(a,b) _popen((a),(b))
+#define popen _popen
#undef pclose
#define pclose _pclose
#else
@@ -74,6 +74,11 @@
extern int isatty(int);
#endif
+/* popen and pclose are not C89 functions and so are sometimes omitted from
+** the <stdio.h> header */
+FILE *popen(const char*,const char*);
+int pclose(FILE*);
+
#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
* thus we always assume that we have a console. That can be
@@ -1721,7 +1726,6 @@ static char *csv_read_one_field(CSVReader *p){
|| (c==EOF && pc==cQuote)
){
do{ p->n--; }while( p->z[p->n]!=cQuote );
- p->z[p->n] = 0;
p->cTerm = c;
break;
}
@@ -1732,7 +1736,6 @@ static char *csv_read_one_field(CSVReader *p){
if( c==EOF ){
fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
p->zFile, startLine, cQuote);
- p->z[p->n] = 0;
p->cTerm = EOF;
break;
}
@@ -1748,9 +1751,9 @@ static char *csv_read_one_field(CSVReader *p){
p->nLine++;
if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--;
}
- p->z[p->n] = 0;
p->cTerm = c;
}
+ if( p->z ) p->z[p->n] = 0;
return p->z;
}
@@ -1799,7 +1802,6 @@ static int do_meta_command(char *zLine, struct callback_data *p){
if( c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0 ){
const char *zDestFile = 0;
const char *zDb = 0;
- const char *zKey = 0;
sqlite3 *pDest;
sqlite3_backup *pBackup;
int j;
@@ -1807,9 +1809,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
const char *z = azArg[j];
if( z[0]=='-' ){
while( z[0]=='-' ) z++;
- if( strcmp(z,"key")==0 && j<nArg-1 ){
- zKey = azArg[++j];
- }else
+ /* No options to process at this time */
{
fprintf(stderr, "unknown option: %s\n", azArg[j]);
return 1;
@@ -1835,11 +1835,6 @@ static int do_meta_command(char *zLine, struct callback_data *p){
sqlite3_close(pDest);
return 1;
}
-#ifdef SQLITE_HAS_CODEC
- sqlite3_key(pDest, zKey, (int)strlen(zKey));
-#else
- (void)zKey;
-#endif
open_db(p);
pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
if( pBackup==0 ){
@@ -2669,7 +2664,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
/* sqlite3_test_control(int, uint) */
case SQLITE_TESTCTRL_PENDING_BYTE:
if( nArg==3 ){
- unsigned int opt = (unsigned int)integerValue(azArg[2]);
+ unsigned int opt = (unsigned int)integerValue(azArg[2]);
rc = sqlite3_test_control(testctrl, opt);
fprintf(p->out, "%d (0x%08x)\n", rc, rc);
} else {