Browse Source

Rename shell_spawn.c to shell_loop.c

Serj Kalichev 9 years ago
parent
commit
f6ebb03a99
3 changed files with 14 additions and 4 deletions
  1. 1 1
      clish/shell/module.am
  2. 3 1
      clish/shell/shell_loop.c
  3. 10 2
      clish/shell/shell_startup.c

+ 1 - 1
clish/shell/module.am

@@ -9,7 +9,7 @@ libclish_la_SOURCES += \
 	clish/shell/shell_new.c \
 	clish/shell/shell_parse.c \
 	clish/shell/shell_file.c \
-	clish/shell/shell_spawn.c \
+	clish/shell/shell_loop.c \
 	clish/shell/shell_startup.c \
 	clish/shell/shell_wdog.c \
 	clish/shell/shell_pwd.c \

+ 3 - 1
clish/shell/shell_spawn.c → clish/shell/shell_loop.c

@@ -1,5 +1,5 @@
 /*
- * shell_new.c
+ * shell_loop.c
  */
 #include "private.h"
 #include "lub/string.h"
@@ -11,6 +11,8 @@
 #include <unistd.h>
 
 /*-------------------------------------------------------- */
+/* The main CLI loop while interactive execution.
+ */
 int clish_shell_loop(clish_shell_t *this)
 {
 	int running = 0;

+ 10 - 2
clish/shell/shell_startup.c

@@ -80,6 +80,9 @@ const char * clish_shell__get_default_shebang(const clish_shell_t *this)
 }
 
 /*-------------------------------------------------------- */
+/* Static recursive function to iterate parameters. Logically it's the
+ * part of clish_shell_prepare() function.
+ */
 static int iterate_paramv(clish_shell_t *this, clish_paramv_t *paramv,
 	clish_hook_access_fn_t *access_fn)
 {
@@ -126,6 +129,12 @@ static int iterate_paramv(clish_shell_t *this, clish_paramv_t *paramv,
 }
 
 /*-------------------------------------------------------- */
+/* This function prepares schema for execution. It loads
+ * plugins, link unresolved symbols, then iterates all the
+ * objects and link them to each other, check access
+ * permissions. Don't execute clish_shell_startup() without this
+ * function.
+ */
 int clish_shell_prepare(clish_shell_t *this)
 {
 	clish_command_t *cmd;
@@ -136,8 +145,8 @@ int clish_shell_prepare(clish_shell_t *this)
 	lub_bintree_iterator_t cmd_iter, view_iter;
 	lub_list_node_t *nspace_iter;
 	clish_hook_access_fn_t *access_fn = NULL;
-	int i;
 	clish_paramv_t *paramv;
+	int i;
 
 	/* Add default plugin to the list of plugins */
 	if (this->default_plugin) {
@@ -278,5 +287,4 @@ int clish_shell_prepare(clish_shell_t *this)
 	return 0;
 }
 
-
 /*----------------------------------------------------------- */