From nashjc at uottawa.ca  Sun May 30 23:33:35 2010
From: nashjc at uottawa.ca (Prof. John C Nash)
Date: Sun, 30 May 2010 17:33:35 -0400
Subject: [Rd] Location of source code for readline()
Message-ID: <4C02D9AF.1060207@uottawa.ca>

A few days ago on R-help I asked about a cross-platform timeout version of readline().
Some suggestions, but only partial joy so far. I can get the Gnu bash  'read -t ...' to
work in Windows by using the 'bash -c ' construct, but then R's system() function does not
seem to allow this to pass through. Similarly a Perl and Free Pascal routine that I tried,
the latter being a single executable that did the prompt and the timeout. (I can send code
offline if anyone interested -- not fully protected against bad inputs, however.)

Now I'm wondering where the code for readline is located in the R source. I've tracked as
far as the 'do_readln' in names.c, but now want to find the actual code to see if I can
patch it, though I am a real novice in C. Suggestions welcome.

My application, FYI, is to have a script that will display something, and wait for a
keypress (for readline it seems to need the Enter key) but timeout after a preset number
of seconds. The setTimeLimit "almost" works -- but not for readline. I'm thinking of a
modified readline like readline(prompt='Do you want to continue?', timeout=6).

Note that the issue seems to be Windows. I haven't a Mac to try, but Linux can be made to
function by various methods at the top.  Sigh.

JN



[Rd] Location of source code for readline()
Prof. John C Nash