summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Angelacos <nangel@alpinelinux.org>2008-03-16 22:30:16 +0000
committerNathan Angelacos <nangel@alpinelinux.org>2008-03-16 22:30:16 +0000
commit984ea9219aeffc9bd4147df526c146315ceca0c0 (patch)
tree2fc2829c4743a05d92299c5b35553ab97c21d76b
parent30723d26491b5bff3b19171e9d53342d830d86b8 (diff)
downloadhaserl-984ea9219aeffc9bd4147df526c146315ceca0c0.tar.bz2
haserl-984ea9219aeffc9bd4147df526c146315ceca0c0.tar.xz
R3
-rw-r--r--ChangeLog2
-rw-r--r--configure.ac2
-rw-r--r--src/h_lua_common.c23
-rw-r--r--src/haserl.c8
4 files changed, 21 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d3f3955..5be293a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2008-03-12
0.9.23
+ * haserl.c - remove use of index function.
+
* haserl.c - myputenv makes a newline delimited "array" out
of variables that end in []. (php-style for multi-selects)
Lua variables will have same behavior - they are not treated
diff --git a/configure.ac b/configure.ac
index 309be03..2cc54da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([haserl],[0.9.23_rc2],[Nathan Angelacos <nangel@users.sourceforge.net>],[haserl])
+AC_INIT([haserl],[0.9.23_rc3],[Nathan Angelacos <nangel@users.sourceforge.net>],[haserl])
AM_INIT_AUTOMAKE([haserl],[$PACKAGE_VERSION])
# Checks for programs.
diff --git a/src/h_lua_common.c b/src/h_lua_common.c
index 6526c3c..e29c97b 100644
--- a/src/h_lua_common.c
+++ b/src/h_lua_common.c
@@ -48,7 +48,7 @@ void
lua_common_putenv (char *str)
{
char *value;
- value = index (str, '=');
+ value = memchr (str, '=', strlen (str));
if (value)
{
*value = (char) '\0';
@@ -77,11 +77,13 @@ lua_common_setup (char *shell, list_t * env)
luaL_openlibs (lua_vm);
/* and load our haserl library */
- if (luaL_loadbuffer (lua_vm, (const char *) &haserl_lualib, sizeof(haserl_lualib), "luascript.lua") ||
- lua_pcall (lua_vm, 0, 0, 0))
+ if (luaL_loadbuffer
+ (lua_vm, (const char *) &haserl_lualib, sizeof (haserl_lualib),
+ "luascript.lua") || lua_pcall (lua_vm, 0, 0, 0))
{
die_with_message (NULL, NULL,
- "Error passing the lua library to the lua vm: %s", lua_tostring (lua_vm, -1));
+ "Error passing the lua library to the lua vm: %s",
+ lua_tostring (lua_vm, -1));
}
/* and put the vars in the vm */
@@ -95,13 +97,14 @@ lua_common_setup (char *shell, list_t * env)
/* register our open function in the haserl table */
lua_getglobal (lua_vm, "haserl");
lua_pushstring (lua_vm, "loadfile");
- #if defined(INCLUDE_LUASHELL) && defined(INCLUDE_LUACSHELL)
- lua_pushcfunction(lua_vm, shell[3] == 'c' ? h_luac_loadfile : h_lua_loadfile);
- #elif defined(INCLUDE_LUASHELL)
+#if defined(INCLUDE_LUASHELL) && defined(INCLUDE_LUACSHELL)
+ lua_pushcfunction (lua_vm,
+ shell[3] == 'c' ? h_luac_loadfile : h_lua_loadfile);
+#elif defined(INCLUDE_LUASHELL)
lua_pushcfunction (lua_vm, h_lua_loadfile);
- #else /* INCLUDE_LUACSHELL */
- lua_pushcfunction(lua_vm, h_luac_loadfile);
- #endif
+#else /* INCLUDE_LUACSHELL */
+ lua_pushcfunction (lua_vm, h_luac_loadfile);
+#endif
lua_settable (lua_vm, -3);
}
diff --git a/src/haserl.c b/src/haserl.c
index fbfca7e..fbdf9e7 100644
--- a/src/haserl.c
+++ b/src/haserl.c
@@ -237,15 +237,17 @@ myputenv (list_t * cur, char *str, char *prefix)
}
/* does the value already exist? */
- len = keylen + strlen(prefix) + 1;
+ len = keylen + strlen (prefix) + 2;
while (cur != NULL)
{
if (memcmp (cur->buf, entry, len) == 0)
{
if (array == 1)
{
- /* if an array, add this value to the old array */
- temp = xmalloc (strlen (cur->buf) + len );
+ /* if an array, create a new string with this
+ * value added to the end of the old value(s)
+ */
+ temp = xmalloc (strlen (cur->buf) + len);
memmove (temp, cur->buf, strlen (cur->buf));
strcat (temp, "\n");
strcat (temp, str + keylen + 3);