Browse Source

kcontext: Context now contains kpargv_t instead kcommand_t

Serj Kalichev 3 years ago
parent
commit
b0ecba1f9e
2 changed files with 10 additions and 8 deletions
  1. 3 2
      klish/kcontext.h
  2. 7 6
      klish/ksession/kcontext.c

+ 3 - 2
klish/kcontext.h

@@ -7,6 +7,7 @@
 #define _klish_kcontext_h
 
 #include <klish/kcontext_base.h>
+#include <klish/kpargv.h>
 #include <klish/kscheme.h>
 
 
@@ -28,8 +29,8 @@ FAUX_HIDDEN bool_t kcontext_set_sym(kcontext_t *context, ksym_t *sym);
 kaction_t *kcontext_action(const kcontext_t *context);
 FAUX_HIDDEN bool_t kcontext_set_action(kcontext_t *context, kaction_t *action);
 // Command
-kcommand_t *kcontext_command(const kcontext_t *context);
-FAUX_HIDDEN bool_t kcontext_set_command(kcontext_t *context, kcommand_t *command);
+kpargv_t *kcontext_pargv(const kcontext_t *context);
+FAUX_HIDDEN bool_t kcontext_set_pargv(kcontext_t *context, kpargv_t *pargv);
 // STDIN
 int kcontext_stdin(const kcontext_t *context);
 FAUX_HIDDEN bool_t kcontext_set_stdin(kcontext_t *context, int stdin);

+ 7 - 6
klish/ksession/kcontext.c

@@ -9,6 +9,7 @@
 #include <faux/conv.h>
 #include <faux/list.h>
 #include <klish/khelper.h>
+#include <klish/kpargv.h>
 #include <klish/kcontext.h>
 #include <klish/kscheme.h>
 
@@ -17,8 +18,8 @@ struct kcontext_s {
 	kcontext_type_e type;
 	int retcode;
 	kplugin_t *plugin;
-	kcommand_t *command;
-	kaction_t *action;
+	kpargv_t *pargv;
+	kaction_t *action; // Current action
 	ksym_t *sym;
 	int stdin;
 	int stdout;
@@ -49,9 +50,9 @@ FAUX_HIDDEN KSET(context, ksym_t *, sym);
 KGET(context, kaction_t *, action);
 FAUX_HIDDEN KSET(context, kaction_t *, action);
 
-// Command
-KGET(context, kcommand_t *, command);
-FAUX_HIDDEN KSET(context, kcommand_t *, command);
+// Pargv
+KGET(context, kpargv_t *, pargv);
+FAUX_HIDDEN KSET(context, kpargv_t *, pargv);
 
 // STDIN
 KGET(context, int, stdin);
@@ -82,7 +83,7 @@ kcontext_t *kcontext_new(kcontext_type_e type)
 	// Initialize
 	context->type = type;
 	context->plugin = NULL;
-	context->command = NULL;
+	context->pargv = NULL;
 	context->action = NULL;
 	context->sym = NULL;