--- a/src/nexus.c Tue Mar 31 15:41:24 2009 +0300
+++ b/src/nexus.c Tue Mar 31 19:35:51 2009 +0300
@@ -236,33 +236,27 @@
return SUCCESS;
}
-static void on_line (char *line, void *arg)
-{
- struct nexus *nexus = arg;
-
- (void) nexus;
-
- // just dump it
- log_info("read line from console: '%s'", line);
-}
-
-static struct console_callbacks nexus_console_callbacks = {
- .on_line = &on_line,
-};
-
/**
* Open the console
*/
static err_t apply_console (struct nexus *nexus, struct error_info *err)
{
struct console_config config = {
- .prompt = " > ",
+ .prompt = "> ",
};
log_info("initializing the console");
- // just init it
- return console_init(&nexus->console, nexus->ev_base, &config, &nexus_console_callbacks, nexus, err);
+ // init the console
+ if (console_init(&nexus->console, nexus->ev_base, &config, NULL, NULL, err))
+ return ERROR_CODE(err);
+
+ // create the lua console on top of that
+ if (lua_console_create(&nexus->lua_console, nexus->console, nexus, err))
+ return ERROR_CODE(err);
+
+ // ok
+ return SUCCESS;
}
/**
@@ -335,8 +329,8 @@
log_info("Quitting...");
// destroy the console
- if (ctx->console)
- console_destroy(ctx->console);
+ if (ctx->lua_console)
+ lua_console_destroy(ctx->lua_console);
// unload the modules
modules_unload(ctx->modules);