Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 655)
+++ /CMT/HEAD/ChangeLog	(revision 656)
@@ -1,2 +1,62 @@
+2013-12-03    <rybkin@lal.in2p3.fr> 515
+
+	* source/cmt_symbol.h: In class SymbolValueList function print, class
+	Symbol functions all_print, print introduce optional argument of type
+	ostream	reference, in class Symbol, declare static functions std_env_vars,
+	set_path_strip
+	* source/cmt_symbol.cxx: In class PathBuilder, introduce and implement
+	functions filter_path_value, get/set_path_strip, constructor with
+	path_strip argument and member m_path_strip to indicate whether to strip
+	paths of non-existent directories, in unnamed namespace, introduce cache
+	of command outputs for use in functions resolve_value,
+	resolve_value_for_macros, suppress_OS_delimiters, in class Symbol function
+	create, create PathBuilder instance with configured value of path_strip,
+	in class Symbol, implement static functions std_env_vars, set_path_strip,
+	control access to environment in functions resolve_value, class Symbol
+	functions all_set, get_env_value, class SetBuilder function build, class
+	PathBuilder function build, systematically use class PathBuilder function
+	filter_path_value in class Symbol functions all_set, check_all_paths,
+	print, in class PathBuilder function build, in class SymbolValueList
+	function print, modify helper function find_path_entry so as not to access
+	file system and return index of entry found, in class PathBuilder function
+	build, make use of signature to enhance implementation of path_append /
+	prepend commands, drop redundant cleaning of repeating path separators, in
+	class SymbolValueList function print, implement enhanced cached
+	requirements file generation, i.e., resolve sets for macros if possible,
+	resolve paths fully if possible, so as to strip path of non-existent
+	directories, implement use of argument of type ostream reference
+	* source/cmt_use.cxx: In class Use function fill_standard_macros, generate
+	CONFIG macros, if CONFIG environment variables are relevant, in setup
+	Requirements mode
+	* source/cmt_error.cxx: Cosmetic modifications to error messages
+	* source/cmt_commands.h: In class ArgParser, declare functions
+	option_with(out)_projects, option(_no)_path_strip
+	* source/cmt_commands.cxx: In class ArgParser, implement introduced
+	functions
+	* source/cmt.h: In class CmtContext, introduce member m_use_projects to
+	indicate whether to parse project files, member m_env_access to indicate
+	whether symbols values can be taken from environment, member m_print_mode
+	to hold	corresponding value from class ArgParser instance, member
+	m_path_strip to indicate whether to strip paths of non-existent
+	directories, in class Cmt functions print, print_context introduce optional
+	argument of type ostream reference, declare and implement inline functions
+	get/set_env_access, get/set_print_mode, get_path_strip
+	* source/cmt_parser.cxx: In class Cmt function configure_cmt_path, do not
+	create projects if m_use_projects is false, in function do_broadcast, set
+	cmtpath for all uses so as to fill in templates correctly, in function
+	do_check_configuration, do not run class Symbol function check_all_paths
+	for setup unless in Requirements mode (since paths checks are done in class
+	Symbol function print), in function do_setup, implement procedure of cached
+	requirements file generation, i.e., do not access environment to set
+	symbols values and, by default, strip paths of non-existent directories if
+	possible, in function guess_current_project, return if projects are not
+	used, do not change m_autoconfigure_cmtpath value, in functions print,
+	print_context, implement use of argument of type ostream reference, in
+	function print_context, in Requirements mode, generate CONFIG sets if
+	CONFIG environment variables are relevant, in function
+	use_special_requirements, handle case when projects are not used
+	* mgr/requirements: Associate CMTr25 tag with HEAD, append CMT to PATH as
+	in CMT setup scripts
+	
 2013-11-13    <rybkin@lal.in2p3.fr> 514
 
@@ -41,5 +101,5 @@
 	system tags handling to make all initially known tags available while
 	reading project files, implement get_tags_remove function, in parser
-	function initialise static xCmtContext instance at very beginning
+	function initialise static CmtContext instance at very beginning
 	* source/cmt.h: In class Cmt, declare get_tags_remove function
 	
Index: /CMT/HEAD/mgr/requirements
===================================================================
--- /CMT/HEAD/mgr/requirements	(revision 655)
+++ /CMT/HEAD/mgr/requirements	(revision 656)
@@ -6,5 +6,5 @@
 tag CMTr16 CMTr14
 tag CMTr18 CMTr16
-tag CMTr0  CMTr18
+tag CMTr0  CMTr25
 
 #
@@ -125,5 +125,5 @@
              WIN32     "CMT\v"
 
-path_prepend PATH      "${CMTROOT}/${CMTBIN}" \
+path_append  PATH      "${CMTROOT}/${CMTBIN}" \
              WIN32     "%CMTROOT%\%CMTBIN%"
 
Index: /CMT/HEAD/source/cmt.h
===================================================================
--- /CMT/HEAD/source/cmt.h	(revision 655)
+++ /CMT/HEAD/source/cmt.h	(revision 656)
@@ -35,4 +35,5 @@
   cmt_string m_cmt_version;
   bool m_use_cmt;
+  bool m_use_projects;
   
   cmt_string m_current_dir;
@@ -74,4 +75,8 @@
 
   bool m_autoconfigure_cmtpath;
+
+  bool m_env_access;
+  PrintMode m_print_mode;
+  bool m_path_strip;
 
 private:
@@ -271,7 +276,9 @@
   static int parser (const cmt_string& command_line);
   static int parser (int argc, char* argv[]);
-  static void print (PrintMode mode);
+  static void print (PrintMode mode, ostream& out = cout);
+  //static void print (PrintMode mode);
   static void print_clean (PrintMode mode);
-  static void print_context (Use& use, PrintMode mode, const cmt_string& tag);
+  static void print_context (Use& use, PrintMode mode, const cmt_string& tag, ostream& out = cout);
+  //static void print_context (Use& use, PrintMode mode, const cmt_string& tag);
   static void print_macros (PrintMode mode, const cmt_string& pattern = "",
 			    ostream& out = cout);
@@ -302,4 +309,10 @@
                                 cmt_string& result);
 
+  static inline const bool& get_env_access ();
+  static inline void set_env_access (const bool& access);
+  static inline const PrintMode& get_print_mode ();
+  static inline void set_print_mode (const PrintMode& mode);
+  static inline const bool& get_path_strip ();
+
 private:
   static CmtContext& m_cmt_context;
@@ -425,4 +438,28 @@
 }
 
+inline const bool& Cmt::get_env_access ()
+{
+  return m_cmt_context.m_env_access;
+}
+
+inline void Cmt::set_env_access (const bool& access)
+{
+  m_cmt_context.m_env_access = access;
+}
+
+inline const PrintMode& Cmt::get_print_mode ()
+{
+  return m_cmt_context.m_print_mode;
+}
+
+inline void Cmt::set_print_mode (const PrintMode& mode)
+{
+  m_cmt_context.m_print_mode = mode;
+}
+
+inline const bool& Cmt::get_path_strip ()
+{
+  return m_cmt_context.m_path_strip;
+}
 //----------------------------------------------------------
 
Index: /CMT/HEAD/source/cmt_commands.cxx
===================================================================
--- /CMT/HEAD/source/cmt_commands.cxx	(revision 655)
+++ /CMT/HEAD/source/cmt_commands.cxx	(revision 656)
@@ -256,4 +256,11 @@
   pv.push_back (&ArgParser::option_no_cleanup); i++;
 
+  parsers.add ("-no_path_s", i);
+  parsers.add ("-no_path_st", i);
+  parsers.add ("-no_path_str", i);
+  parsers.add ("-no_path_stri", i);
+  parsers.add ("-no_path_strip", i);
+  pv.push_back (&ArgParser::option_no_path_strip); i++;
+
   parsers.add ("-pac", i);
   parsers.add ("-pack", i);
@@ -263,4 +270,11 @@
   parsers.add ("-path", i);
   pv.push_back (&ArgParser::option_path); i++;
+
+  parsers.add ("-path_s", i);
+  parsers.add ("-path_st", i);
+  parsers.add ("-path_str", i);
+  parsers.add ("-path_stri", i);
+  parsers.add ("-path_strip", i);
+  pv.push_back (&ArgParser::option_path_strip); i++;
 
   parsers.add ("-pr", i);
@@ -346,4 +360,24 @@
   parsers.add ("-without_cmt", i);
   pv.push_back (&ArgParser::option_without_cmt); i++;
+
+  parsers.add ("-with_p", i);
+  parsers.add ("-with_pr", i);
+  parsers.add ("-with_pro", i);
+  parsers.add ("-with_proj", i);
+  parsers.add ("-with_proje", i);
+  parsers.add ("-with_projec", i);
+  parsers.add ("-with_project", i);
+  parsers.add ("-with_projects", i);
+  pv.push_back (&ArgParser::option_with_projects); i++;
+
+  parsers.add ("-without_p", i);
+  parsers.add ("-without_pr", i);
+  parsers.add ("-without_pro", i);
+  parsers.add ("-without_proj", i);
+  parsers.add ("-without_proje", i);
+  parsers.add ("-without_projec", i);
+  parsers.add ("-without_project", i);
+  parsers.add ("-without_projects", i);
+  pv.push_back (&ArgParser::option_without_projects); i++;
 
   parsers.add ("-warn", i);
@@ -2022,4 +2056,18 @@
 }
 
