SQLite

Check-in [6bf6246306]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6bf6246306e6fd490766c0a05932be52a0ed66f2
User & Date: drh 2015-02-28 14:03:35.210
Context
2015-03-02
17:25
Ensure that automatic indexes are *not* considered when doing the the subqueries of the OR-optimization. (check-in: 17890292cf 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: 6bf6246306 user: drh tags: trunk)
01:04
More test cases and requirements marks for pragmas. (check-in: fc51037cd9 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/shell.c.
4185
4186
4187
4188
4189
4190
4191
4192

4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206

4207
4208


4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219

4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4185
4186
4187
4188
4189
4190
4191

4192
4193
4194
4195
4196
4197
4198
4199

4200
4201
4202
4203


4204


4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216

4217
4218
4219
4220

4221
4222
4223
4224
4225
4226
4227







-
+







-




-
-
+
-
-
+
+










-
+



-








/*
** Read input from the file given by sqliterc_override.  Or if that
** parameter is NULL, take input from ~/.sqliterc
**
** Returns the number of errors.
*/
static int process_sqliterc(
static void process_sqliterc(
  ShellState *p,                  /* Configuration data */
  const char *sqliterc_override   /* Name of config file. NULL to use default */
){
  char *home_dir = NULL;
  const char *sqliterc = sqliterc_override;
  char *zBuf = 0;
  FILE *in = NULL;
  int rc = 0;

  if (sqliterc == NULL) {
    home_dir = find_home_dir();
    if( home_dir==0 ){
#if !defined(__RTP__) && !defined(_WRS_KERNEL)
      fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
      fprintf(stderr, "-- warning: cannot find home directory;"
#endif
      return 1;
                      " cannot read ~/.sqliterc\n");
      return;
    }
    sqlite3_initialize();
    zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
    sqliterc = zBuf;
  }
  in = fopen(sqliterc,"rb");
  if( in ){
    if( stdin_is_interactive ){
      fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
    }
    rc = process_input(p,in);
    process_input(p,in);
    fclose(in);
  }
  sqlite3_free(zBuf);
  return rc;
}

/*
** Show available command line options
*/
static const char zOptions[] = 
  "   -ascii               set output mode to 'ascii'\n"
4492
4493
4494
4495
4496
4497
4498
4499

4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4489
4490
4491
4492
4493
4494
4495

4496



4497
4498
4499
4500
4501
4502
4503







-
+
-
-
-







    open_db(&data, 0);
  }

  /* Process the initialization file if there is one.  If no -init option
  ** is given on the command line, look for a file named ~/.sqliterc and
  ** try to process it.
  */
  rc = process_sqliterc(&data,zInitFile);
  process_sqliterc(&data,zInitFile);
  if( rc>0 ){
    return rc;
  }

  /* Make a second pass through the command-line argument and set
  ** options.  This second pass is delayed until after the initialization
  ** file is processed so that the command-line arguments will override
  ** settings in the initialization file.
  */
  for(i=1; i<argc; i++){