More flexible file/path completion.

  We now complete against $PWD.

  Closes #177.
  Added two new lua primitives: cd + cwd.
  Updated to pretend to honour the return value of chdir.
  Fix compilation on Mac OS X / DragonFly BSD.

  This closes #179.
  Include stdio.h + stdlib.h for getenv.

  This should ease future porting on *BSD, and updates #181.
  Moved stat-buffer to avoid mixing code & definitions.

  This fixes a warning when compiling with `-pedantic`.
  Compilation fixup from clang.

  This is a trival coercion of return-types.
  Warning/issue update from clang.

  I've updated some functions to avoid unused-variable warnings,
 and to drop qualifiers on function return-values.

  Ideally no functional changes, and things continue to compile
 under gcc with `-Wall -Werror -Wextra -pedantic` - barring warnings
 coming from (n)curses.
  Avoid overloading variables.