+void ArgParser::option_no_path_strip ()
+{
+  cmt.m_path_strip = false;
+  if (!Cmt::add_cmt_flag ("-no_path_strip"))
+    CmtMessage::error ("Cannot add flag `-no_path_strip'");
+}
+
+void ArgParser::option_path_strip ()
+{
+  cmt.m_path_strip = true;
+  if (!Cmt::add_cmt_flag ("-path_strip"))
+    CmtMessage::error ("Cannot add flag `-path_strip'");
+}
+
 void ArgParser::option_tag ()
 {
@@ -2323,4 +2371,18 @@
   if (!Cmt::add_cmt_flag ("-without_cmt"))
     CmtMessage::error ("Cannot add flag `-without_cmt'");
+}
+
+void ArgParser::option_with_projects ()
+{
+  cmt.m_use_projects = true;
+  if (!Cmt::add_cmt_flag ("-with_projects"))
+    CmtMessage::error ("Cannot add flag `-with_projects'");
+}
+
+void ArgParser::option_without_projects ()
+{
+  cmt.m_use_projects = false;
+  if (!Cmt::add_cmt_flag ("-without_projects"))
+    CmtMessage::error ("Cannot add flag `-without_projects'");
 }
 
Index: /CMT/HEAD/source/cmt_commands.h
===================================================================
--- /CMT/HEAD/source/cmt_commands.h	(revision 655)
+++ /CMT/HEAD/source/cmt_commands.h	(revision 656)
@@ -83,7 +83,11 @@
   void option_with_cmt ();
   void option_without_cmt ();
+  void option_with_projects ();
+  void option_without_projects ();
   void option_with_version_directory ();
   void option_without_version_directory ();
   void option_no_cleanup ();
+  void option_no_path_strip ();
+  void option_path_strip ();
   void option_private ();
   void option_public ();
Index: /CMT/HEAD/source/cmt_error.cxx
===================================================================
--- /CMT/HEAD/source/cmt_error.cxx	(revision 655)
+++ /CMT/HEAD/source/cmt_error.cxx	(revision 656)
@@ -18,5 +18,5 @@
   {
     error_names.add() = "ok";
-    error_names.add() = "Warning";
+    error_names.add() = "warning";
     error_names.add() = "symbol not found";
     error_names.add() = "pattern not found";
@@ -159,5 +159,5 @@
 
   result = get_error_name (e.get_code ());
-  result += " : ";
+  result += ": ";
   result += e.get_text ();
 
Index: /CMT/HEAD/source/cmt_parser.cxx
===================================================================
--- /CMT/HEAD/source/cmt_parser.cxx	(revision 655)
+++ /CMT/HEAD/source/cmt_parser.cxx	(revision 656)
@@ -68,4 +68,5 @@
   m_cmt_version    = "";
   m_use_cmt        = true;
+  m_use_projects   = true;
 
   m_current_dir     = "";
@@ -109,4 +110,8 @@
 
   m_autoconfigure_cmtpath = false;
+
+  m_env_access = true;
+  m_print_mode = Csh;
+  m_path_strip = false;
 }
 //----------------------------------------------------------
@@ -627,5 +632,5 @@
   Me.m_autoconfigure_cmtpath = true;
   configure_cmt_path (0);
-  Me.m_autoconfigure_cmtpath = false;
+  //  Me.m_autoconfigure_cmtpath = false;
 
   Me.m_quiet = save_quiet;
@@ -710,4 +715,6 @@
 {
   if (!Me.m_autoconfigure_cmtpath) return;
+
+  if (!m_cmt_context.m_use_projects) return;
 
   cmt_string s;
@@ -2115,4 +2122,6 @@
           ok = selected;
         }
+      else if (up)
+	cmtpath = up->get_cmtpath ();
 
       if (ok)
@@ -3170,5 +3179,9 @@
     }
 
-  Symbol::check_all_paths ();
+  if (action_setup != get_action () ||
+      Requirements == ap.mode)
+    // PathBuilder::filter_path_value is called
+    // for each path in Symbol::print
+    Symbol::check_all_paths ();
 
   env = CmtSystem::getenv ("CMTSITE");
@@ -4569,7 +4582,9 @@
       break;
     case Requirements :
+      /*
       CmtSystem::cmt_string_vector flags;
       get_cmt_flags (flags);
       cout << "\n# CMTFLAGS: -without_cmt";
+      cout << " -without_projects" ;
       for (int i = 0; i < flags.size (); i++)
 	{
@@ -4578,11 +4593,126 @@
 	  else if (flags[i] == "-with_cmt")
 	    cout << " -without_cmt";
+	  else if (flags[i] == "-without_projects")
+	    cout << " -with_projects";
+	  else if (flags[i] == "-with_projects")
+	    cout << " -without_projects";
 	  else
 	    cout << " " << flags[i]; 
 	}
       cout << endl;
+      */
       break;
-    }
-  print (ap.mode);
+    default:
+      break;
+    }
+
+  ostringstream os;
+  ostringstream oh;
+  bool reset (false);
+  CmtSystem::cmt_string_vector flags;
+  cmt_string path_strip_flag;
+  bool path_strip (false);
+
+  bool strip_saved (get_path_strip ());
+  bool access_saved (Cmt::get_env_access ());
+
+  switch (ap.mode)
+    {
+    case Requirements :
+
+      get_cmt_flags (flags);
+      for (int i = 0; i < flags.size (); i++)
+	{
+	  if (flags[i] == "-no_path_strip")
+	    path_strip_flag = "-no_path_strip";
+	  else if (flags[i] == "-path_strip")
+	    path_strip_flag = "-path_strip";
+	}
+      if (path_strip_flag != "-no_path_strip" &&
+	  !get_path_strip ())
+	reset = Symbol::set_path_strip (true);
+
+      if (get_path_strip () || reset)
+	path_strip = true;
+      else
+	path_strip = false;
+
+      Cmt::set_env_access (false);
+
+      print (ap.mode, os);
+
+      if (CmtError::get_last_error_code () == CmtError::warning &&
+	  (get_path_strip () || reset))
+	{
+	  reset = Symbol::set_path_strip (false);
+	  if (reset)
+	    {
+	      path_strip = false;
+
+	      CmtError::print ();
+	      CmtError::clear ();
+
+	      if (Cmt::get_debug ())
+		{
+		  cerr << "|Cmt::do_setup> Failure with:\n" << os.str ()
+		       << "|Cmt::do_setup> Trying again." << endl;
+		}
+
+	      // Try again
+	      os.str ("");
+	      print (ap.mode, os);
+	    }
+	}
+
+      if (reset) Symbol::set_path_strip (strip_saved);
+      Cmt::set_env_access (access_saved);
+
+      //get_cmt_flags (flags);
+      oh << "\n# CMTFLAGS:"
+	" -without_cmt"
+	" -without_projects"
+	//" -path_strip"
+	;
+      for (int i = 0; i < flags.size (); i++)
+	{
+	  if (flags[i] == "-without_cmt")
+	    oh << " -with_cmt";
+	  else if (flags[i] == "-with_cmt")
+	    oh << " -without_cmt";
+	  else if (flags[i] == "-without_projects")
+	    oh << " -with_projects";
+	  else if (flags[i] == "-with_projects")
+	    oh << " -without_projects";
+	  /*
+	  else if (flags[i] == "-no_path_strip")
+	    oh << " -path_strip";
+	  else if (flags[i] == "-path_strip")
+	    oh << " -no_path_strip";
+	  */
+	  else if (flags[i] == "-no_path_strip" ||
+		   flags[i] == "-path_strip")
+	    continue;
+	  else
+	    oh << " " << flags[i]; 
+	}
+      //if (reset) oh << " -path_strip";
+      if (path_strip)
+	oh << " -no_path_strip";
+      else
+	oh << " -path_strip";
+      oh << endl;
+
+      cout << oh.str ();
+      cout << os.str ();
+
+      break;
+
+    default:
+
+      print (ap.mode);
+
+      break;
+    }
+
   switch (ap.mode)
     {
@@ -5680,4 +5810,6 @@
 void Cmt::guess_current_project ()
 {
+  if (!m_cmt_context.m_use_projects) return;
+
   Log;
 
@@ -5782,4 +5914,6 @@
   //  Use& use = Use::current();
 
+  bool autoconfigure_cmtpath_saved (Me.m_autoconfigure_cmtpath);
+  Me.m_autoconfigure_cmtpath = false;
   bool save_quiet = Me.m_quiet;
   Me.m_quiet = true;
@@ -5788,6 +5922,6 @@
 
   Me.m_quiet = save_quiet;
-
-  Me.m_autoconfigure_cmtpath = true;
+  Me.m_autoconfigure_cmtpath = autoconfigure_cmtpath_saved;
+  //  Me.m_autoconfigure_cmtpath = true;
 
   //  CmtSystem::cd (Me.m_current_dir);
@@ -6797,4 +6931,6 @@
 
   parse_arguments (ap);
+  // Copy ap.mode into cmt_context member/instance
+  set_print_mode (ap.mode);
 
   //  configure ();
@@ -7741,5 +7877,5 @@
  * joined with semi-colons to form one shell command.
  */
-void Cmt::print (PrintMode mode)
+void Cmt::print (PrintMode mode, ostream& out)
 {
   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
@@ -7805,5 +7941,5 @@
 	  if (tag != 0)
 	    {
-	      tag->show (true, cout, "apply_tag ");
+	      tag->show (true, out, "apply_tag ");
 	    }
 	}
@@ -7826,9 +7962,9 @@
           if (use.m_hidden) continue;
           
-          print_context (use, mode, tag);
-        }
-    }
-
-  print_context (Use::current (), mode, tag);
+          print_context (use, mode, tag, out);
+        }
+    }
+
+  print_context (Use::current (), mode, tag, out);
 
   if (Me.m_debug)
@@ -7837,5 +7973,5 @@
     }
 
-  Symbol::all_print (mode);
+  Symbol::all_print (mode, out);
   // Script::all_print (mode);
 
@@ -7850,5 +7986,5 @@
       break;
     default :
-  cout << endl;
+      out << endl;
       break;
     }
