red/red — pull request #612 by hostilefork (2013-12-15 10:50:06+00:00)
Title: Minimal INPUT implementation for POSIX/Win32 compiler runtime

I tackled a little demo using only Red as the implementation and debugging toolchain *( Now phrased as a [Code Golf question](http://codegolf.stackexchange.com/questions/15932/dungeon-construction-set), under construction at [dungeon.red](https://github.com/hostilefork/teenage-coding/blob/master/DUNGEON/dungeon.red) )*

The only *blocking* aspect that the interpreted version used which wasn't available in the compiled runtime was INPUT. Kaj showed me his [C Library Binding](http://red.esperconsultancy.nl/Red-C-library/dir?ci=tip). However, I'm trying to keep this simple and just use the mainline Red download for my demo.

In the current Red interpreter, INPUT takes a prompt (as opposed to being called ASK for that feature). Given @DocKimbel's general desire to not change things without a reason, he may have other ideas in mind for ASK. There may be lots of ideas to hammer over in the C-binding. Not looking to get into that kind of debate, just want it to be possible to have both input and output for simple interactive demos. Here's a pretty minimal change to get it.

*(Note: To avoid the fixed buffer issues, it's possible to use [getline()](http://man7.org/linux/man-pages/man3/getline.3.html). But I don't know how to get Red/System to find the `stdin` stream exported variable. That stream could also be acquired with [fdopen()](http://pubs.opengroup.org/onlinepubs/7908799/xsh/fdopen.html), assuming you can trust that STDIN_FILENO is always 0. But we found out from emscripten that sometimes this is not the case. So for expedience I just used `gets` like Kaj did, although I treat a null result as a fatal condition.)*