aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.h
diff options
context:
space:
mode:
authorGravatar Joseph Tannhuber <sepp.tannhuber@yahoo.de>2014-08-19 14:28:08 +0200
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-03 22:48:37 -0700
commit4acea72700a7738f1a3258cab226f6153a65ea94 (patch)
treed7604b0291aade38efd1fc810351014436645687 /reader.h
parent677cee44ad192ddcd9a397e82092a3dd27386521 (diff)
New -n option for read builtin
Usage: read -n nchars Reads maximum of nchars characters. If nchars <= 0, there's no limit.
Diffstat (limited to 'reader.h')
-rw-r--r--reader.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/reader.h b/reader.h
index f89bd50e..3c82f5d1 100644
--- a/reader.h
+++ b/reader.h
@@ -200,11 +200,13 @@ int reader_reading_interrupted();
bool reader_thread_job_is_stale();
/**
- Read one line of input. Before calling this function, reader_push()
- must have been called in order to set up a valid reader
- environment.
+ Read one line of input. Before calling this function, reader_push() must have
+ been called in order to set up a valid reader environment. If nchars > 0,
+ return after reading that many characters even if a full line has not yet
+ been read. Note: the returned value may be longer than nchars if a single
+ keypress resulted in multiple characters being inserted into the commandline.
*/
-const wchar_t *reader_readline();
+const wchar_t *reader_readline(int nchars);
/**
Push a new reader environment.