Kaynağa Gözat

Implement the CLISH_VIEW, CLISH_VIEWID environment variables. It can redefine startup settings.

git-svn-id: https://klish.googlecode.com/svn/trunk@113 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 yıl önce
ebeveyn
işleme
74ef84e950
1 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. 8 0
      clish/shell/shell_tinyxml_read.cpp

+ 8 - 0
clish/shell/shell_tinyxml_read.cpp

@@ -256,6 +256,14 @@ process_startup(clish_shell_t * shell, TiXmlElement * element, void *parent)
 	clish_command_t *cmd = NULL;
 	const char *view = element->Attribute("view");
 	const char *viewid = element->Attribute("viewid");
+	const char *env_view = getenv("CLISH_VIEW");
+	const char *env_viewid = getenv("CLISH_VIEWID");
+
+	/* Redefine startup view if environment is set. */
+	if (env_view)
+		view = env_view;
+	if (env_viewid)
+		viewid = env_viewid;
 
 	assert(NULL == shell->startup);
 	assert(view);