Fixed build on OSX and some compiler warnings

`readline` on OSX is provided by `libedit`, which does not provide `rl_completion_display_matches_hook` - a clumsy, but functional, workaround is to `#ifndef __APPLE__ [...] #endif` that assignment. The program still works, from what I can tell.

In addition, assigning string constants to non-`const` `char*` variables is deprecated; `strdup()`ing and `free()`ing the string is a more appropriate way to do it.