clp

command line syntax highlighter
git clone git://jeskin.net/clp.git
README | Log | Files | Refs | LICENSE

commit 02caec809f4994bed88b1bd81b940fb933e9b58b
parent f447fc7cee3e24151d38da3e92c2aa78fe193720
Author: Jon Eskin <eskinjp@gmail.com>
Date:   Fri, 22 Jul 2022 11:43:09 -0400

Merge branch 'src-lua-path'
Add {srcdir}/lua to lua path to allow clp to run without being installed

Diffstat:
MMakefile | 3++-
Mclp.c | 7+++++++
Mconfigure | 1+
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -4,7 +4,8 @@ CFLAGS += -Wall -pedantic CFLAGS += -I $(CURDIR)/include CFLAGS += $(CFLAGS_LUA) CFLAGS += $(CFLAGS_AUTO) -CFLAGS += -DCLP_PATH=\"${SHAREPREFIX}/clp\" +CFLAGS += -DCLP_PATH=\"${SHAREPREFIX}/clp\" +CFLAGS += -DSRC_LUA_PATH=\"${ABS_SRCDIR}/lua\" LDFLAGS = $(LDFLAGS_LUA) LDFLAGS += $(LDFLAGS_AUTO) SRC = clp.c diff --git a/clp.c b/clp.c @@ -22,6 +22,10 @@ #define CLP_PATH "/usr/local/share/clp" #endif +#ifndef SRC_LUA_PATH +#define SRC_LUA_PATH "" +#endif + void bail(lua_State *L, char *msg) { fprintf(stderr, "\nFATAL ERROR:\n %s: %s\n\n", msg, lua_tostring(L, -1)); @@ -99,6 +103,9 @@ int main(int argc, char *argv[]) { char path[PATH_MAX]; lua_path_add(L, CLP_PATH); + if(strcmp(SRC_LUA_PATH, "") != 0) { + lua_path_add(L, SRC_LUA_PATH); + } const char *home = getenv("HOME"); if (!home || !*home) { diff --git a/configure b/configure @@ -223,6 +223,7 @@ cat << EOF # This version of config.mk was generated by: # $cmdline # Any changes made here will be lost if configure is re-run +ABS_SRCDIR = $abs_srcdir SRCDIR = $SRCDIR PREFIX = $PREFIX EXEC_PREFIX = $EXEC_PREFIX