• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/lukemftp-14/tnftp/libedit/

Lines Matching refs:el

47 #include "el.h"
60 read_init(EditLine *el)
63 el->el_read.read_char = read_char;
73 el_read_setfn(EditLine *el, el_rfunc_t rc)
75 el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
85 el_read_getfn(EditLine *el)
87 return (el->el_read.read_char == read_char) ?
88 EL_BUILTIN_GETCFN : el->el_read.read_char;
98 read_debug(EditLine *el)
101 if (el->el_line.cursor > el->el_line.lastchar)
102 (void) fprintf(el->el_errfile, "cursor > lastchar\r\n");
103 if (el->el_line.cursor < el->el_line.buffer)
104 (void) fprintf(el->el_errfile, "cursor < buffer\r\n");
105 if (el->el_line.cursor > el->el_line.limit)
106 (void) fprintf(el->el_errfile, "cursor > limit\r\n");
107 if (el->el_line.lastchar > el->el_line.limit)
108 (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
109 if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
110 (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
181 read_preread(EditLine *el)
185 if (el->el_tty.t_mode == ED_IO)
189 (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
193 chrs = read(el->el_infd, buf,
197 el_push(el, buf);
210 el_push(EditLine *el, char *str)
212 c_macro_t *ma = &el->el_chared.c_macro;
220 term_beep(el);
229 read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
235 if ((num = el_getc(el, ch)) != 1) /* if EOF or error */
240 el->el_state.metanext = 0;
246 if (el->el_state.metanext) {
247 el->el_state.metanext = 0;
250 cmd = el->el_map.current[(unsigned char) *ch];
253 switch (key_get(el, ch, &val)) {
258 el_push(el, val.str);
267 EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
271 if (el->el_map.alt == NULL)
272 el->el_map.current = el->el_map.key;
283 read_char(EditLine *el, char *cp)
288 while ((num_read = read(el->el_infd, cp, 1)) == -1)
289 if (!tried && read__fixio(el->el_infd, errno) == 0)
304 el_getc(EditLine *el, char *cp)
307 c_macro_t *ma = &el->el_chared.c_macro;
312 if (!read_preread(el))
333 (void) fprintf(el->el_errfile, "Turning raw mode on\n");
335 if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */
339 (void) fprintf(el->el_errfile, "Reading a character\n");
341 num_read = (*el->el_read.read_char)(el, cp);
343 (void) fprintf(el->el_errfile, "Got it %c\n", *cp);
349 read_prepare(EditLine *el)
351 if (el->el_flags & HANDLE_SIGNALS)
352 sig_set(el);
353 if (el->el_flags & NO_TTY)
355 if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
356 tty_rawmode(el);
360 el_resize(el);
361 re_clear_display(el); /* reset the display stuff */
362 ch_reset(el);
363 re_refresh(el); /* print the prompt */
365 if (el->el_flags & UNBUFFERED)
370 read_finish(EditLine *el)
372 if ((el->el_flags & UNBUFFERED) == 0)
373 (void) tty_cookedmode(el);
374 if (el->el_flags & HANDLE_SIGNALS)
375 sig_clr(el);
379 el_gets(EditLine *el, int *nread)
387 c_macro_t *ma = &el->el_chared.c_macro;
390 if (el->el_flags & NO_TTY) {
391 char *cp = el->el_line.buffer;
394 while ((*el->el_read.read_char)(el, cp) == 1) {
396 if (cp + 1 >= el->el_line.limit) {
397 idx = (cp - el->el_line.buffer);
398 if (!ch_enlargebufs(el, 2))
400 cp = &el->el_line.buffer[idx];
403 if (el->el_flags & UNBUFFERED)
409 el->el_line.cursor = el->el_line.lastchar = cp;
412 *nread = el->el_line.cursor - el->el_line.buffer;
413 return (el->el_line.buffer);
418 if (el->el_tty.t_mode == EX_IO && ma->level < 0) {
421 (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
423 if (tty_rawmode(el) < 0) {
432 if ((el->el_flags & UNBUFFERED) == 0)
433 read_prepare(el);
435 if (el->el_flags & EDIT_DISABLED) {
438 if ((el->el_flags & UNBUFFERED) == 0)
439 cp = el->el_line.buffer;
441 cp = el->el_line.lastchar;
445 while ((*el->el_read.read_char)(el, cp) == 1) {
447 if (cp + 1 >= el->el_line.limit) {
448 idx = (cp - el->el_line.buffer);
449 if (!ch_enlargebufs(el, 2))
451 cp = &el->el_line.buffer[idx];
457 if (el->el_flags & UNBUFFERED)
463 el->el_line.cursor = el->el_line.lastchar = cp;
466 *nread = el->el_line.cursor - el->el_line.buffer;
467 return (el->el_line.buffer);
473 read_debug(el);
476 if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
478 (void) fprintf(el->el_errfile,
483 if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
485 (void) fprintf(el->el_errfile,
494 for (b = el->el_map.help; b->name; b++)
498 (void) fprintf(el->el_errfile,
501 (void) fprintf(el->el_errfile,
506 el->el_state.thiscmd = cmdnum;
507 el->el_state.thisch = ch;
508 if (el->el_map.type == MAP_VI &&
509 el->el_map.current == el->el_map.key &&
510 el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
512 el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
513 && isprint((unsigned char)el->el_chared.c_redo.pos[-1]))
514 el->el_chared.c_redo.pos--;
516 *el->el_chared.c_redo.pos++ = ch;
518 retval = (*el->el_map.func[cmdnum]) (el, ch);
520 (void) fprintf(el->el_errfile,
525 el->el_state.lastcmd = cmdnum;
530 re_refresh_cursor(el);
534 re_clear_lines(el);
535 re_clear_display(el);
539 re_refresh(el);
543 re_refresh(el);
544 term_beep(el);
555 if ((el->el_flags & UNBUFFERED) == 0)
558 *el->el_line.lastchar++ = CONTROL('d');
559 el->el_line.cursor = el->el_line.lastchar;
565 num = el->el_line.lastchar - el->el_line.buffer;
570 (void) fprintf(el->el_errfile,
574 re_clear_display(el); /* reset the display stuff */
575 ch_reset(el); /* reset the input pointers */
576 re_refresh(el); /* print the prompt again */
582 (void) fprintf(el->el_errfile,
585 term_beep(el);
589 el->el_state.argument = 1;
590 el->el_state.doingarg = 0;
591 el->el_chared.c_vcmd.action = NOP;
592 if (el->el_flags & UNBUFFERED)
598 if ((el->el_flags & UNBUFFERED) == 0) {
599 read_finish(el);
604 *nread = el->el_line.lastchar - el->el_line.buffer;
606 return (num ? el->el_line.buffer : NULL);