Browse Source

Add __watchdog_timeout variable

git-svn-id: https://klish.googlecode.com/svn/trunk@500 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
bf4559a044
2 changed files with 8 additions and 1 deletions
  1. 3 1
      clish/shell/shell_execute.c
  2. 5 0
      clish/shell/shell_var.c

+ 3 - 1
clish/shell/shell_execute.c

@@ -307,7 +307,9 @@ int clish_shell_execute(clish_context_t *context, char **out)
 	if (this->wdog_timeout && saved_wdog_timeout) {
 		tinyrl__set_timeout(this->tinyrl, this->wdog_timeout);
 		this->wdog_active = BOOL_TRUE;
-		fprintf(stderr, "The watchdog is active. Press any key to stop it.\n");
+		fprintf(stderr, "Warning: The watchdog is active. Timeout is %u "
+			"seconds.\nWarning: Press any key to stop watchdog.\n",
+			this->wdog_timeout);
 	} else
 		tinyrl__set_timeout(this->tinyrl, this->idle_timeout);
 

+ 5 - 0
clish/shell/shell_var.c

@@ -63,6 +63,11 @@ static char *find_context_var(const char *name, clish_context_t *this)
 			tinyrl__get_height(shell->tinyrl));
 		tmp[sizeof(tmp) - 1] = '\0';
 		result = strdup(tmp);
+	} else if (!lub_string_nocasecmp(name, "__watchdog_timeout")) {
+		char tmp[5];
+		snprintf(tmp, sizeof(tmp), "%u", shell->wdog_timeout);
+		tmp[sizeof(tmp) - 1] = '\0';
+		result = strdup(tmp);
 	} else if (!this->cmd) { /* The vars dependent on command */
 		return NULL;
 	} else if (!lub_string_nocasecmp(name, "__full_cmd")) {