/ Check-in [7989ce5f]
Login

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

Overview
Comment:Fixes to the "editline" support in the command-line shell.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7989ce5f105657060a39be295255da8eff9ed56e
User & Date: drh 2014-02-11 14:37:51
Context
2014-02-11
16:22
Updates to the command-line shell. Simplify the banner message. Add the ".save" command as an alias for ".backup". When starting with no arguments, include a banner message warning that the database is transient and in-memory and mention the ".open" command. check-in: f5ad1e1b user: drh tags: trunk
14:37
Fixes to the "editline" support in the command-line shell. check-in: 7989ce5f user: drh tags: trunk
01:50
Make sure that virtual WHERE-clause terms do not get transformed into real terms when processing set of OR-connected terms. Fix for ticket [4c86b126f22ad]. check-in: c950d6c4 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

    41     41   # if !defined(__RTP__) && !defined(_WRS_KERNEL)
    42     42   #  include <pwd.h>
    43     43   # endif
    44     44   # include <unistd.h>
    45     45   # include <sys/types.h>
    46     46   #endif
    47     47   
    48         -#ifdef HAVE_EDITLINE
    49         -# include <editline/editline.h>
    50         -#endif
    51         -#if defined(HAVE_READLINE) && HAVE_READLINE==1
           48  +#if defined(HAVE_READLINE) && HAVE_READLINE!=0
    52     49   # include <readline/readline.h>
    53     50   # include <readline/history.h>
           51  +#else
           52  +# undef HAVE_READLINE
    54     53   #endif
    55         -#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
           54  +#if defined(HAVE_EDITLINE) && !defined(HAVE_READLINE)
           55  +# define HAVE_READLINE 1
           56  +# include <editline/readline.h>
           57  +#endif
           58  +#if !defined(HAVE_READLINE)
    56     59   # define add_history(X)
    57     60   # define read_history(X)
    58     61   # define write_history(X)
    59     62   # define stifle_history(X)
    60     63   #endif
    61     64   
    62     65   #if defined(_WIN32) || defined(WIN32)
................................................................................
   409    412   static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
   410    413     char *zPrompt;
   411    414     char *zResult;
   412    415     if( in!=0 ){
   413    416       zResult = local_getline(zPrior, in);
   414    417     }else{
   415    418       zPrompt = isContinuation ? continuePrompt : mainPrompt;
   416         -#if defined(HAVE_READLINE) && HAVE_READLINE==1
          419  +#if defined(HAVE_READLINE)
   417    420       free(zPrior);
   418    421       zResult = readline(zPrompt);
   419    422       if( zResult && *zResult ) add_history(zResult);
   420    423   #else
   421    424       printf("%s", zPrompt);
   422    425       fflush(stdout);
   423    426       zResult = local_getline(zPrior, stdin);
................................................................................
  3757   3760         zHome = find_home_dir();
  3758   3761         if( zHome ){
  3759   3762           nHistory = strlen30(zHome) + 20;
  3760   3763           if( (zHistory = malloc(nHistory))!=0 ){
  3761   3764             sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
  3762   3765           }
  3763   3766         }
  3764         -#if defined(HAVE_READLINE) && HAVE_READLINE==1
         3767  +#if defined(HAVE_READLINE)
  3765   3768         if( zHistory ) read_history(zHistory);
  3766   3769   #endif
  3767   3770         rc = process_input(&data, 0);
  3768   3771         if( zHistory ){
  3769   3772           stifle_history(100);
  3770   3773           write_history(zHistory);
  3771   3774           free(zHistory);