libs/core: Replace luci.sys.bigendian with a system independent version
[project/luci.git] / libs / core / luasrc / sys.lua
index 45e44b8..8e8aab7 100644 (file)
@@ -31,14 +31,10 @@ require("luci.bits")
 require("luci.util")
 require("luci.fs")
 
---- Test wheather the current system is operating in big endian mode.
--- @return     Boolean value indicating wheather system is big endian
+--- Test whether the current system is operating in big endian mode.
+-- @return     Boolean value indicating whether system is big endian
 function bigendian()
-       local fp = io.open("/bin/sh")
-       fp:seek("set", 5)
-       local be = (fp:read(1):byte() ~= 1)
-       fp:close()
-       return be
+       return string.byte(string.dump(function() end), 7) == 0
 end
 
 --- Execute given commandline and gather stdout.
@@ -71,7 +67,7 @@ function execl(command)
 end
 
 --- Invoke the luci-flash executable to write an image to the flash memory.
--- @param kpattern     kpattern (ToDo: clearify this)
+-- @param kpattern     Pattern of files to keep over flash process
 -- @return                     Return value of os.execute()
 function flash(image, kpattern)
        local cmd = "luci-flash "
@@ -202,9 +198,14 @@ function uptime()
        return loadavg:match("^(.-) (.-)$")
 end
 
---- Get group information
--- @return     Group (ToDo: clearify)
+--- LuCI system utilities / POSIX user group related functions.
+-- @class      module
+-- @name       luci.sys.group
 group = {}
+
+--- Returns information about a POSIX user group.
+-- @param group Group ID or name of a system user group
+-- @return     Table with information about the requested group
 group.getgroup = posix.getgroup