use the copyright statement provided by the Lua distribution in lua.h

This commit is contained in:
nhmall
2019-11-30 18:43:57 -05:00
parent 719ca3003e
commit 2a2021d5e4
5 changed files with 14 additions and 3 deletions

View File

@@ -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 */
};

View File

@@ -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 */
};

View File

@@ -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
*/

View File

@@ -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;
}

View File

@@ -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 */
}