Skip to content

Commit 5b08cc9

Browse files
committed
support passing book and coeffs path with enviroment variable (this is useful for tests)
1 parent 786bfd1 commit 5b08cc9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

getcoeff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,9 @@ init_coeffs( void ) {
936936
getcwd(sPatternFile, sizeof(sPatternFile));
937937
strcat(sPatternFile, "/" PATTERN_FILE);
938938
#endif
939+
char* env_coeffs = getenv("COEFFS_PATH");
939940

940-
coeff_stream = gzopen( sPatternFile, "rb" );
941+
coeff_stream = gzopen(env_coeffs ? env_coeffs : sPatternFile, "rb" );
941942
if ( coeff_stream == NULL )
942943
fatal_error( "%s '%s'\n", FILE_ERROR, sPatternFile );
943944

zebra.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,13 @@ main( int argc, char *argv[] ) {
609609
global_setup( use_random, hash_bits );
610610
init_thor_database();
611611

612-
if ( use_book )
613-
init_learn( "book.bin", TRUE );
612+
if ( use_book ) {
613+
char *book_filename = getenv("BOOK_PATH");
614+
if (book_filename == NULL) {
615+
book_filename = "book.bin";
616+
}
617+
init_learn(book_filename, TRUE );
618+
}
614619
if ( use_random && !SCRIPT_ONLY ) {
615620
time( &timer );
616621
my_srandom( timer );

0 commit comments

Comments
 (0)