Lua: Fix build flags and libraries

The flag LUA_USE_LINUX implicitly sets LUA_USE_READLINE, which then makes the
build require 'readline.h'. We don't use readline, and readline headers might
not be available on the machine it's built with. LUA_USE_LINUX is a group of
other flags. Include this group, but exclude LUA_USE_READLINE.

LuaRocks requires POPEN support in Lua, so this flag was added as well.

Remove -ledit from the build as it is not needed.

I also took the chance to refactor the module Makefile.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Lua: Added LuaFileSystem and LuaPath

Used in CLI for path manipulation.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add our ncurses build to includes

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add CWD handler

This is basically an import from the previous shell.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Get the prompt from Lua code with CWD

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add cd command

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Make cat command use cwd

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Handle non-decodable API output

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Pass console size to Lua

To have output formatted nicely in the console we need to know its dimensions.

This patch adds support for both inside and outside OSv. Inside we use some
ANSI escape codes, thanks to Nadav (@nyh), and outside we use ioctl with
TIOCGWINSZ and signals for size changes.

It also binds these details to be used from Lua (as cli_console_dim()).

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add method to print lists to console

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cli: Add ls command

Initial version of ls command.

Signed-off-by: Or Cohen <orc@fewbytes.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>