+####################
+
+
+def show_variable(cdef, cread, cwrite,
+ category, variable, show_value, show_comments):
+ assert category.has_key('id')
+ assert variable.has_key('id')
+
+ category_id = category['id']
+ variable_id = variable['id']
+
+ default_value = get_value(cdef, category_id, variable_id)
+ current_value = get_current_value(cread, cwrite, category_id, variable_id)
+ varname = get_varname(cread, category_id, variable_id)
+ if show_comments:
+ print_name_comments(cdef, category_id, variable_id)
+ if show_value:
+ print "%s = %s" % (varname, current_value)
+ else:
+ print "%s" % (varname)
+
+
+def show_variables_all(cdef, cread, cwrite, show_value, show_comments):
+ for (category_id, (category, variables)) in cread.variables().iteritems():
+ print("========== Category = %s" % category_id.upper())
+ for variable in variables.values():
+ show_variable(cdef, cread, cwrite,
+ category, variable, show_value, show_comments)
+
+
+def show_variables_category(cdef, cread, cwrite, cid, show_value, show_comments):
+ cid = cid.lower()
+ CID = cid.upper()
+ print("========== Category = %s" % CID)
+ for vid in list_category(cdef, cid):
+ (category, variable) = cdef.locate_varname(vid.upper())
+ show_variable(cdef, cread, cwrite, category, variable,
+ show_value, show_comments)
+
+####################
+re_mainloop_0arg = "^(?P<command>[uUwrRqlLsSeEcvVhH\?])[ \t]*$"
+re_mainloop_1arg = "^(?P<command>[sSeEvV])[ \t]+(?P<arg>\w+)$"
+matcher_mainloop_0arg = re.compile(re_mainloop_0arg)
+matcher_mainloop_1arg = re.compile(re_mainloop_1arg)
+
+
+def mainloop(cdef, cread, cwrite, default_config, site_config, consolidated_config):
+ global service