@@ -7956,5 +8092,5 @@
 
 //----------------------------------------------------------
-void Cmt::print_context (Use& use, PrintMode mode, const cmt_string& tag)
+void Cmt::print_context (Use& use, PrintMode mode, const cmt_string& tag, ostream& out)
 {
   if (use.get_package_name () == "cmt_standalone") return;
@@ -7988,5 +8124,5 @@
       if (do_root)
 	{
-	  cout << "setenv " << prefix << "ROOT \"" <<
+	  out << "setenv " << prefix << "ROOT \"" <<
 	    use.get_full_path () << "\"" << endl;
 	}
@@ -7994,5 +8130,5 @@
       if (use.get_package_name () == "CMT")
         {
-          cout << "setenv CMTCONFIG " << system << endl;
+          out << "setenv CMTCONFIG " << system << endl;
         }
       else
@@ -8000,5 +8136,5 @@
 	  if (do_config)
 	    {
-	      cout << "setenv " << prefix << "CONFIG \"" << tag << "\"" << endl;
+	      out << "setenv " << prefix << "CONFIG \"" << tag << "\"" << endl;
 	    }
 	}
@@ -8008,5 +8144,5 @@
       if (do_root)
 	{
-	  cout << prefix << "ROOT=\"" <<
+	  out << prefix << "ROOT=\"" <<
 	    use.get_full_path () << "\"; export " <<
 	    prefix << "ROOT" << endl;
@@ -8015,5 +8151,5 @@
       if (use.get_package_name () == "CMT")
         {
-          cout << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl;
+          out << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl;
         }
       else
@@ -8021,5 +8157,5 @@
 	  if (do_config)
 	    {
-	      cout << prefix << "CONFIG=\"" <<
+	      out << prefix << "CONFIG=\"" <<
 		tag << "\"; export " <<
 		prefix << "CONFIG" << endl;
@@ -8031,5 +8167,5 @@
       if (do_root)
 	{
-	  cout << "set " << prefix << "ROOT=" <<
+	  out << "set " << prefix << "ROOT=" <<
 	    CmtSystem::quote (use.get_full_path (), " \t") << endl;
 	}
@@ -8037,5 +8173,5 @@
       if (use.get_package_name () == "CMT")
         {
-          cout << "set CMTCONFIG=" << system << endl;
+          out << "set CMTCONFIG=" << system << endl;
         }
       else
@@ -8043,5 +8179,5 @@
 	  if (do_config)
 	    {
-	      cout << "set " << prefix << "CONFIG=" << CmtSystem::quote (tag, " \t") << endl;
+	      out << "set " << prefix << "CONFIG=" << CmtSystem::quote (tag, " \t") << endl;
 	    }
 	}
@@ -8051,12 +8187,12 @@
       if (do_root)
 	{
-	  cout << "<variable><name>" << prefix << "ROOT</name>"
-	       << "<value>" << use.get_full_path () << "</value></variable>";
+	  out << "<variable><name>" << prefix << "ROOT</name>"
+	      << "<value>" << use.get_full_path () << "</value></variable>";
 	}
 
       if (use.get_package_name () == "CMT")
         {
-	  cout << "<variable><name>CMTCONFIG</name>"
-	       << "<value>" << system << "</value></variable>";
+	  out << "<variable><name>CMTCONFIG</name>"
+	      << "<value>" << system << "</value></variable>";
         }
       else
@@ -8064,6 +8200,6 @@
 	  if (do_config)
 	    {
-	      cout << "<variable><name>" << prefix << "CONFIG</name>"
-		   << "<value>" << tag << "</value></variable>";
+	      out << "<variable><name>" << prefix << "CONFIG</name>"
+		  << "<value>" << tag << "</value></variable>";
 	    }
 	}
@@ -8074,5 +8210,5 @@
 	  use.get_package_name () != "CMT")
 	{
-	  cout << "set " << use.prefix << "ROOT " <<
+	  out << "set " << use.prefix << "ROOT " <<
 	    CmtSystem::quote (use.get_full_path (), " \t") << endl;
 
@@ -8093,5 +8229,5 @@
       if (use.get_package_name () == "CMT")
         {
-	  cout << "set CMTCONFIG " << system << endl;
+	  out << "set CMTCONFIG " << system << endl;
         }
       else
@@ -8099,5 +8235,18 @@
 	  if (do_config)
 	    {
-	      cout << "set " << use.prefix << "CONFIG " << CmtSystem::quote (tag, " \t") << endl;
+	      out << "set " << use.prefix << "CONFIG " << CmtSystem::quote (tag, " \t") << endl;
+	      
+	      cmt_string name (use.prefix + "CONFIG");
+	      Symbol* symbol = Symbol::find (name);
+	      if (symbol != 0) 
+		{
+		  symbol->printed = true;
+		}
+	      if (symbol == 0 || symbol->type != Symbol::SymbolMacro)
+		{
+		  CmtMessage::warning
+		    (CmtError::get_error_name (CmtError::symbol_not_found)
+		     + ": macro " + name);
+		}
 	    }
 	}
@@ -10333,12 +10482,22 @@
 	  if (0 == Ordered.size ())
 	    {
-	      CmtError::set(CmtError::configuration_error,
-			    "No ordered project: " + use->get_info ());
-	      return;
+	      if (m_cmt_context.m_use_projects)
+		{
+		  CmtError::set(CmtError::configuration_error,
+				"No such ordered project: " + use->get_info ());
+		  return;
+		}
+	      else
+		{
+		  use->change_path (path);
+		}
 	    }
-	  if (name == CmtSystem::get_home_package ())
-	    use->change_path (path, Ordered[Ordered.size () - 1]);
-	  else if (name == CmtSystem::get_user_context_package ())
-	    use->change_path (path, Ordered[0]);
+	  else
+	    {
+	      if (name == CmtSystem::get_home_package ())
+		use->change_path (path, Ordered[Ordered.size () - 1]);
+	      else if (name == CmtSystem::get_user_context_package ())
+		use->change_path (path, Ordered[0]);
+	    }
 	}
       else
@@ -10370,9 +10529,9 @@
     {
       const cmt_string& s = v[i];
-      if (s == "") continue;
+      if (s.size () == 0) continue;
 
       if (result.size () != 0) result += separator;
       //if (i > 0) result += separator;
-      result += v[i];
+      result += s;
     }
 }
Index: /CMT/HEAD/source/cmt_symbol.cxx
===================================================================
--- /CMT/HEAD/source/cmt_symbol.cxx	(revision 655)
+++ /CMT/HEAD/source/cmt_symbol.cxx	(revision 656)
@@ -15,4 +15,5 @@
 #include "cmt_database.h"
 #include "cmt_log.h"
+#include "cmt_error.h"
 
 // Global inhibitor of any display
@@ -42,4 +43,19 @@
   const cmt_string clean (const Symbol& symbol,
                           const cmt_string& tag_name = "");
+
+  void filter_path_value (const Symbol& symbol,
+			  cmt_string& value,
+			  const cmt_string& tag_name = "") const;
+  void filter_path_value (const Symbol& symbol,
+			  CmtSystem::cmt_string_vector& value,
+			  const cmt_string& tag_name = "") const;
+  inline const bool& get_path_strip () const;
+  inline void set_path_strip (const bool& path_strip);
+
+  PathBuilder ();
+  PathBuilder (bool path_strip);
+
+private:
+  bool m_path_strip;
 };
 //-------------------------------------------------------------
@@ -248,4 +264,11 @@
 }
 
