/ Check-in [6bf62463]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:In the command-line shell, the inability to read ~/.sqliterc is no longer a fatal error. A warning is issued, but processing continues.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6bf6246306e6fd490766c0a05932be52a0ed66f2
User & Date: drh 2015-02-28 14:03:35
Context
2015-03-02
17:25
Ensure that automatic indexes are *not* considered when doing the the subqueries of the OR-optimization. check-in: 17890292 user: drh tags: trunk
2015-02-28
14:03
In the command-line shell, the inability to read ~/.sqliterc is no longer a fatal error. A warning is issued, but processing continues. check-in: 6bf62463 user: drh tags: trunk
01:04
More test cases and requirements marks for pragmas. check-in: fc51037c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  4185   4185   
  4186   4186   /*
  4187   4187   ** Read input from the file given by sqliterc_override.  Or if that
  4188   4188   ** parameter is NULL, take input from ~/.sqliterc
  4189   4189   **
  4190   4190   ** Returns the number of errors.
  4191   4191   */
  4192         -static int process_sqliterc(
         4192  +static void process_sqliterc(
  4193   4193     ShellState *p,                  /* Configuration data */
  4194   4194     const char *sqliterc_override   /* Name of config file. NULL to use default */
  4195   4195   ){
  4196   4196     char *home_dir = NULL;
  4197   4197     const char *sqliterc = sqliterc_override;
  4198   4198     char *zBuf = 0;
  4199   4199     FILE *in = NULL;
  4200         -  int rc = 0;
  4201   4200   
  4202   4201     if (sqliterc == NULL) {
  4203   4202       home_dir = find_home_dir();
  4204   4203       if( home_dir==0 ){
  4205         -#if !defined(__RTP__) && !defined(_WRS_KERNEL)
  4206         -      fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
  4207         -#endif
  4208         -      return 1;
         4204  +      fprintf(stderr, "-- warning: cannot find home directory;"
         4205  +                      " cannot read ~/.sqliterc\n");
         4206  +      return;
  4209   4207       }
  4210   4208       sqlite3_initialize();
  4211   4209       zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
  4212   4210       sqliterc = zBuf;
  4213   4211     }
  4214   4212     in = fopen(sqliterc,"rb");
  4215   4213     if( in ){
  4216   4214       if( stdin_is_interactive ){
  4217   4215         fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
  4218   4216       }
  4219         -    rc = process_input(p,in);
         4217  +    process_input(p,in);
  4220   4218       fclose(in);
  4221   4219     }
  4222   4220     sqlite3_free(zBuf);
  4223         -  return rc;
  4224   4221   }
  4225   4222   
  4226   4223   /*
  4227   4224   ** Show available command line options
  4228   4225   */
  4229   4226   static const char zOptions[] = 
  4230   4227     "   -ascii               set output mode to 'ascii'\n"
................................................................................
  4492   4489       open_db(&data, 0);
  4493   4490     }
  4494   4491   
  4495   4492     /* Process the initialization file if there is one.  If no -init option
  4496   4493     ** is given on the command line, look for a file named ~/.sqliterc and
  4497   4494     ** try to process it.
  4498   4495     */
  4499         -  rc = process_sqliterc(&data,zInitFile);
  4500         -  if( rc>0 ){
  4501         -    return rc;
  4502         -  }
         4496  +  process_sqliterc(&data,zInitFile);
  4503   4497   
  4504   4498     /* Make a second pass through the command-line argument and set
  4505   4499     ** options.  This second pass is delayed until after the initialization
  4506   4500     ** file is processed so that the command-line arguments will override
  4507   4501     ** settings in the initialization file.
  4508   4502     */
  4509   4503     for(i=1; i<argc; i++){