diff --git a/ikc3/ikc3.c b/ikc3/ikc3.c
index 8436e43..f882a81 100644
--- a/ikc3/ikc3.c
+++ b/ikc3/ikc3.c
@@ -10,6 +10,7 @@
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
+#include <string.h>
#include "../libkc3/kc3.h"
#include "config.h"
@@ -99,6 +100,10 @@ int main (int argc, char **argv)
return usage(argv[0]);
if (! kc3_init(NULL, &argc, &argv))
return 1;
+ if (argv && ! strcmp("--quit", argv[0])) {
+ kc3_clean(NULL);
+ return 0;
+ }
buf_init(&in, false, sizeof(i), i);
#if HAVE_WINEDITLINE
buf_wineditline_open_r(&in, "ikc3> ", ".ikc3_history");
diff --git a/kc3s/kc3s.c b/kc3s/kc3s.c
index 714a80c..32ad311 100644
--- a/kc3s/kc3s.c
+++ b/kc3s/kc3s.c
@@ -10,6 +10,7 @@
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
+#include <string.h>
#include "../libkc3/kc3.h"
#include "buf_readline.h"
@@ -70,6 +71,10 @@ int main (int argc, char **argv)
return usage(argv[0]);
if (! kc3_init(NULL, &argc, &argv))
return 1;
+ if (argv && ! strcmp("--quit", argv[0])) {
+ kc3_clean(NULL);
+ return 0;
+ }
buf_init(&in, false, sizeof(i), i);
buf_file_open_r(&in, stdin);
buf_init(&out, false, sizeof(o), o);
diff --git a/lib/kc3/0.1/ekc3.kc3 b/lib/kc3/0.1/ekc3.kc3
new file mode 100644
index 0000000..4d0feaa
--- /dev/null
+++ b/lib/kc3/0.1/ekc3.kc3
@@ -0,0 +1,5 @@
+defmodule EKC3 do
+
+ def render = cfn Str "ekc3_render" (Str, Tag)
+
+end
diff --git a/libkc3/env.c b/libkc3/env.c
index 9be9d9b..c1fdcf5 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -1981,8 +1981,8 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
}
if (argc) {
while (*argc) {
- if (strcmp("--load", **argv) ||
- strcmp("-l", **argv)) {
+ if (! strcmp("--load", **argv) ||
+ ! strcmp("-l", **argv)) {
if (*argc < 2) {
err_write_1("env_init: ");
err_write_1(**argv);
@@ -1991,7 +1991,7 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
env_clean(env);
return NULL;
}
- str_init_1(&path, NULL, **argv);
+ str_init_1(&path, NULL, (*argv)[1]);
if (! env_load(env, &path)) {
env_clean(env);
return NULL;
@@ -1999,6 +1999,8 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
*argc -= 2;
*argv += 2;
}
+ else
+ break;
}
}
return env;
diff --git a/test/ekc3/.ikc3_history b/test/ekc3/.ikc3_history
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/ekc3/.ikc3_history
diff --git a/test/ekc3/title.c3 b/test/ekc3/title.c3
deleted file mode 100644
index a814e7c..0000000
--- a/test/ekc3/title.c3
+++ /dev/null
@@ -1,2 +0,0 @@
-puts EC3.render(__DIR__ + "/title.html.ec3",
- %{title: "EC3 test title"})
diff --git a/test/ekc3/title.c3.diff b/test/ekc3/title.c3.diff
deleted file mode 100644
index e69de29..0000000
--- a/test/ekc3/title.c3.diff
+++ /dev/null
diff --git a/test/ekc3/title.html.ec3 b/test/ekc3/title.html.ec3
deleted file mode 100644
index 41bbd39..0000000
--- a/test/ekc3/title.html.ec3
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title><%= title %></title>
- </head>
- <body>
- <h1><%= title %></h1>
- </body>
-</html>
diff --git a/test/ekc3/title.html.ekc3 b/test/ekc3/title.html.ekc3
new file mode 100644
index 0000000..41bbd39
--- /dev/null
+++ b/test/ekc3/title.html.ekc3
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title><%= title %></title>
+ </head>
+ <body>
+ <h1><%= title %></h1>
+ </body>
+</html>
diff --git a/test/ekc3/title.kc3 b/test/ekc3/title.kc3
new file mode 100644
index 0000000..4a422c6
--- /dev/null
+++ b/test/ekc3/title.kc3
@@ -0,0 +1,2 @@
+puts EKC3.render(__DIR__ + "/title.html.ekc3",
+ %{title: "EKC3 test title"})
diff --git a/test/ekc3_test b/test/ekc3_test
index db5a09a..d38f492 100755
--- a/test/ekc3_test
+++ b/test/ekc3_test
@@ -1,5 +1,5 @@
#!/bin/sh
-cd "$(dirname $0)/ec3" || exit
+cd "$(dirname $0)/ekc3" || exit
TEST_COLOR_KO="[0;91m"
TEST_COLOR_OK="[0;92m"
@@ -8,11 +8,11 @@ TEST_COUNT=0
TEST_KO=0
TEST_OK=0
-if [ "x$IC3" = "x" ]; then
- if [ -f ../../ic3/ic3 ]; then
- IC3=../../ic3/ic3
- elif [ -f ../../ic3 ]; then
- IC3=../../ic3
+if [ "x$IKC3" = "x" ]; then
+ if [ -f ../../ikc3/ikc3 ]; then
+ IKC3=../../ikc3/ikc3
+ elif [ -f ../../ikc3 ]; then
+ IKC3=../../ikc3
fi
fi
@@ -29,10 +29,10 @@ test_ok() {
}
if [ $# = 0 ]; then
- if [ "x${EC3_TEST_TARGETS}" = "x" ]; then
- TARGETS="$(ls -1 *.c3 | sed -e 's/[.]c3$//')"
+ if [ "x${EKC3_TEST_TARGETS}" = "x" ]; then
+ TARGETS="$(ls -1 *.kc3 | sed -e 's/[.]kc3$//')"
else
- TARGETS="${EC3_TEST_TARGETS}"
+ TARGETS="${EKC3_TEST_TARGETS}"
fi
else
TARGETS="$@"
@@ -40,7 +40,7 @@ fi
for TARGET in $TARGETS; do
RESULT=test_ok
- $IC3 < ${TARGET}.c3 > ${TARGET}.out 2>&1
+ $IKC3 < ${TARGET}.kc3 > ${TARGET}.out 2>&1
echo $? > ${TARGET}.ret
if ! diff -abu ${TARGET}.out.expected ${TARGET}.out > ${TARGET}.diff
then