/ Check-in [e58f4bd3]
Login

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

Overview
Comment:Only quote the arguments to the ".shell" and ".system" commands if they contain spaces.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e58f4bd39d51c4c1a28684dab6427de81173d564
User & Date: drh 2014-05-29 03:17:29
Context
2014-05-29
12:36
Improvements to error messages for errors in the dot-commands of the command-line shell. Add the ".once" command. The output of ".help" now goes to the designated output channel. check-in: 48dce821 user: drh tags: trunk
03:17
Only quote the arguments to the ".shell" and ".system" commands if they contain spaces. check-in: e58f4bd3 user: drh tags: trunk
2014-05-28
20:22
Add the ".shell" and the ".system" commands (aliases for the same thing) to the command-line shell. check-in: d018a34a user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

2905
2906
2907
2908
2909
2910
2911
2912
2913

2914
2915
2916
2917
2918
2919
2920
2921

  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;







|

>
|







2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922

  if( c=='s'
   && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
   && nArg>=2
  ){
    char *zCmd;
    int i;
    zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
    for(i=2; i<nArg; i++){
      zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
                             zCmd, azArg[i]);
    }
    system(zCmd);
    sqlite3_free(zCmd);
  }else

  if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
    int i;