/ Check-in [8a50c57c]
Login

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

Overview
Comment:Fix for ticket #21 (I think): Do not return an "out of memory" error if we can not find the users home directory. Instead, just report that we could not find the home directory. (CVS 540)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8a50c57cc3342de9c6eca6c2567d3aa42b407f10
User & Date: drh 2002-04-21 19:06:22
Context
2002-04-22
00:33
Update the version number and changes log for 2.4.9 (CVS 541) check-in: a91da82f user: drh tags: trunk
2002-04-21
19:06
Fix for ticket #21 (I think): Do not return an "out of memory" error if we can not find the users home directory. Instead, just report that we could not find the home directory. (CVS 540) check-in: 8a50c57c user: drh tags: trunk
2002-04-20
14:45
Version 2.4.8 (CVS 538) check-in: d703a2c5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
993
994
995
996
997
998
999






1000
1001
1002
1003
1004
1005

1006
1007
1008
1009
1010
1011
1012
....
1013
1014
1015
1016
1017
1018
1019




1020
1021
1022
1023
1024
1025
1026
1027
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.55 2002/04/19 12:34:06 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................

  if (!home_dir) {
    home_dir = getenv("HOME");
    if (!home_dir) {
      home_dir = getenv("HOMEPATH"); /* Windows? */
    }
  }







  if( home_dir ){
    char *z = malloc( strlen(home_dir)+1 );
    if( z ) strcpy(z, home_dir);
    home_dir = z;
  }

  return home_dir;
}

/*
** Read input from the file given by sqliterc_override.  Or if that
** parameter is NULL, take input from ~/.sqliterc
*/
................................................................................
static void process_sqliterc(struct callback_data *p, char *sqliterc_override){
  char *home_dir = NULL;
  char *sqliterc = sqliterc_override;
  FILE *in = NULL;

  if (sqliterc == NULL) {
    home_dir = find_home_dir();




    sqliterc = home_dir ? malloc(strlen(home_dir) + 15) : 0;
    if( sqliterc==0 ){
      fprintf(stderr,"%s: out of memory!\n", Argv0);
      exit(1);
    }
    sprintf(sqliterc,"%s/.sqliterc",home_dir);
    free(home_dir);
  }







|







 







>
>
>
>
>
>






>







 







>
>
>
>
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
....
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.56 2002/04/21 19:06:22 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................

  if (!home_dir) {
    home_dir = getenv("HOME");
    if (!home_dir) {
      home_dir = getenv("HOMEPATH"); /* Windows? */
    }
  }

#if defined(_WIN32) || defined(WIN32)
  if (!home_dir) {
    home_dir = "c:";
  }
#endif

  if( home_dir ){
    char *z = malloc( strlen(home_dir)+1 );
    if( z ) strcpy(z, home_dir);
    home_dir = z;
  }

  return home_dir;
}

/*
** Read input from the file given by sqliterc_override.  Or if that
** parameter is NULL, take input from ~/.sqliterc
*/
................................................................................
static void process_sqliterc(struct callback_data *p, char *sqliterc_override){
  char *home_dir = NULL;
  char *sqliterc = sqliterc_override;
  FILE *in = NULL;

  if (sqliterc == NULL) {
    home_dir = find_home_dir();
    if( home_dir==0 ){
      fprintf(stderr,"%s: cannot locate your home directory!\n", Argv0);
      return;
    }
    sqliterc = malloc(strlen(home_dir) + 15);
    if( sqliterc==0 ){
      fprintf(stderr,"%s: out of memory!\n", Argv0);
      exit(1);
    }
    sprintf(sqliterc,"%s/.sqliterc",home_dir);
    free(home_dir);
  }