+//
+// Global cache
+//
+namespace
+{
+  cmt_vmap <cmt_string, cmt_string> cmdoutputs;
+}
 /**
 
@@ -285,4 +308,6 @@
   int start = 0;
 
+  //  static cmt_vmap <cmt_string, cmt_string> cmdoutputs;
+
   for (;;)
     {
@@ -337,24 +362,30 @@
             // to be applied. The output of the command is then substituted
 
+	  Symbol::all_set ();
+
           cmt_string result;
-
-          Symbol::all_set ();
-          CmtSystem::execute (command, result);
-          
-	  /*
-          int pos;
-          pos = result.find ('\n');
-          if (pos != cmt_string::npos) result.erase (pos);
-          pos = result.find ('\r');
-          if (pos != cmt_string::npos) result.erase (pos);
-	  */          
-	  process_cmd_output (result);
-
-          if (Cmt::get_debug ())
-            {
-              cout << "resolve_value: Executing [" << command << "] to expand a symbol value =>[" 
-                   << result << "]" << endl;
-            }
-          
+	  const cmt_string * presult;
+	  if (!(presult = cmdoutputs.find (command)))
+	    {
+	      CmtSystem::execute (command, result);
+	      
+	      process_cmd_output (result);
+	      cmdoutputs.add (command, result);
+	      if (Cmt::get_debug ())
+		{
+		  cout << "resolve_value: Executing [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+	  else
+	    {
+	      result = *presult;
+	      if (Cmt::get_debug ())
+		{
+		  cout << "resolve_value: Found in cache [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+
           text.replace_all (pattern, result);
 
@@ -378,14 +409,33 @@
           else
             {
+	      if (Cmt::get_env_access () ||
+		  Symbol::std_env_vars ().has (symbol_name))
+		{
                 // Symbol not found. Look for env. variable
               cmt_string value = CmtSystem::getenv (symbol_name);
-              
                 // When the env. variable is not defined, the replacement is empty
                 // thus all $(xxx) ${xxx} %xxx% patterns are always filtered away.
               text.replace_all (pattern, value);
               
+		  if (Cmt::get_debug ())
+		    {
+		      cerr << "resolve_value: getenv (" << symbol_name
+			   << ") => " << value << endl;
+		    }
                 // The substitution will restart from the same place
                 // allowing for recursive replacements
               start = begin;
+		}
+	      else
+		{
+		  if (Cmt::get_debug ())
+		    {
+		      cerr << "resolve_value: getenv (" << symbol_name
+			   << ") denied" << endl;
+		    }
+		  CmtError::set (CmtError::warning,
+				 "getenv (" + symbol_name + ") denied");
+		  return;
+		}
             }
         }
@@ -484,24 +534,30 @@
             // to be applied. The output of the command is substituted
 
+	  Symbol::all_set ();
+
           cmt_string result;
-
-          Symbol::all_set ();
-          CmtSystem::execute (command, result);
-          
-	  /*
-          int pos;
-          pos = result.find ('\n');
-          if (pos != cmt_string::npos) result.erase (pos);
-          pos = result.find ('\r');
-          if (pos != cmt_string::npos) result.erase (pos);
-	  */
-	  process_cmd_output (result);
-          
-          if (Cmt::get_debug ())
-            {
-              cout << "   Executing [" << command << "] to expand a macro value =>[" 
-                   << result << "]" << endl;
-            }
-          
+	  const cmt_string * presult;
+	  if (!(presult = cmdoutputs.find (command)))
+	    {
+	      CmtSystem::execute (command, result);
+	      
+	      process_cmd_output (result);
+	      cmdoutputs.add (command, result);
+	      if (Cmt::get_debug ())
+		{
+		  cout << "resolve_value_for_macros: Executing [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+	  else
+	    {
+	      result = *presult;
+	      if (Cmt::get_debug ())
+		{
+		  cout << "resolve_value_for_macros: Found in cache [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+
           text.replace_all (pattern, result);
 
@@ -621,24 +677,30 @@
             // to be applied. The output of the command is substituted
 
+	  Symbol::all_set ();
+
           cmt_string result;
-
-          Symbol::all_set ();
-          CmtSystem::execute (command, result);
-          
-	  /*
-          int pos;
-          pos = result.find ('\n');
-          if (pos != cmt_string::npos) result.erase (pos);
-          pos = result.find ('\r');
-          if (pos != cmt_string::npos) result.erase (pos);
-	  */          
-	  process_cmd_output (result);
-          
-          if (Cmt::get_debug ())
-            {
-              cout << "   Executing [" << command << "] to expand a macro value =>[" 
-                   << result << "]" << endl;
-            }
-          
+	  const cmt_string * presult;
+	  if (!(presult = cmdoutputs.find (command)))
+	    {
+	      CmtSystem::execute (command, result);
+	      
+	      process_cmd_output (result);
+	      cmdoutputs.add (command, result);
+	      if (Cmt::get_debug ())
+		{
+		  cout << "suppress_OS_delimiters: Executing [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+	  else
+	    {
+	      result = *presult;
+	      if (Cmt::get_debug ())
+		{
+		  cout << "suppress_OS_delimiters: Found in cache [" << command << "] to expand a symbol value =>[" 
+		       << result << "]" << endl;
+		}
+	    }
+
           text.replace_all (pattern, result);
 
@@ -692,5 +754,6 @@
 {
   static SetBuilder Set;
-  static PathBuilder Path;
+  static PathBuilder Path (Cmt::get_path_strip ());
+  //static PathBuilder Path;
   static MacroBuilder Macro;
   static ScriptBuilder Script;
@@ -913,4 +976,28 @@
 }
 
+//-------------------------------------------------------------
+Symbol::SymbolMap& Symbol::std_env_vars ()
+{
+  static SymbolMap env_vars;
+  static Symbol std_sym;
+  static bool initialized (false);
+  if (!initialized)
+    {
+      env_vars.add ("SITEROOT", std_sym);
+      env_vars.add ("CMTCONFIG", std_sym);
+      env_vars.add ("CMTBIN", std_sym);
+      env_vars.add ("CMTPATH", std_sym);
+      env_vars.add ("CMTHEADVERSION", std_sym);
+      env_vars.add ("CMTPROJECTPATH", std_sym);
+      env_vars.add ("CMTSITE", std_sym);
+      env_vars.add ("CMTEXTRATAGS", std_sym);
+      env_vars.add ("CMTSTRUCTURINGSTYLE", std_sym);
+      env_vars.add ("CMTHOME", std_sym);
+      env_vars.add ("CMTUSERCONTEXT", std_sym);
+      initialized = true;
+    }
+  return env_vars;
+}
+
 /**
    Filter out faulty items of a path-like symbol value
@@ -1168,4 +1255,22 @@
 
 //-------------------------------------------------------------
+bool Symbol::set_path_strip (const bool& path_strip)
+{
+  // searching for a path symbol
+  for (int number = 0; number < Symbol::symbol_number (); number++)
+    {
+      Symbol& symbol = Symbol::symbol (number);
+      
+      if (symbol.type == Symbol::SymbolPath)
+	{
+	  static_cast<PathBuilder*> (symbol.builder)->set_path_strip (path_strip);
+	  return true;
+	}
+    }
+
+  return false;
+}
+
+//-------------------------------------------------------------
 int Symbol::is_selected (const cmt_string& name)
 {
@@ -1422,4 +1527,6 @@
   cmt_string value;
 
+  if (Cmt::get_env_access ())
+    {
   for (number = 0; number < Symbol::symbol_number (); number++)
     {
@@ -1433,6 +1540,12 @@
 	  Symbol::expand (value);
 
+          if (Cmt::get_debug ())
+            {
+              cerr << "Symbol::all_set (set)> " << symbol.name << " = " << value << endl;
+            }
+
 	  CmtSystem::putenv (symbol.name, value);
 	}
+    }
     }
 
@@ -1500,4 +1613,8 @@
   }
 
+  static PathBuilder* pb (0);
+
+  if (Cmt::get_env_access ())
+    {
   for (number = 0; number < Symbol::symbol_number (); number++)
     {
@@ -1510,5 +1627,8 @@
 	{
 	  Symbol::expand (value);
-	  filter_path_value (symbol.name, value);
+	  if (!pb)
+	    pb = static_cast<PathBuilder*> (symbol.builder);
+	  pb->filter_path_value (symbol, value);
+	  //filter_path_value (symbol.name, value);
 
 #ifdef WIN32
@@ -1518,5 +1638,5 @@
           if (Cmt::get_debug ())
             {
-              cerr << "Symbol::all_set-2> " << symbol.name << " = " << value << endl;
+              cerr << "Symbol::all_set (path)> " << symbol.name << " = " << value << endl;
             }
 
@@ -1524,4 +1644,5 @@
 	}
     }
+    }
 
   running = false;
@@ -1529,5 +1650,6 @@
 
 //-------------------------------------------------------------
-void Symbol::all_print (PrintMode mode)
+void Symbol::all_print (PrintMode mode, ostream& out)
+//void Symbol::all_print (PrintMode mode)
 {
   static SymbolVector& Symbols = symbols ();
@@ -1550,5 +1672,5 @@
 	      (symbol.type == SymbolMacro))
 	    {
-	      if (symbol.print_macro (mode))
+	      if (symbol.print_macro (mode, out))
 		{
 		  //		  cout << endl;
@@ -1567,9 +1689,9 @@
 	      (symbol.type == SymbolPath))
 	    {
-	      if (symbol.print (mode))
+	      if (symbol.print (mode, out))
 		{
 		  if (mode == Bat)
 		    {
-		      cout << endl;
+		      out << endl;
 		    }
 		  else if (mode == Xml)
@@ -1579,5 +1701,5 @@
 		  else
 		    {
-		      cout << endl;
+		      out << endl;
 		    }
 		}
@@ -1593,4 +1715,6 @@
   static SymbolVector& Symbols = symbols ();
 
+  static PathBuilder* pb (0);
+
   int number;
 
@@ -1608,5 +1732,8 @@
 	  expand (temp);
 
-	  Symbol::filter_path_value (symbol.name, temp);
+	  if (!pb)
+	    pb = static_cast<PathBuilder*> (symbol.builder);
+	  pb->filter_path_value (symbol, temp);
+	  //Symbol::filter_path_value (symbol.name, temp);
         }
     }
@@ -1762,6 +1889,8 @@
 
 //-------------------------------------------------------------
-int Symbol::print (PrintMode mode)
-{
+int Symbol::print (PrintMode mode, ostream& out)
+{
+  static PathBuilder* pb (0);
+
   int result = 0;
 
@@ -1772,5 +1901,8 @@
     {
       expand (temp);
-      Symbol::filter_path_value (name, temp);
+      //Symbol::filter_path_value (name, temp);
+      if (!pb)
+	pb = static_cast<PathBuilder*> (builder);
+      pb->filter_path_value (*this, temp);
     }
 
@@ -1785,15 +1917,15 @@
           {
             case Csh :
-              if (empty) cout << "unsetenv " << _name;
-              else cout << "setenv " << _name << " \"" << temp << "\"";
-              //else cout << "setenv " << name << " " << CmtSystem::quote (temp, " \t");
+              if (empty) out << "unsetenv " << _name;
+              else out << "setenv " << _name << " \"" << temp << "\"";
+              //else out << "setenv " << name << " " << CmtSystem::quote (temp, " \t");
 
               result = 1;
               break;
             case Sh :
-              if (empty) cout << "[ -z ${" << _name << "+CMT} ] || unset " << _name;
-	      //              if (empty) cout << "unset " << _name;
-              else cout << _name << "=\"" << temp << "\"; export " << _name;
-              //else cout << name << "=" << CmtSystem::quote (temp, " \t") << "; export " << name;
+              if (empty) out << "[ -z ${" << _name << "+CMT} ] || unset " << _name;
+	      //              if (empty) out << "unset " << _name;
+              else out << _name << "=\"" << temp << "\"; export " << _name;
+              //else out << name << "=" << CmtSystem::quote (temp, " \t") << "; export " << name;
 
               result = 1;
@@ -1801,10 +1933,10 @@
             case Bat :
               temp.replace_all ("/", "\\");
-              cout << "set " << _name << "=" << CmtSystem::quote (temp, " \t");
-              //cout << "set " << name << "=" << temp;
+              out << "set " << _name << "=" << CmtSystem::quote (temp, " \t");
+              //out << "set " << name << "=" << temp;
               result = 1;
               break;
             case Xml :
-              cout << "<variable><name>" << _name << "</name>"
+              out << "<variable><name>" << _name << "</name>"
 		   << "<value>" << temp << "</value></variable>";
               result = 1;
@@ -1816,5 +1948,5 @@
           {
             case Csh :
-              cout << "alias " << name <<
+              out << "alias " << name <<
 		" \"" << temp << "\"";
 	      //CmtSystem::quote (temp, " \t");
@@ -1822,5 +1954,5 @@
               break;
             case Sh :
-              cout << "alias " << name <<
+              out << "alias " << name <<
 		"=\"" << temp << "\"";
 	      //"=" << CmtSystem::quote (temp, " \t");
@@ -1828,5 +1960,5 @@
               break;
             case Bat :
-              cout << "set " << name <<
+              out << "set " << name <<
 		"=" << CmtSystem::quote (temp, " \t");
 	      //"=" << temp;
@@ -1834,5 +1966,5 @@
               break;
             case Xml :
-              cout << "<alias><name>" << name << "</name>"
+              out << "<alias><name>" << name << "</name>"
 		   << "<value>" << temp << "</value></alias>";
               result = 1;
@@ -1852,29 +1984,29 @@
               {
                 case Csh :
-                  cout << "if ( -f " << CmtSystem::quote (name, " \t") << ".csh ) then" << endl;
-                  cout << "  source " << CmtSystem::quote (name, " \t") << ".csh" << endl;
-                  cout <<
+                  out << "if ( -f " << CmtSystem::quote (name, " \t") << ".csh ) then" << endl;
+                  out << "  source " << CmtSystem::quote (name, " \t") << ".csh" << endl;
+                  out <<
 		    "if ( $status != 0 ) then\n"
 		    "    set cmtsetupstatus=1\n"
 		    "endif\n";
-                  cout << "endif" << endl;
+                  out << "endif" << endl;
                   result = 1;
                   break;
                 case Sh :
-                  cout << "if test -f " << CmtSystem::quote (name, " \t") << ".sh; then" << endl;
-                  cout << "  . " << CmtSystem::quote (name, " \t") << ".sh" << endl;
-                  cout <<
+                  out << "if test -f " << CmtSystem::quote (name, " \t") << ".sh; then" << endl;
+                  out << "  . " << CmtSystem::quote (name, " \t") << ".sh" << endl;
+                  out <<
 		    "if test $? != 0; then\n"
 		    "    cmtsetupstatus=1\n"
 		    "fi\n";
-                  cout << "fi" << endl;
+                  out << "fi" << endl;
                   result = 1;
                   break;
                 case Bat :
-                  cout << "call " << CmtSystem::quote (name, " \t");
+                  out << "call " << CmtSystem::quote (name, " \t");
                   result = 1;
                   break;
                 case Xml :
-                  cout << "<script>" << name << "</script>";
+                  out << "<script>" << name << "</script>";
                   result = 1;
                   break;
@@ -2124,5 +2256,5 @@
       SymbolValue& value = value_list.values[selected];
 
-      result += value_list.print (symbol, value, first_definition);
+      result += value_list.print (symbol, value, first_definition, out);
     }
 
@@ -2202,5 +2334,25 @@
             else if (temp == "")
               {
-                temp = CmtSystem::getenv (symbol.name);
+		if (Cmt::get_env_access () ||
+		    Symbol::std_env_vars ().has (symbol.name))
+		  {
+		    temp = CmtSystem::getenv (symbol.name);
+		    if (Cmt::get_debug ())
+		      {
+			cerr << "SetBuilder::build> getenv (" << symbol.name
+			     << ") => " << temp << endl;
+		      }
+		  }
+		else
+		  {
+		    if (Cmt::get_debug ())
+		      {
+			cerr << "SetBuilder::build> getenv (" << symbol.name
+			     << ") denied" << endl;
+		      }
+		    CmtError::set (CmtError::warning,
+				   "getenv (" + symbol.name + ") denied");
+		    return "";
+		  }
               }
 
@@ -2263,10 +2415,109 @@
 }
 
+namespace
+{
+int find_path_entry (const CmtSystem::cmt_string_vector& items, const cmt_string& value)
+{
+  //  if (value.size () == 0) return true;
+  
+  static cmt_vmap <cmt_string, cmt_string> realpaths;
+
+  cmt_string rvalue;
+  const cmt_string * prvalue;
+
+  if (!(prvalue = realpaths.find (value)))
+    {
+      // if (!CmtSystem::realpath_ (value, rvalue))
+      //{
+	  rvalue = value;
+	  CmtSystem::compress_path (rvalue);
+      //}
+      prvalue = &rvalue;
+      realpaths.add (value, rvalue);
+      //      cerr << "realpaths.add: " << value << " , " << rvalue << endl;
+    }
+
+  for (int i = 0; i < items.size (); i++)
+    {
+      const cmt_string& item = items[i];
+      if (item.size () == 0) continue;
+      cmt_string ritem;
+      const cmt_string * pritem;
+
+      if (!(pritem = realpaths.find (item)))
+	{
+	  //if (!CmtSystem::realpath_ (item, ritem))
+	  //{
+	      ritem = item;
+	      CmtSystem::compress_path (ritem);
+	  //}
+	  pritem = &ritem;
+	  realpaths.add (item, ritem);
+	  //  cerr << "realpaths.add: " << item << " , " << ritem << endl;
+	}
+      if (*pritem == *prvalue)
+	{
+	  return i;
+	}
+    }
+
+  return -1;
+}
+
+}
+/*
 static bool find_path_entry (const CmtSystem::cmt_string_vector& items, const cmt_string& value)
+{
+  if (value.size () == 0) return true;
+
+  static cmt_vmap <cmt_string, cmt_string> realpaths;
+
+  cmt_string rvalue;
+  const cmt_string * prvalue;
+
+  if (!(prvalue = realpaths.find (value)))
+    {
+      // if (!CmtSystem::realpath_ (value, rvalue))
+      //{
+	  rvalue = value;
+	  CmtSystem::compress_path (rvalue);
+      //}
+      prvalue = &rvalue;
+      realpaths.add (value, rvalue);
+      //      cerr << "realpaths.add: " << value << " , " << rvalue << endl;
+    }
+
+  for (int i = 0; i < items.size (); i++)
+    {
+      const cmt_string& item = items[i];
+      if (item.size () == 0) continue;
+      cmt_string ritem;
+      const cmt_string * pritem;
+
+      if (!(pritem = realpaths.find (item)))
+	{
+	  //if (!CmtSystem::realpath_ (item, ritem))
+	  //{
+	      ritem = item;
+	      CmtSystem::compress_path (ritem);
+	  //}
+	  pritem = &ritem;
+	  realpaths.add (item, ritem);
+	  //  cerr << "realpaths.add: " << item << " , " << ritem << endl;
+	}
+      if (*pritem == *prvalue)
+	{
+	  return true;
+	}
+    }
+
+  return false;
+}
+*/
+/*
+static bool find_path_entry (const cmt_string& paths, const cmt_string& value)
 {
   static const cmt_string path_separator = CmtSystem::path_separator ();
   static cmt_vmap <cmt_string, cmt_string> realpaths;
-
-  if (value.size () == 0) return true;
 
   cmt_string rvalue;
@@ -2285,6 +2536,6 @@
     }
 
-  //  CmtSystem::cmt_string_vector items;
-  //  CmtSystem::split (paths, path_separator, items);
+  CmtSystem::cmt_string_vector items;
+  CmtSystem::split (paths, path_separator, items);
 
   bool found = false;
@@ -2293,5 +2544,4 @@
     {
       const cmt_string& item = items[i];
-      if (item.size () == 0) continue;
       cmt_string ritem;
       const cmt_string * pritem;
@@ -2317,55 +2567,16 @@
   return (found);
 }
-
-static bool find_path_entry (const cmt_string& paths, const cmt_string& value)
-{
-  static const cmt_string path_separator = CmtSystem::path_separator ();
-  static cmt_vmap <cmt_string, cmt_string> realpaths;
-
-  cmt_string rvalue;
-  const cmt_string * prvalue;
-
-  if (!(prvalue = realpaths.find (value)))
-    {
-      if (!CmtSystem::realpath_ (value, rvalue))
-	{
-	  rvalue = value;
-	  CmtSystem::compress_path (rvalue);
-	}
-      prvalue = &rvalue;
-      realpaths.add (value, rvalue);
-      //      cerr << "realpaths.add: " << value << " , " << rvalue << endl;
-    }
-
-  CmtSystem::cmt_string_vector items;
-  CmtSystem::split (paths, path_separator, items);
-
-  bool found = false;
-
-  for (int i = 0; i < items.size (); i++)
-    {
-      const cmt_string& item = items[i];
-      cmt_string ritem;
-      const cmt_string * pritem;
-
-      if (!(pritem = realpaths.find (item)))
-	{
-	  if (!CmtSystem::realpath_ (item, ritem))
-	    {
-	      ritem = item;
-	      CmtSystem::compress_path (ritem);
-	    }
-	  pritem = &ritem;
-	  realpaths.add (item, ritem);
-	  //  cerr << "realpaths.add: " << item << " , " << ritem << endl;
-	}
-      if (*pritem == *prvalue)
-	{
-	  found = true;
-	  break;
-	}
-    }
-
-  return (found);
+*/
+//-------------------------------------------------------------
+PathBuilder::PathBuilder ()
+  : m_path_strip (false)
+{
+}
+
+//-------------------------------------------------------------
+PathBuilder::PathBuilder (bool path_strip)
+{
+  PathBuilder ();
+  m_path_strip = path_strip;
 }
 
@@ -2401,6 +2612,29 @@
   level++;
 
+		if (Cmt::get_env_access () ||
+		    Symbol::std_env_vars ().has (symbol.name))
+		  {
+  //temp = CmtSystem::getenv (symbol.name);
   CmtSystem::split (CmtSystem::getenv (symbol.name), path_separator, temp_vector);
-  //temp = CmtSystem::getenv (symbol.name);
+  filter_path_value (symbol, temp_vector);
+		    if (Cmt::get_debug ())
+		      {
+			cmt_string temp_txt;
+			Cmt::vector_to_string (temp_vector, path_separator, temp_txt);
+			cerr << "PathBuilder::build> getenv (" << symbol.name
+			     << ") => " << temp_txt << endl;
+		      }
+		  }
+		else
+		  {
+		    if (Cmt::get_debug ())
+		      {
+			cerr << "PathBuilder::build> getenv (" << symbol.name
+			     << ") denied" << endl;
+		      }
+		    CmtError::set (CmtError::warning,
+				   "getenv (" + symbol.name + ") denied");
+		    return "";
+		  }
 
   bool first_definition = true;
@@ -2442,4 +2676,5 @@
 		CmtSystem::split (new_value, path_separator, temp_vector);
                 //temp = new_value;
+		filter_path_value (symbol, temp_vector);
               }
 
@@ -2451,14 +2686,17 @@
 		CmtSystem::split (new_value, path_separator, new_value_vector);
 		for (int i = 0; i < new_value_vector.size (); i++)
-		  if (!find_path_entry (temp_vector, new_value_vector[i]))
-		    //if (!find_path_entry (temp, new_value))
-		    {
-		      temp_vector.push_back (new_value_vector[i]);
-		      /*
-			if (temp != "") temp += path_separator;
-			
-			temp += new_value;
-		      */
-		    }
+		  {
+		    if (new_value_vector[i].size () == 0) continue;
+		    int j = find_path_entry (temp_vector, new_value_vector[i]);
+		    if (j < 0)
+		      {
+			temp_vector.push_back (new_value_vector[i]);
+		      }
+		    else if (j < temp_vector.size () - 1)
+		      {
+			temp_vector [j] = "";
+			temp_vector.push_back (new_value_vector[i]);
+		      }
+		  }
               }
                   
@@ -2473,18 +2711,20 @@
 		for (int i = temp_vector.size () - 1; i > n - 1; i--)
 		  temp_vector [i] = temp_vector [i - n];
+		for (int i = 0; i < n; i++)
+		  temp_vector [i] = "";
 		for (int i = 0; i < new_value_vector.size (); i++)
-		  if (!find_path_entry (temp_vector, new_value_vector[i]))
-		    //if (!find_path_entry (temp, new_value))
-		    {
-		      temp_vector [i] = new_value_vector[i];
-		      /*
-			previous_temp = temp;
-			temp = new_value;
-			if (previous_temp != "") temp += path_separator;
-			temp += previous_temp;
-		      */
-		    }
-		  else
-		    temp_vector [i] = "";
+		  {
+		    if (new_value_vector[i].size () == 0) continue;
+		    int j = find_path_entry (temp_vector, new_value_vector[i]);
+		    if (j < 0)
+		      {
+			temp_vector [i] = new_value_vector[i];
+		      }
+		    else if (j >= n)
+		      {
+			temp_vector [i] = new_value_vector[i];
+			temp_vector [j] = "";
+		      }
+		  }
               }
 	    
@@ -2614,5 +2854,5 @@
 
   level--;
-
+  /*
   for (;;)
     {
@@ -2637,5 +2877,5 @@
   temp.replace_all ("::", ":");
   temp.replace_all (";;", ";");
-  
+  */
   return (temp);
 }
@@ -2767,4 +3007,90 @@
   
   return (temp);
+}
+
+//-------------------------------------------------------------
+void PathBuilder::filter_path_value (const Symbol& symbol,
+				     CmtSystem::cmt_string_vector& value,
+				     const cmt_string& /* tag_name */) const
+{
+  static cmt_regexp reg ("[$%`]");
+
+  cmt_vector<int> path (value.size ());
+  int n (0);
+
+  for (int j = 0; j < value.size (); j++)
+    {
+      const cmt_string& v = value[j];
+      bool exists (false);  
+      for (int i = 0; i < j; i++)
+	{
+          if (value[i] == v)
+	    {
+	      exists = true;
+	      break;
+	    }
+	}	  	  
+      if (!exists)
+	{
+	  if (m_path_strip)
+	    {
+	      if (!reg.match (v))
+		{
+		  if (!CmtSystem::test_directory (v))
+		    {
+		      CmtMessage::verbose ("Non-existent directory " + v + " in " + symbol.name + " skipped");
+		      continue;
+		    }
+		}
+	      else
+		{
+		  if (CmtMessage::active (Verbose))
+		    {
+		      CmtMessage::warning ("Unresolved directory name " + v + " in " + symbol.name);
+		    }
+		}
+	    }
+	  else
+	    {
+	      if (CmtMessage::active (Verbose))
+		if (!reg.match (v) &&
+		    !CmtSystem::test_directory (v))
+		  {
+		    CmtMessage::warning ("Non-existent directory " + v + " in " + symbol.name);
+		  }
+	    }
+	  path[n++] = j;
+	}
+    }
+
+  for (int i = 0; i < n; i++)
+    if (i != path[i]) value[i] = value[path[i]];
+  
+  value.resize (n);
+}
+
+//-------------------------------------------------------------
+void PathBuilder::filter_path_value (const Symbol& symbol,
+				     cmt_string& value,
+				     const cmt_string& tag_name) const
+{
+  static cmt_string ps (CmtSystem::path_separator ());
+  CmtSystem::cmt_string_vector paths;
+
+  CmtSystem::split (value, ps, paths);
+  filter_path_value (symbol, paths, tag_name);
+  Cmt::vector_to_string (paths, ps, value);
+}
+
+//-------------------------------------------------------------
+inline const bool& PathBuilder::get_path_strip () const
+{
+  return m_path_strip;
+}
+
+//-------------------------------------------------------------
+inline void PathBuilder::set_path_strip (const bool& path_strip)
+{
+  m_path_strip = path_strip;
 }
 
@@ -3275,13 +3601,15 @@
 int SymbolValueList::print (const Symbol& symbol, 
 			    const SymbolValue& value, 
-			    bool& first_definition) const
+			    bool& first_definition,
+			    ostream& out) const
 {
   int result (0);
-
-  //if (use->get_package_name () == "CMT") return result;
 
   cmt_string discarded_text;
   cmt_string define_text;
   ActionType action = Cmt::get_action ();
+
+  static PathBuilder* pb (0);
+  cmt_string rvalue (value.text);
 
   switch (command_type)
@@ -3306,5 +3634,200 @@
       case CommandMacroRemoveAllRegexp :
 	//case CommandAction :
-	if (value.text == "") return result;
+	if (value.text.size () == 0) return result;
+        break;
+    }
+
+  CmtError::code code (CmtError::ok);
+  cmt_string msg, n;
+  int exec_err (0);
+
+  switch (command_type)
+    {
+      case CommandSet :
+      case CommandSetAppend :
+      case CommandSetPrepend :
+      case CommandSetRemove :
+      case CommandSetRemoveRegexp :
+
+	if (CmtError::has_pending_error ())
+	  {
+	    code = CmtError::get_last_error_code ();
+	    msg = CmtError::get_last_error ();
+	    exec_err = CmtError::get_last_execution_error ();
+	    n = CmtError::get_error_name (code);
+	    CmtError::clear ();
+	  }
+	resolve_value_for_macros (rvalue);
+	if (CmtError::get_last_error_code () != CmtError::warning)
+	  {
+	    if (CmtError::has_pending_error ())
+	      {
+		CmtError::print ();
+		CmtError::clear ();
+	      }
+	    if (CmtError::ok != code)
+	      {
+		// restore error occurred before value expansion
+		CmtError::set (code,
+			       (msg.replace (n + ": ", cmt_string ("")), msg),
+			       exec_err);
+	      }
+	    if (CommandSet != command_type &&
+		rvalue.size () == 0)
+	      return result;
+	  }
+	else
+	  {
+	    if (CmtMessage::active (Verbose))
+	      CmtError::print ();
+	    CmtError::clear ();
+	    if (CmtError::ok != code)
+	      {
+		// restore error occurred before value expansion
+		CmtError::set (code,
+			       (msg.replace (n + ": ", cmt_string ("")), msg),
+			       exec_err);
+	      }
+	    // Ignore the error, keep the value unresolved
+	    rvalue = value.text;
+	  }
+
+        break;
+
+	//case CommandAlias :
+      case CommandPath :
+      case CommandPathAppend :
+      case CommandPathPrepend :
+      case CommandPathRemove :
+      case CommandPathRemoveRegexp :
+	//case CommandMacroPrepend :
+	//case CommandMacro :
+	//case CommandMacroAppend :
+	//case CommandMacroRemove :
+	//case CommandMacroRemoveRegexp :
+	//case CommandMacroRemoveAll :
+	//case CommandMacroRemoveAllRegexp :
+	//case CommandAction :
+
+	if (!pb)
+	  pb = static_cast<PathBuilder*> (symbol.builder);
+	if (pb->get_path_strip ())
+	  {
+	    /*
+	    CmtError::code code (CmtError::ok);
+	    cmt_string msg, n;
+	    int exec_err (0);
+	    */
+	    if (CmtError::has_pending_error ())
+	      {
+		code = CmtError::get_last_error_code ();
+		msg = CmtError::get_last_error ();
+		exec_err = CmtError::get_last_execution_error ();
+		n = CmtError::get_error_name (code);
+		CmtError::clear ();
+	      }
+	    resolve_value (rvalue);
+	    if (CmtError::get_last_error_code () != CmtError::warning)
+	      {
+		if (CmtError::has_pending_error ())
+		  {
+		    CmtError::print ();
+		    CmtError::clear ();
+		  }
+		if (CmtError::ok != code)
+		  {
+		    // restore error occurred before value expansion
+		    CmtError::set (code,
+				   (msg.replace (n + ": ", cmt_string ("")), msg),
+				   exec_err);
+		  }
+		if (CommandPath != command_type &&
+		    rvalue.size () == 0)
+		  return result;
+	      }
+	    else
+	      {
+		if (CommandPathRemove == command_type ||
+		    CommandPathRemoveRegexp == command_type)
+		  {
+		    // This means that the value is not resolved via symbols
+		    // and, possibly, standard environment variables and
+		    //   * either has no effect on the path at all,
+		    //     or
+		    //   * there should be similar contribution from
+		    //     and, hence, we should get the same error with 
+		    //     CommandPath, CommandPathAppend, or CommandPathPrepend
+		    //  Either way, we can ignore this error.
+
+		    if (CmtMessage::active (Verbose))
+		      CmtError::print ();
+		    CmtError::clear ();
+		    if (CmtError::ok != code)
+		      {
+			// restore error occurred before value expansion
+			CmtError::set (code,
+				       (msg.replace (n + ": ", cmt_string ("")), msg),
+				       exec_err);
+		      }
+		  }
+		else if (CmtError::ok != code)
+		  {
+		    // print error occurred before value expansion
+		    CmtMessage::error (msg);
+		  }
+		// We keep CmtError::warning to indicate that
+		// we could not resolve path
+		// (without referencing the environment)
+		// and strip path of non-existent directories
+		//
+		rvalue = value.text;
+	      }
+	  }
+	else // (!pb->get_path_strip ())
+	  {
+	    if (CmtError::has_pending_error ())
+	      {
+		code = CmtError::get_last_error_code ();
+		msg = CmtError::get_last_error ();
+		exec_err = CmtError::get_last_execution_error ();
+		n = CmtError::get_error_name (code);
+		CmtError::clear ();
+	      }
+	    resolve_value_for_macros (rvalue);
+	    if (CmtError::get_last_error_code () != CmtError::warning)
+	      {
+		if (CmtError::has_pending_error ())
+		  {
+		    CmtError::print ();
+		    CmtError::clear ();
+		  }
+		if (CmtError::ok != code)
+		  {
+		    // restore error occurred before value expansion
+		    CmtError::set (code,
+				   (msg.replace (n + ": ", cmt_string ("")), msg),
+				   exec_err);
+		  }
+		if (CommandPath != command_type &&
+		    rvalue.size () == 0)
+		  return result;
+	      }
+	    else
+	      {
+		if (CmtMessage::active (Verbose))
+		  CmtError::print ();
+		CmtError::clear ();
+		if (CmtError::ok != code)
+		  {
+		    // restore error occurred before value expansion
+		    CmtError::set (code,
+				   (msg.replace (n + ": ", cmt_string ("")), msg),
+				   exec_err);
+		  }
+		// Ignore the error, keep the value unresolved
+		rvalue = value.text;
+	      }
+	  }
+
         break;
     }
@@ -3317,11 +3840,5 @@
 
   if (CmtMessage::active (Verbose))
-    cout << "# Package " << (use != 0 ? use->get_package_name () + " " + use->version : "");
-  /*
-  if (use != 0)
-    {
-      cout << use->get_package_name () << " " << use->version;
-    }
-  */
+    out << "# Package " << (use ? use->get_package_name () + " " + use->version : "");
 
   switch (command_type)
@@ -3329,7 +3846,7 @@
       case CommandSet :
 	if (CmtMessage::active (Verbose))
-	  cout << " " << define_text << " set " << symbol.name << " as " << endl;
-	//        cout << " " << define_text << " set " << symbol.name << " as ";
-        cout << "set " << symbol.name;
+	  out << " " << define_text << " set " << symbol.name << " as " << endl;
+	//        out << " " << define_text << " set " << symbol.name << " as ";
+        out << "set " << symbol.name;
         first_definition = false;
 	result = 1;
@@ -3337,43 +3854,51 @@
       case CommandSetAppend :
 	if (CmtMessage::active (Verbose))
-	  cout << " appends to set " << symbol.name << " : " << endl;
-	//        cout << " appends to set " << symbol.name << " : ";
-        cout << "set_append " << symbol.name;
+	  out << " appends to set " << symbol.name << " : " << endl;
+	//        out << " appends to set " << symbol.name << " : ";
+        out << "set_append " << symbol.name;
 	result = 1;
         break;
       case CommandSetPrepend :
 	if (CmtMessage::active (Verbose))
-	  cout << " prepends to set " << symbol.name << " : " << endl;
-	//        cout << " prepends to set " << symbol.name << " : ";
-        cout << "set_prepend " << symbol.name;
+	  out << " prepends to set " << symbol.name << " : " << endl;
+	//        out << " prepends to set " << symbol.name << " : ";
+        out << "set_prepend " << symbol.name;
 	result = 1;
         break;
       case CommandSetRemove :
 	if (CmtMessage::active (Verbose))
-	  cout << " removes from set " << symbol.name << " : " << endl;
-	//        cout << " removes from set " << symbol.name << " : ";
-        cout << "set_remove " << symbol.name;
+	  out << " removes from set " << symbol.name << " : " << endl;
+	//        out << " removes from set " << symbol.name << " : ";
+        out << "set_remove " << symbol.name;
 	result = 1;
         break;
       case CommandSetRemoveRegexp :
 	if (CmtMessage::active (Verbose))
-	  cout << " removes RE from set " << symbol.name << " : " << endl;
-	//        cout << " removes RE from set " << symbol.name << " : ";
-        cout << "set_remove_regexp " << symbol.name;
+	  out << " removes RE from set " << symbol.name << " : " << endl;
+	//        out << " removes RE from set " << symbol.name << " : ";
+        out << "set_remove_regexp " << symbol.name;
 	result = 1;
         break;
       case CommandAlias :
 	if (CmtMessage::active (Verbose))
-	  cout << " " << define_text << " alias " << symbol.name << endl;
-	//        cout << " " << define_text << " alias " << symbol.name << " as ";
-        cout << "alias " << symbol.name;
+	  out << " " << define_text << " alias " << symbol.name << endl;
+	//        out << " " << define_text << " alias " << symbol.name << " as ";
+        out << "alias " << symbol.name;
         first_definition = false;
 	result = 1;
         break;
-      case CommandPath :
+    case CommandPath :
 	if (CmtMessage::active (Verbose))
-	  cout << " " << define_text << " path " << symbol.name << endl;
-	//        cout << " " << define_text << " path " << symbol.name << " as ";
-        cout << "path " << symbol.name;
+	  out << " " << define_text << " path " << symbol.name << endl;
+	//        out << " " << define_text << " path " << symbol.name << " as ";
+	pb->filter_path_value (symbol, rvalue);
+
+	if (Cmt::get_debug ())
+	  {
+	    cerr << "|SymbolValueList::print> path " << symbol.name
+		 << " " << value.text << " => " << rvalue << endl;
+	  }
+
+        out << "path " << symbol.name;
         first_definition = false;
 	result = 1;
@@ -3381,84 +3906,116 @@
       case CommandPathAppend :
 	if (CmtMessage::active (Verbose))
-	  cout << " appends to path " << symbol.name << endl;
-	//        cout << " appends to path " << symbol.name << " : ";
-        cout << "path_append " << symbol.name;
+	  out << " appends to path " << symbol.name << endl;
+	//        out << " appends to path " << symbol.name << " : ";
+	pb->filter_path_value (symbol, rvalue);
+
+	if (Cmt::get_debug ())
+	  {
+	    cerr << "|SymbolValueList::print> path_append " << symbol.name
+		 << " " << value.text << " => " << rvalue << endl;
+	  }
+
+	if (rvalue.size () == 0) return result;
+        out << "path_append " << symbol.name;
 	result = 1;
         break;
       case CommandPathPrepend :
 	if (CmtMessage::active (Verbose))
-	  cout << " prepends to path " << symbol.name << " : " << endl;
-	//        cout << " prepends to path " << symbol.name << " : ";
-        cout << "path_prepend " << symbol.name;
+	  out << " prepends to path " << symbol.name << " : " << endl;
+	//        out << " prepends to path " << symbol.name << " : ";
+	pb->filter_path_value (symbol, rvalue);
+
+	if (Cmt::get_debug ())
+	  {
+	    cerr << "|SymbolValueList::print> path_prepend " << symbol.name
+		 << " " << value.text << " => " << rvalue << endl;
+	  }
+
+	if (rvalue.size () == 0) return result;
+        out << "path_prepend " << symbol.name;
 	result = 1;
         break;
       case CommandPathRemove :
 	if (CmtMessage::active (Verbose))
-	  cout << " removes from path " << symbol.name << " : " << endl;
-	//        cout << " removes from path " << symbol.name << " : ";
-        cout << "path_remove " << symbol.name;
+	  out << " removes from path " << symbol.name << " : " << endl;
+	//        out << " removes from path " << symbol.name << " : ";
+
+	if (Cmt::get_debug ())
+	  {
+	    cerr << "|SymbolValueList::print> path_remove " << symbol.name
+		 << " " << value.text << " => " << rvalue << endl;
+	  }
+
+        out << "path_remove " << symbol.name;
 	result = 1;
         break;
       case CommandPathRemoveRegexp :
 	if (CmtMessage::active (Verbose))
-	  cout << " removes RE from path " << symbol.name << " : " << endl;
-	//        cout << " removes RE from path " << symbol.name << " : ";
-        cout << "path_remove_regexp " << symbol.name;
+	  out << " removes RE from path " << symbol.name << " : " << endl;
+	//        out << " removes RE from path " << symbol.name << " : ";
+
+	if (Cmt::get_debug ())
+	  {
+	    cerr << "|SymbolValueList::print> path_remove_regexp " << symbol.name
+		 << " " << value.text << " => " << rvalue << endl;
+	  }
+
+        out << "path_remove_regexp " << symbol.name;
 	result = 1;
         break;
       case CommandMacro :
 	if (CmtMessage::active (Verbose))
-	  cout << " " << define_text << " macro " << symbol.name << " as " << endl;
-	//        cout << " " << define_text << " macro " << symbol.name << " as ";
-        cout << "macro " << symbol.name;
+	  out << " " << define_text << " macro " << symbol.name << " as " << endl;
+	//        out << " " << define_text << " macro " << symbol.name << " as ";
+        out << "macro " << symbol.name;
 	result = 1;
         break;
       case CommandMacroPrepend :
 	if (CmtMessage::active (Verbose))
-	  cout << " prepends to macro " << symbol.name << " : " << endl;
-	//        cout << " prepends to macro " << symbol.name << " : ";
-        cout << "macro_prepend " << symbol.name;
+	  out << " prepends to macro " << symbol.name << " : " << endl;
+	//        out << " prepends to macro " << symbol.name << " : ";
+        out << "macro_prepend " << symbol.name;
 	result = 1;
         break;
       case CommandMacroAppend :
 	if (CmtMessage::active (Verbose))
-	  cout << " appends to macro " << symbol.name << " : " << endl;
-	//        cout << " appends to macro " << symbol.name << " : ";
-        cout << "macro_append " << symbol.name;
+	  out << " appends to macro " << symbol.name << " : " << endl;
+	//        out << " appends to macro " << symbol.name << " : ";
+        out << "macro_append " << symbol.name;
 	result = 1;
         break;
       case CommandMacroRemove :
 	if (CmtMessage::active (Verbose))
-	  cout << " remove from macro " << symbol.name << " : " << endl;
-	//        cout << " remove from macro " << symbol.name << " : ";
-        cout << "macro_remove " << symbol.name;
+	  out << " remove from macro " << symbol.name << " : " << endl;
+	//        out << " remove from macro " << symbol.name << " : ";
+        out << "macro_remove " << symbol.name;
 	result = 1;
         break;
       case CommandMacroRemoveRegexp :
 	if (CmtMessage::active (Verbose))
-	  cout << " remove RE from macro " << symbol.name << " : " << endl;
-	//        cout << " remove RE from macro " << symbol.name << " : ";
-        cout << "macro_remove_regexp " << symbol.name;
+	  out << " remove RE from macro " << symbol.name << " : " << endl;
+	//        out << " remove RE from macro " << symbol.name << " : ";
+        out << "macro_remove_regexp " << symbol.name;
 	result = 1;
         break;
       case CommandMacroRemoveAll :
 	if (CmtMessage::active (Verbose))
-	  cout << " remove all from macro " << symbol.name << " : " << endl;
-	//        cout << " remove all from macro " << symbol.name << " : ";
-        cout << "macro_remove_all " << symbol.name;
+	  out << " remove all from macro " << symbol.name << " : " << endl;
+	//        out << " remove all from macro " << symbol.name << " : ";
+        out << "macro_remove_all " << symbol.name;
 	result = 1;
         break;
       case CommandMacroRemoveAllRegexp :
 	if (CmtMessage::active (Verbose))
-	  cout << " remove all RE from macro " << symbol.name << " : " << endl;
-	//        cout << " remove all RE from macro " << symbol.name << " : ";
-        cout << "macro_remove_all_regexp " << symbol.name;
+	  out << " remove all RE from macro " << symbol.name << " : " << endl;
+	//        out << " remove all RE from macro " << symbol.name << " : ";
+        out << "macro_remove_all_regexp " << symbol.name;
 	result = 1;
         break;
       case CommandSetupScript :
 	if (CmtMessage::active (Verbose))
-	  cout << " " << define_text << " setup script " << symbol.name << endl;
-	//       cout << " " << define_text << " action " << symbol.name << " as ";
-        cout << "setup_script" /* << symbol.name */;
+	  out << " " << define_text << " setup script " << symbol.name << endl;
+	//       out << " " << define_text << " action " << symbol.name << " as ";
+        out << "setup_script" /* << symbol.name */;
         first_definition = false;
 	result = 1;
@@ -3466,5 +4023,5 @@
 	/*
       case CommandAction :
-        cout << " " << define_text << " action " << symbol.name << " as ";
+        out << " " << define_text << " action " << symbol.name << " as ";
         first_definition = false;
         break;
@@ -3472,6 +4029,7 @@
     }
 
-  cout << " " << CmtSystem::quote (value.text, " \t");
-  //  cout << "'" << value.text << "'";
+  out << " " << CmtSystem::quote (rvalue, " \t");
+  //  out << " " << CmtSystem::quote (value.text, " \t");
+  //  out << "'" << value.text << "'";
           
   /*
@@ -3481,14 +4039,14 @@
       (selected_tag == Tag::get_default ()))
     {
-      cout << " for default tag";
+      out << " for default tag";
     }
   else
     {
-      cout << " for tag '" << selected_tag->get_name () << "'";
+      out << " for tag '" << selected_tag->get_name () << "'";
     }
   */
 
-  cout << endl;
-  //  cout << discarded_text << endl;
+  out << endl;
+  //  out << discarded_text << endl;
   return result;
 }
@@ -3547,5 +4105,25 @@
   else
     {
+		if (Cmt::get_env_access () ||
+		    Symbol::std_env_vars ().has (name))
+		  {
       s = CmtSystem::getenv (name);
+		    if (Cmt::get_debug ())
+		      {
+			cerr << "Symbol::get_env_value> getenv (" << name
+			     << ") => " << s << endl;
+		      }
+		  }
+		else
+		  {
+		    if (Cmt::get_debug ())
+		      {
+			cerr << "Symbol::get_env_value> getenv (" << name
+			     << ") denied" << endl;
+		      }
+		    CmtError::set (CmtError::warning,
+				   "getenv (" + name + ") denied");
+		    return (s);
+		  }
     }
 
Index: /CMT/HEAD/source/cmt_symbol.h
===================================================================
--- /CMT/HEAD/source/cmt_symbol.h	(revision 655)
+++ /CMT/HEAD/source/cmt_symbol.h	(revision 656)
@@ -34,5 +34,5 @@
   int select_last () const;
   void show (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const;
-  int print (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const;
+  int print (const Symbol& symbol, const SymbolValue& value, bool& first_definition, ostream& out = cout) const;
 
   CommandType command_type;
@@ -89,5 +89,6 @@
 
   static void all_set ();
-  static void all_print (PrintMode mode);
+  static void all_print (PrintMode mode, ostream& out = cout);
+  //static void all_print (PrintMode mode);
   static void all_print_clean (PrintMode mode);
   static void check_all_paths ();
@@ -96,4 +97,5 @@
   static SymbolVector& symbols ();
   static SymbolMap& symbol_map ();
+  static SymbolMap& std_env_vars ();
   static Symbol& symbol (int index);
   static void clear_all ();
@@ -107,4 +109,5 @@
 
   static bool get_inhibit_display ();
+  static bool set_path_strip (const bool& path_strip);
 
 public:
@@ -118,5 +121,6 @@
 
   int print_clean (PrintMode mode);
-  int print (PrintMode mode);
+  int print (PrintMode mode, ostream& out = cout);
+  //int print (PrintMode mode);
   cmt_string build_macro_value (bool display_it = false) const;
   int print_macro (PrintMode mode, ostream& out = cout) const;
Index: /CMT/HEAD/source/cmt_use.cxx
===================================================================
--- /CMT/HEAD/source/cmt_use.cxx	(revision 655)
+++ /CMT/HEAD/source/cmt_use.cxx	(revision 656)
@@ -1934,6 +1934,6 @@
     {
       cout << "|Use::change_path> path: " << new_path
-	   << ": project: " << (project ? project->get_cmtpath () : "0")
-	   << ": " << get_info () << endl;
+	   << " project: " << (project ? project->get_cmtpath () : "0")
+	   << " use: " << get_info () << endl;
     }
 
@@ -1978,6 +1978,6 @@
     {
       cout << "<Use::change_path| real_path: " << real_path
-	   << ": m_project: " << (m_project ? m_project->get_cmtpath () : "0")
-	   << ": " << get_info () << endl;
+	   << " m_project: " << (m_project ? m_project->get_cmtpath () : "0")
+	   << " use: " << get_info () << endl;
     }
 }
@@ -3770,4 +3770,22 @@
     }
 
+  if (action_setup == Cmt::get_action () &&
+      Requirements == Cmt::get_print_mode ())
+    {
+      //cerr << "|Use::fill_standard_macros> Checking for " << prefix << "CONFIG" << endl;
+      if (!discarded &&
+	  get_package_name () != "cmt_standalone" &&
+	  get_strategy ("SetupConfig"))
+	{
+	  buffer += "macro ";
+	  buffer += prefix;
+	  buffer += "CONFIG";
+	  buffer += " \"";
+	  buffer += CmtSystem::get_cmt_config ();
+	  buffer += "\"";
+	  buffer += "\n";
+	}
+    }
+
   buffer += "macro ";
   buffer += prefix;
