Diff

Differences From Artifact [251c8531b4]:

To Artifact [a8794a7145]:


    10     10   #include <errno.h>
    11     11   #include <fcntl.h>
    12     12   #include <stdio.h>
    13     13   #include <fuse.h>
    14     14   #include <pwd.h>
    15     15   #include <tcl.h>
    16     16   
           17  +/* From sha1.c */
           18  +int Sha1_Init(Tcl_Interp *interp);
           19  +
    17     20   #ifndef APPFS_CACHEDIR
    18     21   #define APPFS_CACHEDIR "/var/cache/appfs"
    19     22   #endif
    20     23   
    21     24   #ifdef DEBUG
    22     25   #define APPFS_DEBUG(x...) { fprintf(stderr, "[debug] %s:%i:%s: ", __FILE__, __LINE__, __func__); fprintf(stderr, x); fprintf(stderr, "\n"); }
    23     26   #else
................................................................................
    92     95   
    93     96   		return(NULL);
    94     97   	}
    95     98   
    96     99   	tcl_ret = Tcl_Init(interp);
    97    100   	if (tcl_ret != TCL_OK) {
    98    101   		fprintf(stderr, "Unable to initialize Tcl.  Aborting.\n");
          102  +		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
          103  +
          104  +		Tcl_DeleteInterp(interp);
          105  +
          106  +		return(NULL);
          107  +	}
          108  +
          109  +	tcl_ret = Tcl_Eval(interp, "package ifneeded sha1 1.0 [list load {} sha1]");
          110  +	if (tcl_ret != TCL_OK) {
          111  +		fprintf(stderr, "Unable to initialize Tcl SHA1.  Aborting.\n");
          112  +		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
    99    113   
   100    114   		Tcl_DeleteInterp(interp);
   101    115   
   102    116   		return(NULL);
   103    117   	}
   104    118   
   105    119   	tcl_ret = Tcl_Eval(interp, ""
................................................................................
  1152   1166   	char dbfilename[1024];
  1153   1167   	int pthread_ret, snprintf_ret, sqlite_ret;
  1154   1168   
  1155   1169   	globalThread.cachedir = cachedir;
  1156   1170   	globalThread.boottime = time(NULL);
  1157   1171   	globalThread.platform = "linux-x86_64";
  1158   1172   	globalThread.options.writable = 1;
         1173  +
         1174  +	Tcl_StaticPackage(NULL, "sha1", Sha1_Init, NULL);
  1159   1175   
  1160   1176   	pthread_ret = pthread_key_create(&interpKey, NULL);
  1161   1177   	if (pthread_ret != 0) {
  1162   1178   		fprintf(stderr, "Unable to create TSD key for Tcl.  Aborting.\n");
  1163   1179   
  1164   1180   		return(1);
  1165   1181   	}