summaryrefslogtreecommitdiff
path: root/etc/saconfig.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2005-05-20 12:00:00 +0000
committerrepogen <>2005-05-20 12:00:00 +0000
commitbf6b5550cdfbc0c4a3a4577776ad76628d80718e (patch)
treed714ef8ac5581536c0f8bb2c8e90e2b8207799b1 /etc/saconfig.c
parente6ddfd3b09c0a3727afc773029c323a3defe50fa (diff)
downloadlua-github-5.1-work6.tar.gz
Lua 5.1-work65.1-work6
Diffstat (limited to 'etc/saconfig.c')
-rw-r--r--etc/saconfig.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/etc/saconfig.c b/etc/saconfig.c
deleted file mode 100644
index 676b38e1..00000000
--- a/etc/saconfig.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* saconfig.c -- configuration for stand-alone Lua interpreter
-*
-* #define LUA_USERCONFIG to this file
-*
-* Here are the features that can be customized using #define:
-*
-*** Line editing and history:
-* #define USE_READLINE to use the GNU readline library.
-* Add "-lreadline -ltermcap" to MYLIBS.
-*
-* To use another library for this, use the code below as a start.
-* Make sure you #define lua_readline and lua_saveline accordingly.
-*
-* If you do not #define lua_readline, you'll get a version based on fgets
-* that uses a static buffer of size MAXINPUT.
-*/
-
-#define USE_READLINE
-
-#ifdef USE_READLINE
-/*
-* This section implements of lua_readline and lua_saveline for lua.c using
-* the GNU readline and history libraries. It should also work with drop-in
-* replacements such as editline and libedit (you may have to include
-* different headers, though).
-*
-*/
-
-#define lua_readline myreadline
-#define lua_saveline mysaveline
-
-#include <ctype.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-
-static int myreadline (lua_State *L, const char *prompt) {
- char *s=readline(prompt);
- if (s==NULL)
- return 0;
- else {
- lua_pushstring(L,s);
- lua_pushliteral(L,"\n");
- lua_concat(L,2);
- free(s);
- return 1;
- }
-}
-
-static void mysaveline (lua_State *L, const char *s) {
- const char *p;
- for (p=s; isspace(*p); p++)
- ;
- if (*p!=0) {
- size_t n=strlen(s)-1;
- if (s[n]!='\n')
- add_history(s);
- else {
- lua_pushlstring(L,s,n);
- s=lua_tostring(L,-1);
- add_history(s);
- lua_remove(L,-1);
- }
- }
-}
-#endif