Diff

Differences From Artifact [c11522a03a]:

To Artifact [2342477e32]:


   195    195   	if (tcl_ret != TCL_OK) {
   196    196   		fprintf(stderr, "Unable to initialize Tcl.  Aborting.\n");
   197    197   
   198    198   		return(NULL);
   199    199   	}
   200    200   
   201    201   	tcl_ret = Tcl_Eval(interp, ""
   202         -#include "appfs.tcl.h"
          202  +#include "appfsd.tcl.h"
   203    203   	"");
   204    204   	if (tcl_ret != TCL_OK) {
   205    205   		fprintf(stderr, "Unable to initialize Tcl AppFS script.  Aborting.\n");
   206    206   		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
   207    207   
   208    208   		return(NULL);
   209    209   	}
................................................................................
   920    920   	}
   921    921   
   922    922   	read_ret = read(fi->fh, buf, size);
   923    923   
   924    924   	return(read_ret);
   925    925   }
   926    926   
   927         -#ifdef APPFS_TEST_DRIVER
   928         -static int appfs_test_driver(void) {
   929         -	struct appfs_site *sites, *site;
   930         -	struct appfs_package *packages, *package;
   931         -	struct appfs_children *files, *file;
   932         -	char *sha1 = NULL;
   933         -	int packages_count = 0, sites_count = 0, files_count;
   934         -
   935         -	sites = appfs_getsites(&sites_count);
   936         -	printf("Sites:\n");
   937         -	for (site = sites; site; site = site->_next) {
   938         -		printf("\tname = %s\n", site->name);
   939         -	}
   940         -
   941         -	appfs_free_list_site(sites);
   942         -
   943         -	packages = appfs_getindex("rkeene.org", &packages_count);
   944         -	if (packages == NULL || packages_count == 0) {
   945         -		fprintf(stderr, "Unable to fetch package index from rkeene.org.\n");
   946         -
   947         -		return(1);
   948         -	}
   949         -
   950         -	for (package = packages; package; package = package->_next) {
   951         -		sha1 = package->sha1;
   952         -
   953         -		printf("Package:\n\tname = %s\n\tversion = %s\n\tsha1 = %s\n\tos = %s\n\tcpuArch = %s\n",
   954         -			package->name,
   955         -			package->version,
   956         -			package->sha1,
   957         -			appfs_convert_os_toString(package->os),
   958         -			appfs_convert_cpuArch_toString(package->cpuArch)
   959         -		);
   960         -	}
   961         -
   962         -	files = appfs_getchildren("rkeene.org", sha1, "", &files_count);
   963         -	if (files == NULL) {
   964         -		fprintf(stderr, "Unable to list files in the last package.\n");
   965         -
   966         -		return(1);
   967         -	}
   968         -
   969         -	printf("Files:\n");
   970         -	for (file = files; file; file = file->_next) {
   971         -		printf("\t%s\n", file->name);
   972         -	}
   973         -
   974         -	appfs_free_list_children(files);
   975         -
   976         -	files = appfs_getchildren("rkeene.org", sha1, "tcl", &files_count);
   977         -	if (files == NULL) {
   978         -		fprintf(stderr, "Unable to list files in the last package.\n");
   979         -
   980         -		return(1);
   981         -	}
   982         -
   983         -	printf("Files:\n");
   984         -	for (file = files; file; file = file->_next) {
   985         -		printf("\ttcl/%s\n", file->name);
   986         -	}
   987         -
   988         -	appfs_free_list_children(files);
   989         -	appfs_free_list_package(packages);
   990         -
   991         -	return(0);
   992         -}
   993         -#else
   994    927   static struct fuse_operations appfs_oper = {
   995    928   	.getattr	= appfs_fuse_getattr,
   996    929   	.readdir	= appfs_fuse_readdir,
   997    930   	.open		= appfs_fuse_open,
   998    931   	.read		= appfs_fuse_read
   999    932   };
  1000         -#endif
  1001    933   
  1002    934   int main(int argc, char **argv) {
  1003    935   	const char *cachedir = APPFS_CACHEDIR;
  1004    936   	char dbfilename[1024];
  1005    937   	int pthread_ret, snprintf_ret, sqlite_ret;
  1006    938   
  1007    939   	globalThread.cachedir = cachedir;
................................................................................
  1024    956   	sqlite_ret = sqlite3_open(dbfilename, &globalThread.db);
  1025    957   	if (sqlite_ret != SQLITE_OK) {
  1026    958   		fprintf(stderr, "Unable to open database: %s\n", dbfilename);
  1027    959   
  1028    960   		return(1);
  1029    961   	}
  1030    962   
  1031         -#ifdef APPFS_TEST_DRIVER
  1032         -	return(appfs_test_driver());
  1033         -#else
  1034    963   	return(fuse_main(argc, argv, &appfs_oper, NULL));
  1035         -#endif
  1036    964   }
  1037    965