tterm: remove the timeout argument of term_read() - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit da7dfd18e4e2895bd076ea86001f72709ac93210
(DIR) parent 5baa996edd56e5540772d0b8829946dd91944ac3
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Wed, 17 Jun 2015 20:05:56 +0430
tterm: remove the timeout argument of term_read()
Diffstat:
M led.c | 12 ++++++------
M term.c | 4 ++--
M vi.c | 2 +-
M vi.h | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/led.c b/led.c
t@@ -185,15 +185,15 @@ static char *led_readchar(int c, char *kmap)
int c1, c2;
int i;
if (c == TK_CTL('v')) { /* literal character */
- buf[0] = term_read(-1);
+ buf[0] = term_read();
buf[1] = '\0';
return buf;
}
if (c == TK_CTL('k')) { /* digraph */
- c1 = term_read(-1);
+ c1 = term_read();
if (TK_INT(c1))
return NULL;
- c2 = term_read(-1);
+ c2 = term_read();
if (TK_INT(c2))
return NULL;
for (i = 0; i < LEN(digraphs); i++)
t@@ -206,7 +206,7 @@ static char *led_readchar(int c, char *kmap)
char *led_read(char **kmap)
{
- int c = term_read(-1);
+ int c = term_read();
while (!TK_INT(c)) {
switch (c) {
case TK_CTL('f'):
t@@ -218,7 +218,7 @@ char *led_read(char **kmap)
default:
return led_readchar(c, *kmap);
}
- c = term_read(-1);
+ c = term_read();
}
return NULL;
}
t@@ -236,7 +236,7 @@ static char *led_line(char *pref, char *post, char *ai, int ai_max, int *key, ch
post = "";
while (1) {
led_printparts(ai, pref, uc_lastline(sbuf_buf(sb)), post, *kmap);
- c = term_read(-1);
+ c = term_read();
switch (c) {
case TK_CTL('f'):
*kmap = conf_kmapalt();
(DIR) diff --git a/term.c b/term.c
t@@ -142,14 +142,14 @@ char *term_cmd(int *n)
return icmd;
}
-int term_read(int ms)
+int term_read(void)
{
struct pollfd ufds[1];
char n, c;
if (ibuf_pos >= ibuf_cnt) {
ufds[0].fd = 0;
ufds[0].events = POLLIN;
- if (poll(ufds, 1, ms * 1000) <= 0)
+ if (poll(ufds, 1, -1) <= 0)
return -1;
/* read a single input character */
if ((n = read(0, ibuf, 1)) <= 0)
(DIR) diff --git a/vi.c b/vi.c
t@@ -67,7 +67,7 @@ static int vi_buflen;
static int vi_read(void)
{
- return vi_buflen ? vi_buf[--vi_buflen] : term_read(1000);
+ return vi_buflen ? vi_buf[--vi_buflen] : term_read();
}
static void vi_back(int c)
(DIR) diff --git a/vi.h b/vi.h
t@@ -114,7 +114,7 @@ void term_kill(void);
void term_room(int n);
int term_rows(void);
int term_cols(void);
-int term_read(int timeout);
+int term_read(void);
void term_record(void);
void term_commit(void);
char *term_att(int att, int old);