Browse Source

The clish option -l implemented. It starts clish without using locking mechanism. It needed when the clish is executed from clish's ACTION. Nesting clish execution.

git-svn-id: https://klish.googlecode.com/svn/trunk@243 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
fbce1160ec
1 changed files with 10 additions and 1 deletions
  1. 10 1
      bin/clish.cpp

+ 10 - 1
bin/clish.cpp

@@ -39,12 +39,14 @@ int main(int argc, char **argv)
 
 	/* Command line options */
 	const char *socket_path = KONFD_SOCKET_PATH;
+	bool_t lockless = BOOL_FALSE;
 
-	static const char *shortopts = "hvs:";
+	static const char *shortopts = "hvs:l";
 /*	static const struct option longopts[] = {
 		{"help",	0, NULL, 'h'},
 		{"version",	0, NULL, 'v'},
 		{"socket",	1, NULL, 's'},
+		{"lockless",	0, NULL, 'l'},
 		{NULL,		0, NULL, 0}
 	};
 */
@@ -60,6 +62,9 @@ int main(int argc, char **argv)
 		case 's':
 			socket_path = optarg;
 			break;
+		case 'l':
+			lockless = BOOL_TRUE;
+			break;
 		case 'h':
 			help(0, argv[0]);
 			exit(0);
@@ -84,6 +89,9 @@ int main(int argc, char **argv)
 	clish_shell_load_files(shell);
 	/* Set communication to the konfd */
 	clish_shell__set_socket(shell, socket_path);
+	/* Set lockless mode */
+	if (lockless)
+		clish_shell__set_lockfile(shell, NULL);
 	/* Execute startup */
 	running = clish_shell_startup(shell);
 	if (!running) {
@@ -137,6 +145,7 @@ static void help(int status, const char *argv0)
 		printf("\t-h, --help\tPrint this help.\n");
 		printf("\t-s <path>, --socket=<path>\tSpecify listen socket "
 			"of the konfd daemon.\n");
+		printf("\t-l, --lockless\tDon't use locking mechanism.\n");
 	}
 }