From f4a0473ff12eb30bd4509a40f20d16f85f2faf83 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Tue, 30 Apr 2024 09:05:06 +0200 Subject: [PATCH] Added lighttpd and renamed uname to linux for getting their versions. --- lighttpd/lighttpd.lua | 18 ++++++++++++++++++ uname/uname.lua => linux/linux.lua | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 lighttpd/lighttpd.lua rename uname/uname.lua => linux/linux.lua (90%) diff --git a/lighttpd/lighttpd.lua b/lighttpd/lighttpd.lua new file mode 100644 index 0000000..bbe81a3 --- /dev/null +++ b/lighttpd/lighttpd.lua @@ -0,0 +1,18 @@ +--- +permalink: /cgi/lighttpd/index.lua +--- + +-- Function to execute shell commands +local function shell_exec(command) + local handle = io.popen(command) + local result = handle:read("*a") + handle:close() + return result +end + +local lighttpd = shell_exec('lighttpd -v') + +io.write("Content-Type: text/plain; charset=utf-8\r\n\r\n") + +io.write(lighttpd:sub(10, 15)) + diff --git a/uname/uname.lua b/linux/linux.lua similarity index 90% rename from uname/uname.lua rename to linux/linux.lua index 05f143b..a57bcb0 100644 --- a/uname/uname.lua +++ b/linux/linux.lua @@ -1,5 +1,5 @@ --- -permalink: /cgi/uname/index.lua +permalink: /cgi/linux/index.lua --- -- Function to execute shell commands @@ -23,5 +23,5 @@ local res = string.sub(uname, 1, pos - 1) io.write("Content-Type: text/plain; charset=utf-8\r\n\r\n") -- Output the result -io.write(res) +io.write(res:sub(7, 12))