Check-in [76ac4557f6]
Overview
Comment:More work towards SQLite3 integration
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:76ac4557f6f5e2060d541783803b32614752e34d
User & Date: rkeene on 2014-09-08 04:34:40
Other Links: manifest | tags
Context
2014-09-08
06:12
Updated to print packages check-in: 654957c655 user: rkeene tags: trunk
04:34
More work towards SQLite3 integration check-in: 76ac4557f6 user: rkeene tags: trunk
04:25
Working on creating an SQLite interface check-in: 676f99c72e user: rkeene tags: trunk
Changes

Modified Makefile from [71d33fb8c0] to [bf41e80612].

     1      1   CC = gcc
     2      2   PKG_CONFIG = pkg-config
     3         -CFLAGS = -Wall -g3 $(shell $(PKG_CONFIG) --cflags fuse) $(TCL_CFLAGS)
            3  +CFLAGS = -Wall -g3 $(shell $(PKG_CONFIG) --cflags fuse) $(shell $(PKG_CONFIG) --cflags sqlite3) $(TCL_CFLAGS)
     4      4   LDFLAGS = $(TCL_LDFLAGS)
     5         -LIBS = $(shell $(PKG_CONFIG) --libs fuse) $(TCL_LIBS)
            5  +LIBS = $(shell $(PKG_CONFIG) --libs fuse) $(shell $(PKG_CONFIG) --libs sqlite3) $(TCL_LIBS)
     6      6   PREFIX = /usr/local
     7      7   prefix = $(PREFIX)
     8      8   bindir = $(prefix)/bin
     9      9   
    10     10   ifneq ($(TCLKIT_SDK_DIR),)
    11     11   TCLCONFIG_SH_PATH = $(TCLKIT_SDK_DIR)/lib/tclConfig.sh
    12     12   TCL_LDFLAGS = -Wl,-R,$(TCLKIT_SDK_DIR)/lib

Modified appfs.c from [8a456b75d5] to [d2a493f839].

   222    222   	.readdir	= appfs_fuse_readdir,
   223    223   	.open		= appfs_fuse_open,
   224    224   	.read		= appfs_fuse_read
   225    225   };
   226    226   
   227    227   int main(int argc, char **argv) {
   228    228   	const char *cachedir = APPFS_CACHEDIR;
   229         -	int tcl_ret;
          229  +	char dbfilename[1024];
          230  +	int tcl_ret, snprintf_ret, sqlite_ret;
   230    231   
   231    232   	globalThread.interp = Tcl_CreateInterp();
   232    233   	if (globalThread.interp == NULL) {
   233    234   		fprintf(stderr, "Unable to create Tcl Interpreter.  Aborting.\n");
   234    235   
   235    236   		return(1);
   236    237   	}
................................................................................
   259    260   	}
   260    261   
   261    262   	tcl_ret = appfs_Tcl_Eval(globalThread.interp, 1, "::appfs::init");
   262    263   	if (tcl_ret != TCL_OK) {
   263    264   		fprintf(stderr, "Unable to initialize Tcl AppFS script (::appfs::init).  Aborting.\n");
   264    265   		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(globalThread.interp));
   265    266   
          267  +		return(1);
          268  +	}
          269  +
          270  +	snprintf_ret = snprintf(dbfilename, sizeof(dbfilename), "%s/%s", cachedir, "cache.db");
          271  +	if (snprintf_ret >= sizeof(dbfilename)) {
          272  +		fprintf(stderr, "Unable to set database filename.  Aborting.\n");
          273  +
          274  +		return(1);
          275  +	}
          276  +
          277  +	sqlite_ret = sqlite3_open(dbfilename, &globalThread.db);
          278  +	if (sqlite_ret != SQLITE_OK) {
          279  +		fprintf(stderr, "Unable to open database: %s\n", dbfilename);
          280  +
   266    281   		return(1);
   267    282   	}
   268    283   
   269    284   #ifdef APPFS_TEST_DRIVER
   270    285   	return(appfs_test_driver());
   271    286   #else
   272    287   	return(fuse_main(argc, argv, &appfs_oper, NULL));
   273    288   #endif
   274    289   }
   275    290