Commit c44dd7ae79e744795095c15797a328ca4a516c1a

Thomas de Grivel 2024-11-20T12:16:25

'trace' boolean in env

diff --git a/httpd/httpd.c b/httpd/httpd.c
index a36224a..f32f02c 100644
--- a/httpd/httpd.c
+++ b/httpd/httpd.c
@@ -38,6 +38,7 @@ int main (int argc, char **argv)
   s_tag tmp = {0};
   const struct tm *utc = NULL;
   kc3_init(NULL, &argc, &argv);
+  g_kc3_env.trace = true;
   while (argc > 0 && argv[0] && argv[0][0] == '-') {
     skip = 1;
     p = argv[0] + 1;
diff --git a/libkc3/env.c b/libkc3/env.c
index ab60ae4..f0ebe66 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -2659,6 +2659,7 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
 {
   s_str path;
   assert(env);
+  env->trace = false;
   if (! env_init_args(env, argc, argv))
     return NULL;
   sym_init_g_sym();
@@ -2879,7 +2880,7 @@ bool env_load (s_env *env, const s_str *path)
   s_tag tmp = {0};
   assert(env);
   assert(path);
-  if (true) {
+  if (env->trace) {
     err_write_1("env_load: ");
     err_inspect_str(path);
     err_write_1("\n");
diff --git a/libkc3/types.h b/libkc3/types.h
index 709d105..8fa56e2 100644
--- a/libkc3/types.h
+++ b/libkc3/types.h
@@ -736,6 +736,7 @@ struct env {
   s_frame           read_time_frame;
   s_list           *search_modules;
   s_list           *search_modules_default;
+  bool              trace;
   uw                unquote_level;
   s_unwind_protect *unwind_protect;
 };