Forráskód Böngészése

Rename KCONTEXT_ enum to KCONTEXT_TYPE_

Serj Kalichev 2 éve
szülő
commit
c48a485d2c

+ 2 - 2
bin/klishd/klishd.c

@@ -392,7 +392,7 @@ static kscheme_t *load_all_dbs(const char *dbs,
 	}
 
 	// Prepare scheme
-	context = kcontext_new(KCONTEXT_PLUGIN_INIT);
+	context = kcontext_new(KCONTEXT_TYPE_PLUGIN_INIT);
 	kcontext_set_scheme(context, scheme);
 	retcode = kscheme_prepare(scheme, context, error);
 	kcontext_free(context);
@@ -428,7 +428,7 @@ static bool_t clear_scheme(kscheme_t *scheme, faux_error_t *error)
 	if (!scheme)
 		return BOOL_TRUE; // It's not an error
 
-	context = kcontext_new(KCONTEXT_PLUGIN_FINI);
+	context = kcontext_new(KCONTEXT_TYPE_PLUGIN_FINI);
 	kcontext_set_scheme(context, scheme);
 	kscheme_fini(scheme, context, error);
 	kcontext_free(context);

+ 5 - 5
klish/kcontext_base.h

@@ -11,15 +11,15 @@
 typedef struct kcontext_s kcontext_t;
 
 typedef enum {
-	KCONTEXT_NONE,
+	KCONTEXT_TYPE_NONE,
 	// Context for plugin initialization
-	KCONTEXT_PLUGIN_INIT,
+	KCONTEXT_TYPE_PLUGIN_INIT,
 	// Context for plugin finalization
-	KCONTEXT_PLUGIN_FINI,
+	KCONTEXT_TYPE_PLUGIN_FINI,
 	// Context for command's action
-	KCONTEXT_ACTION,
+	KCONTEXT_TYPE_ACTION,
 	// Context for service actions like PTYPE, COND, etc.
-	KCONTEXT_SERVICE_ACTION,
+	KCONTEXT_TYPE_SERVICE_ACTION,
 } kcontext_type_e;
 
 

+ 2 - 2
klish/kscheme/kplugin.c

@@ -211,7 +211,7 @@ int kplugin_init(kplugin_t *plugin, kcontext_t *context)
 	if (!plugin->init_fn)
 		return -1;
 	// Be sure the context type is appropriate one
-	kcontext_set_type(context, KCONTEXT_PLUGIN_INIT);
+	kcontext_set_type(context, KCONTEXT_TYPE_PLUGIN_INIT);
 
 	return plugin->init_fn(context);
 }
@@ -229,7 +229,7 @@ int kplugin_fini(kplugin_t *plugin, kcontext_t *context)
 	if (!plugin->fini_fn)
 		return 0; // Fini function is not mandatory so it's ok
 	// Be sure the context type is appropriate one
-	kcontext_set_type(context, KCONTEXT_PLUGIN_FINI);
+	kcontext_set_type(context, KCONTEXT_TYPE_PLUGIN_FINI);
 
 	return plugin->fini_fn(context);
 }

+ 2 - 2
klish/kscheme/kscheme.c

@@ -111,7 +111,7 @@ bool_t kscheme_load_plugins(kscheme_t *scheme, kcontext_t *context,
 			retcode = BOOL_FALSE;
 			continue; // Try to load all plugins
 		}
-		kcontext_set_type(context, KCONTEXT_PLUGIN_INIT);
+		kcontext_set_type(context, KCONTEXT_TYPE_PLUGIN_INIT);
 		kcontext_set_plugin(context, plugin);
 		if ((init_retcode = kplugin_init(plugin, context)) < 0) {
 			faux_error_sprintf(error,
@@ -142,7 +142,7 @@ bool_t kscheme_fini_plugins(kscheme_t *scheme, kcontext_t *context,
 	iter = kscheme_plugins_iter(scheme);
 	while ((plugin = kscheme_plugins_each(&iter))) {
 		int fini_retcode = -1;
-		kcontext_set_type(context, KCONTEXT_PLUGIN_FINI);
+		kcontext_set_type(context, KCONTEXT_TYPE_PLUGIN_FINI);
 		kcontext_set_plugin(context, plugin);
 		if ((fini_retcode = kplugin_fini(plugin, context)) < 0) {
 			faux_error_sprintf(error,

+ 2 - 2
klish/ksession/ksession_parse.c

@@ -531,7 +531,7 @@ kexec_t *ksession_parse_for_exec(ksession_t *session, const char *raw_line,
 		}
 
 		// Fill the kexec_t
-		context = kcontext_new(KCONTEXT_ACTION);
+		context = kcontext_new(KCONTEXT_TYPE_ACTION);
 		assert(context);
 		kcontext_set_scheme(context, ksession_scheme(session));
 		kcontext_set_pargv(context, pargv);
@@ -587,7 +587,7 @@ kexec_t *ksession_parse_for_local_exec(ksession_t *session,
 		return NULL;
 	}
 
-	context = kcontext_new(KCONTEXT_SERVICE_ACTION);
+	context = kcontext_new(KCONTEXT_TYPE_SERVICE_ACTION);
 	assert(context);
 	kcontext_set_scheme(context, ksession_scheme(session));
 	kcontext_set_pargv(context, pargv);

+ 1 - 1
plugins/klish/nav.c

@@ -44,7 +44,7 @@ int klish_nav(kcontext_t *context)
 
 	// Navigation is suitable only for command actions but not for
 	// PTYPEs, CONDitions i.e. SERVICE_ACTIONS.
-	assert(kcontext_type(context) == KCONTEXT_ACTION);
+	assert(kcontext_type(context) == KCONTEXT_TYPE_ACTION);
 
 	script = kcontext_script(context);
 	if (faux_str_is_empty(script)) // No navigation commands. It's not an error.

+ 3 - 0
plugins/shell/shell.c

@@ -79,6 +79,9 @@ int shell_shell(kcontext_t *context)
 	}
 
 	// Parent
+	// Populate environment. Put command parameters to env vars.
+
+
 	// Prepare command
 	command = faux_str_sprintf("/bin/sh %s", fifo_name);