version 1.125, 2016/02/17 19:47:49 |
version 1.126, 2016/02/24 17:13:22 |
Line 166 static jmp_buf topbuf; |
|
Line 166 static jmp_buf topbuf; |
|
static unsigned char _el_rl_complete(EditLine *, int); |
static unsigned char _el_rl_complete(EditLine *, int); |
static unsigned char _el_rl_tstp(EditLine *, int); |
static unsigned char _el_rl_tstp(EditLine *, int); |
static char *_get_prompt(EditLine *); |
static char *_get_prompt(EditLine *); |
static int _getc_function(EditLine *, char *); |
static int _getc_function(EditLine *, wchar_t *); |
static HIST_ENTRY *_move_history(int); |
static HIST_ENTRY *_move_history(int); |
static int _history_expand_command(const char *, size_t, size_t, |
static int _history_expand_command(const char *, size_t, size_t, |
char **); |
char **); |
static char *_rl_compat_sub(const char *, const char *, |
static char *_rl_compat_sub(const char *, const char *, |
const char *, int); |
const char *, int); |
static int _rl_event_read_char(EditLine *, char *); |
static int _rl_event_read_char(EditLine *, wchar_t *); |
static void _rl_update_pos(void); |
static void _rl_update_pos(void); |
|
|
|
|
Line 209 _move_history(int op) |
|
Line 209 _move_history(int op) |
|
*/ |
*/ |
static int |
static int |
/*ARGSUSED*/ |
/*ARGSUSED*/ |
_getc_function(EditLine *el __attribute__((__unused__)), char *c) |
_getc_function(EditLine *el __attribute__((__unused__)), wchar_t *c) |
{ |
{ |
int i; |
int i; |
|
|
i = (*rl_getc_function)(NULL); |
i = (*rl_getc_function)(NULL); |
if (i == -1) |
if (i == -1) |
return 0; |
return 0; |
*c = (char)i; |
*c = (wchar_t)i; |
return 1; |
return 1; |
} |
} |
|
|
Line 2099 rl_stuff_char(int c) |
|
Line 2099 rl_stuff_char(int c) |
|
} |
} |
|
|
static int |
static int |
_rl_event_read_char(EditLine *el, char *cp) |
_rl_event_read_char(EditLine *el, wchar_t *wc) |
{ |
{ |
|
char ch; |
int n; |
int n; |
ssize_t num_read = 0; |
ssize_t num_read = 0; |
|
|
*cp = '\0'; |
ch = '\0'; |
|
*wc = L'\0'; |
while (rl_event_hook) { |
while (rl_event_hook) { |
|
|
(*rl_event_hook)(); |
(*rl_event_hook)(); |
Line 2113 _rl_event_read_char(EditLine *el, char * |
|
Line 2115 _rl_event_read_char(EditLine *el, char * |
|
if (ioctl(el->el_infd, FIONREAD, &n) < 0) |
if (ioctl(el->el_infd, FIONREAD, &n) < 0) |
return -1; |
return -1; |
if (n) |
if (n) |
num_read = read(el->el_infd, cp, (size_t)1); |
num_read = read(el->el_infd, &ch, (size_t)1); |
else |
else |
num_read = 0; |
num_read = 0; |
#elif defined(F_SETFL) && defined(O_NDELAY) |
#elif defined(F_SETFL) && defined(O_NDELAY) |
Line 2121 _rl_event_read_char(EditLine *el, char * |
|
Line 2123 _rl_event_read_char(EditLine *el, char * |
|
return -1; |
return -1; |
if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0) |
if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0) |
return -1; |
return -1; |
num_read = read(el->el_infd, cp, 1); |
num_read = read(el->el_infd, &ch, 1); |
if (fcntl(el->el_infd, F_SETFL, n)) |
if (fcntl(el->el_infd, F_SETFL, n)) |
return -1; |
return -1; |
#else |
#else |
/* not non-blocking, but what you gonna do? */ |
/* not non-blocking, but what you gonna do? */ |
num_read = read(el->el_infd, cp, 1); |
num_read = read(el->el_infd, &ch, 1); |
return -1; |
return -1; |
#endif |
#endif |
|
|
Line 2138 _rl_event_read_char(EditLine *el, char * |
|
Line 2140 _rl_event_read_char(EditLine *el, char * |
|
} |
} |
if (!rl_event_hook) |
if (!rl_event_hook) |
el_set(el, EL_GETCFN, EL_BUILTIN_GETCFN); |
el_set(el, EL_GETCFN, EL_BUILTIN_GETCFN); |
|
*wc = (wchar_t)ch; |
return (int)num_read; |
return (int)num_read; |
} |
} |
|
|