From: nhmall Date: Sat, 30 Nov 2019 23:43:57 +0000 (-0500) Subject: use the copyright statement provided by the Lua distribution in lua.h X-Git-Tag: NetHack-3.7.0_WIP~191 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a2021d5e49d73329bbe59f9eccdb77b35ddbf8f;p=nethack use the copyright statement provided by the Lua distribution in lua.h --- diff --git a/include/decl.h b/include/decl.h index 0ce8f2cd0..ce0ecabe8 100644 --- a/include/decl.h +++ b/include/decl.h @@ -701,6 +701,7 @@ struct role_filter { #define CVT_BUF_SIZE 64 #define LUA_VER_BUFSIZ 20 +#define LUA_COPYRIGHT_BUFSIZ 120 struct instance_globals { @@ -1257,6 +1258,7 @@ struct instance_globals { /* new stuff */ char lua_ver[LUA_VER_BUFSIZ]; + char lua_copyright[LUA_COPYRIGHT_BUFSIZ]; unsigned long magic; /* validate that structure layout is preserved */ }; diff --git a/src/decl.c b/src/decl.c index 28c3e1c75..a0c3a9d4a 100644 --- a/src/decl.c +++ b/src/decl.c @@ -693,6 +693,7 @@ const struct instance_globals g_init = { /* new */ DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ + DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */ IVMAGIC /* used to validate that structure layout has been preserved */ }; diff --git a/src/mdlib.c b/src/mdlib.c index e252037f1..c73fc11b9 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -637,7 +637,7 @@ build_options() { static const char *lua_info[] = { "", "NetHack 3.7.* uses the 'Lua' interpreter to process some data:", "", - " About Lua:LUAVERSION:: Copyright (c) 1994-2017 Lua.org, PUC-Rio.", "", + " :LUACOPYRIGHT:", "", /* 1 2 3 4 5 6 7 1234567890123456789012345678901234567890123456789012345678901234567890123456 */ diff --git a/src/nhlua.c b/src/nhlua.c index c66cd8039..867a06590 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -923,6 +923,10 @@ get_lua_version() Strcpy(g.lua_ver, vs); } lua_close(L); +#ifdef LUA_COPYRIGHT + if (sizeof LUA_COPYRIGHT < sizeof g.lua_copyright - 1) + Strcpy(g.lua_copyright, LUA_COPYRIGHT); +#endif } return (const char *) g.lua_ver; } diff --git a/src/version.c b/src/version.c index 9a4691983..4843e3f5d 100644 --- a/src/version.c +++ b/src/version.c @@ -304,6 +304,9 @@ static struct rt_opt { } rt_opts[] = { { ":PATMATCH:", regex_id }, { ":LUAVERSION:", (const char *) g.lua_ver + 3 }, /* +3 skip past "Lua" */ +#ifdef LUA_COPYRIGHT + { ":LUACOPYRIGHT:", (const char *) g.lua_copyright }, +#endif }; /* @@ -320,10 +323,11 @@ char *buf; if (!g.lua_ver[0]) get_lua_version(); - + for (i = 0; i < SIZE(rt_opts); ++i) { - if (strstri(buf, rt_opts[i].token) && *rt_opts[i].value) + if (strstri(buf, rt_opts[i].token) && *rt_opts[i].value) { (void) strsubst(buf, rt_opts[i].token, rt_opts[i].value); + } /* we don't break out of the loop after a match; there might be other matches on the same line */ }