/ Check-in [9c424a5c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Correct help text and make consistent use of snprintf.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | asciiMode
Files: files | file ages | folders
SHA1:9c424a5c50e4a2ed36556e99fba0e7072a2d3468
User & Date: mistachkin 2014-07-24 22:51:18
Context
2014-09-01
01:15
Merge updates from trunk. check-in: 51f33cf1 user: mistachkin tags: asciiMode
2014-07-24
22:51
Correct help text and make consistent use of snprintf. check-in: 9c424a5c user: mistachkin tags: asciiMode
22:33
Update a shell test case. check-in: b84008cb user: mistachkin tags: asciiMode
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
....
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
    }
  }else
#endif

  if( c=='r' && strncmp(azArg[0], "rowseparator", n)==0 ){
    if( nArg==2 ){
      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator,
                       "%.*s", (int)sizeof(p->rowSeparator)-1, azArg[1]);
    }else{
      fprintf(stderr, "Usage: .rowseparator STRING\n");
      rc = 1;
    }
  }else

  if( c=='c' && strncmp(azArg[0], "colseparator", n)==0 ){
    if( nArg==2 ){
      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
                       "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]);
    }else{
      fprintf(stderr, "Usage: .colseparator STRING\n");
      rc = 1;
    }
  }else

  if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){
    if( nArg<2 || nArg>3 ){
      fprintf(stderr, "Usage: .separator SEPARATOR ?NEWLINE?\n");
      rc = 1;
    }
    if( nArg>=2 ){
      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
                       "%.*s", (int)sizeof(p->colSeparator)-1, azArg[1]);
    }
    if( nArg>=3 ){
      sqlite3_snprintf(sizeof(p->newline), p->newline,
                       "%.*s", (int)sizeof(p->newline)-1, azArg[2]);
    }
  }else

  if( c=='s'
   && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
  ){
    char *zCmd;
................................................................................
/*
** Show available command line options
*/
static const char zOptions[] = 
  "   -ascii               set output mode to 'ascii'\n"
  "   -bail                stop after hitting an error\n"
  "   -batch               force batch I/O\n"
  "   -colseparator SEP    same as -separator with one argument\n"
  "   -column              set output mode to 'column'\n"
  "   -cmd COMMAND         run \"COMMAND\" before reading stdin\n"
  "   -csv                 set output mode to 'csv'\n"
  "   -echo                print commands before execution\n"
  "   -init FILENAME       read/process named file\n"
  "   -[no]header          turn headers on or off\n"
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)







|









|













|



|







 







|







3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
....
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
    }
  }else
#endif

  if( c=='r' && strncmp(azArg[0], "rowseparator", n)==0 ){
    if( nArg==2 ){
      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator,
                       "%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[1]);
    }else{
      fprintf(stderr, "Usage: .rowseparator STRING\n");
      rc = 1;
    }
  }else

  if( c=='c' && strncmp(azArg[0], "colseparator", n)==0 ){
    if( nArg==2 ){
      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
                       "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]);
    }else{
      fprintf(stderr, "Usage: .colseparator STRING\n");
      rc = 1;
    }
  }else

  if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){
    if( nArg<2 || nArg>3 ){
      fprintf(stderr, "Usage: .separator SEPARATOR ?NEWLINE?\n");
      rc = 1;
    }
    if( nArg>=2 ){
      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
                       "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]);
    }
    if( nArg>=3 ){
      sqlite3_snprintf(sizeof(p->newline), p->newline,
                       "%.*s", (int)ArraySize(p->newline)-1, azArg[2]);
    }
  }else

  if( c=='s'
   && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
  ){
    char *zCmd;
................................................................................
/*
** Show available command line options
*/
static const char zOptions[] = 
  "   -ascii               set output mode to 'ascii'\n"
  "   -bail                stop after hitting an error\n"
  "   -batch               force batch I/O\n"
  "   -colseparator SEP    same as -separator\n"
  "   -column              set output mode to 'column'\n"
  "   -cmd COMMAND         run \"COMMAND\" before reading stdin\n"
  "   -csv                 set output mode to 'csv'\n"
  "   -echo                print commands before execution\n"
  "   -init FILENAME       read/process named file\n"
  "   -[no]header          turn headers on or off\n"
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)