]> granicus.if.org Git - nethack/commitdiff
use the copyright statement provided by the Lua distribution in lua.h
authornhmall <nhmall@nethack.org>
Sat, 30 Nov 2019 23:43:57 +0000 (18:43 -0500)
committernhmall <nhmall@nethack.org>
Sat, 30 Nov 2019 23:43:57 +0000 (18:43 -0500)
include/decl.h
src/decl.c
src/mdlib.c
src/nhlua.c
src/version.c

index 0ce8f2cd0d321d6ba138b849a438d2cfeb10423d..ce0ecabe82cc0cd0cc872c0798b8a0171d635901 100644 (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 */
 };
index 28c3e1c753358b4bffb0aa33a0301a23924cc345..a0c3a9d4ad8082bc6333ac20467feeca64d1a0be 100644 (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 */
 };
index e252037f10ab5a9b74af82746f469884f2559400..c73fc11b9ed1a2764c746a3cd38f2f5f8a5cabb4 100644 (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
   */
index c66cd8039ce19b2d4a1348e6ecba18f31547d97a..867a0659062508b07ba57827a442f474f5b22707 100644 (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;
 }
index 9a4691983c692b47d9392137ab15f0db126d65ae..4843e3f5d8278a59e218e945ba7d31b78e41161b 100644 (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 */
     }