Index: rtemstoolkit/configuration.py
===================================================================
--- rtemstoolkit/configuration.py	(revision 7051ba5b1958b3926cb69b98d0d9f1db384f754f)
+++ rtemstoolkit/configuration.py	(revision bf58911519afb7ce2117dedadf3d76da436b2361)
@@ -37,4 +37,5 @@
 import os
 import re
+import yaml
 
 try:
@@ -52,4 +53,21 @@
         self.ini = None
         self.macro_filter = re.compile('\$\{.+\}')
+
+    def __str__(self):
+        if self.ini is None:
+            return 'empty'
+        s = ['Base: %s' % (self.ini['base'])]
+        s += ['Files:']
+        for f in self.ini['files']:
+            s += [' %s' % (f)]
+        s += ['Defaults:']
+        for default in self.config.defaults():
+            s += ' ' + default
+        s += ['Sections:']
+        for section in self.config.sections():
+            s += [' [%s]' % (section)]
+            for option in self.config.options(section):
+                s += ['  %s = %s' % (option, self.config.get(section, option))]
+        return os.linesep.join(s)
 
     def get_item(self, section, label, err = True):
@@ -79,8 +97,12 @@
         return rec
 
-    def get_items(self, section, err = True):
+    def get_items(self, section, err = True, flatten = True):
         try:
-            items = [(name, key.replace(os.linesep, ' ')) \
-                     for name, key in self.config.items(section)]
+            items = []
+            for name, key in self.config.items(section):
+                if flatten:
+                    items += [(name, key.replace(os.linesep, ' '))]
+                else:
+                    items += [(name, key)]
             return items
         except:
@@ -102,4 +124,7 @@
                 raise error.general('config: section "%s" not found' % (section))
         return []
+
+    def has_section(self, section):
+        return self.config.has_section(section)
 
     def load(self, name):
@@ -133,5 +158,4 @@
                     includes += self.comma_list(section, 'include', err = False)
 
-
     def files(self):
         return self.ini['files']
Index: rtemstoolkit/macros.py
===================================================================
--- rtemstoolkit/macros.py	(revision 7051ba5b1958b3926cb69b98d0d9f1db384f754f)
+++ rtemstoolkit/macros.py	(revision bf58911519afb7ce2117dedadf3d76da436b2361)
@@ -135,16 +135,17 @@
             text += '> %s%s' % (f, os.linesep)
         for map in self.macros:
-            if map in self.read_maps:
-                if self.read_map_locked:
-                    rm = 'R'
-                else:
-                    rm = 'r'
-            else:
-                rm = '-'
+            rm = '-'
+            for rmap in self.read_maps:
+                if rmap[4:] == '___%s' % (map):
+                    if self.read_map_locked:
+                        rm = 'R[%s]' % (rmap[:4])
+                    else:
+                        rm = 'r[%s]' % (rmap[:4])
+                    break
             if map == self.write_map:
                 wm = 'w'
             else:
                 wm = '-'
-            text += '[%s] %s%s%s' % (map, rm, wm, os.linesep)
+            text += '[%s] %s,%s%s' % (map, wm, rm, os.linesep)
             for k in sorted(self.macros[map].keys()):
                 d = self.macros[map][k]
@@ -251,5 +252,5 @@
 
     def get_read_maps(self):
-        return [rm[5:] for rm in self.read_maps]
+        return [rm[7:] for rm in self.read_maps]
 
     def key_filter(self, key):
@@ -494,5 +495,5 @@
             if _map in self.macros:
                 if _map not in self.get_read_maps():
-                    rm = '%04d_%s' % (len(self.read_maps), _map)
+                    rm = '%04d___%s' % (len(self.read_maps), _map)
                     self.read_maps = sorted(self.read_maps + [rm])
                 return True
@@ -503,14 +504,22 @@
             if _map in self.get_read_maps():
                 for i in range(0, len(self.read_maps)):
-                    if '%04d_%s' % (i, _map) == self.read_maps[i]:
+                    if '%04d___%s' % (i, _map) == self.read_maps[i]:
                         self.read_maps.pop(i)
                 return True
         return False
 
-    def set_write_map(self, map):
-        if map in self.macros:
-            self.write_map = map
+    def set_write_map(self, _map, add = False):
+        if _map in self.macros:
+            self.write_map = _map
+            return True
+        elif add:
+            self.write_map = _map
+            self.macros[_map] = {}
             return True
         return False
+
+    def unset_write_map(self):
+        self.write_map = 'global'
+        return True
 
     def lock_read_map(self):
Index: rtemstoolkit/path.py
===================================================================
--- rtemstoolkit/path.py	(revision 7051ba5b1958b3926cb69b98d0d9f1db384f754f)
+++ rtemstoolkit/path.py	(revision bf58911519afb7ce2117dedadf3d76da436b2361)
@@ -154,5 +154,4 @@
     path = host(path)
     shutil.rmtree(path, onerror = _onerror)
-    return
 
 def expand(name, paths):
@@ -161,4 +160,9 @@
         l += [join(p, name)]
     return l
+
+def expanduser(path):
+    path = host(path)
+    path = os.path.expanduser(path)
+    return shell(path)
 
 def collect_files(path_):
