Lines Matching +full:num +full:- +full:cols

3 /*-
68 /* readline compatibility stuff - look at readline sources/documentation */
213 if (i == -1) in _getc_function()
226 *ap = li->buffer; in _resize_fun()
242 len = strlen(p->pw_dir) + sizeof("/.history"); in _default_history_file()
246 (void)snprintf(path, len, "%s/.history", p->pw_dir); in _default_history_file()
270 return -1; in rl_set_prompt()
273 /* Remove adjacent end/start markers to avoid double-escapes. */ in rl_set_prompt()
324 if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0) in rl_initialize()
336 return -1; in rl_initialize()
351 if (rl_set_prompt("") == -1) { in rl_initialize()
354 return -1; in rl_initialize()
359 /* set default mode to "emacs"-style and read setting afterwards */ in rl_initialize()
368 * Word completion - this has to go AFTER rebinding keys in rl_initialize()
369 * to emacs-style. in rl_initialize()
385 * Set some readline compatible key-bindings. in rl_initialize()
387 el_set(e, EL_BIND, "^R", "em-inc-search-prev", NULL); in rl_initialize()
392 el_set(e, EL_BIND, "\\e[1~", "ed-move-to-beg", NULL); in rl_initialize()
393 el_set(e, EL_BIND, "\\e[4~", "ed-move-to-end", NULL); in rl_initialize()
394 el_set(e, EL_BIND, "\\e[7~", "ed-move-to-beg", NULL); in rl_initialize()
395 el_set(e, EL_BIND, "\\e[8~", "ed-move-to-end", NULL); in rl_initialize()
396 el_set(e, EL_BIND, "\\e[H", "ed-move-to-beg", NULL); in rl_initialize()
397 el_set(e, EL_BIND, "\\e[F", "ed-move-to-end", NULL); in rl_initialize()
402 el_set(e, EL_BIND, "\\e[3~", "ed-delete-next-char", NULL); in rl_initialize()
403 el_set(e, EL_BIND, "\\e[2~", "ed-quoted-insert", NULL); in rl_initialize()
406 * Ctrl-left-arrow and Ctrl-right-arrow for word moving. in rl_initialize()
408 el_set(e, EL_BIND, "\\e[1;5C", "em-next-word", NULL); in rl_initialize()
409 el_set(e, EL_BIND, "\\e[1;5D", "ed-prev-word", NULL); in rl_initialize()
410 el_set(e, EL_BIND, "\\e[5C", "em-next-word", NULL); in rl_initialize()
411 el_set(e, EL_BIND, "\\e[5D", "ed-prev-word", NULL); in rl_initialize()
412 el_set(e, EL_BIND, "\\e\\e[C", "em-next-word", NULL); in rl_initialize()
413 el_set(e, EL_BIND, "\\e\\e[D", "ed-prev-word", NULL); in rl_initialize()
459 if (rl_set_prompt(prompt) == -1) in readline()
465 if (rl_event_hook && !(e->el_flags & NO_TTY)) { in readline()
486 lastidx = count - 1; in readline()
493 history_length = ev.num; in readline()
538 len += with_len - what_len; in _rl_compat_sub()
571 int idx, sign, sub, num, begin, ret; in get_history_event() local
589 if (cmd[idx] == '-') { in get_history_event()
597 num = 0; in get_history_event()
599 num = num * 10 + cmd[idx] - '0'; in get_history_event()
603 num = history_length - num + history_base; in get_history_event()
605 if (!(he = history_get(num))) in get_history_event()
609 return he->line; in get_history_event()
627 len = (size_t)idx - (size_t)begin; in get_history_event()
645 num = ev.num; in get_history_event()
652 ret = history_search(pat, -1); in get_history_event()
654 ret = history_search_prefix(pat, -1); in get_history_event()
656 if (ret == -1) { in get_history_event()
679 (void)history(h, &ev, H_SET, num); in get_history_event()
699 if (len - 1 >= size) { in getfrom()
725 return -1; in getfrom()
731 return -1; in getfrom()
740 return -1; in getfrom()
787 return -1; in getto()
802 * the real function doing history expansion - takes as argument command
808 * returns -1 and *result points to NULL
845 return -1; in _history_expand_command()
851 qchar = (offs > 0 && command[offs - 1] == '"') in _history_expand_command()
859 return -1; in _history_expand_command()
866 return -1; in _history_expand_command()
876 else if (strchr("^*$-0123456789", *cmd)) { in _history_expand_command()
877 start = end = -1; in _history_expand_command()
881 start = -1, cmd++; in _history_expand_command()
884 else if (*cmd == '-' || isdigit((unsigned char) *cmd)) { in _history_expand_command()
887 start = start * 10 + *cmd++ - '0'; in _history_expand_command()
889 if (*cmd == '-') { in _history_expand_command()
894 end = end * 10 + *cmd++ - '0'; in _history_expand_command()
897 end = -1; in _history_expand_command()
900 end = -2; in _history_expand_command()
903 end = -1, cmd++; in _history_expand_command()
913 return -1; in _history_expand_command()
921 if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) { in _history_expand_command()
955 ev = -1; in _history_expand_command()
969 cmd--; in _history_expand_command()
983 * csh-style history expansion
1066 qchar = (j > 0 && str[j - 1] == '"' )? '"':0; in history_expand()
1073 len = i - start; in history_expand()
1077 len = j - i; in history_expand()
1085 ret = _history_expand_command (str, i, (j - i), &tmp); in history_expand()
1102 /* history_expand() returned -1 when the line */ in history_expand()
1105 ret = -1; in history_expand()
1131 max--; in history_arg_extract()
1210 len = (size_t)i - (size_t)start; in history_tokenize()
1243 history_base = history_length - max; in stifle_history()
1246 el_free(he->data); in stifle_history()
1247 el_free((void *)(unsigned long)he->line); in stifle_history()
1255 * "unlimit" size of history - set the limit to maximum allowed int value
1298 if ((fd = mkstemp(template)) == -1) { in history_truncate_file()
1316 (off_t)-1) { in history_truncate_file()
1326 count--; in history_truncate_file()
1344 cp = buf + left - 1; in history_truncate_file()
1348 while (--cp >= buf) { in history_truncate_file()
1350 if (--nlines == 0) { in history_truncate_file()
1361 count--; in history_truncate_file()
1380 if (fseeko(fp, (off_t)0, SEEK_SET) == (off_t)-1) { in history_truncate_file()
1385 if (fseeko(tp, (off_t)sizeof(buf) * count + (cp - buf), SEEK_SET) == in history_truncate_file()
1386 (off_t)-1) { in history_truncate_file()
1429 if (history(h, &ev, H_LOAD, filename) == -1) in read_history()
1432 history_length = ev.num; in read_history()
1451 return history(h, &ev, H_SAVE, filename) == -1 ? in write_history()
1469 if (history(h, &ev, H_NSAVE_FP, (size_t)n, fp) == -1) { in append_history()
1479 * returns history ``num''th event
1484 history_get(int num) in history_get() argument
1493 if (num < history_base) in history_get()
1499 curr_num = ev.num; in history_get()
1503 * (void **)-1 -- as in history_set_pos in history_get()
1505 if (history(h, &ev, H_DELDATA, num - history_base, (void **)-1) != 0) in history_get()
1511 if (history(h, &ev, H_NEXT_EVDATA, ev.num, &she.data) != 0) in history_get()
1538 if (history(h, &ev, H_ENTER, line) == -1) in add_history()
1542 if (ev.num == history_length) in add_history()
1546 history_length = ev.num; in add_history()
1556 remove_history(int num) in remove_history() argument
1567 if (history(h, &ev, H_DELDATA, num, &he->data) != 0) { in remove_history()
1572 he->line = ev.str; in remove_history()
1574 history_length = ev.num; in remove_history()
1581 * replace the line and data of the num-th entry
1584 replace_history_entry(int num, const char *line, histdata_t data) in replace_history_entry() argument
1596 curr_num = ev.num; in replace_history_entry()
1606 if (history(h, &ev, H_NEXT_EVDATA, num, &he->data)) in replace_history_entry()
1609 he->line = ev.str; in replace_history_entry()
1610 if (he->line == NULL) in replace_history_entry()
1627 * clear the history list - delete all entries
1714 return -1; in history_total_bytes()
1715 curr_num = ev.num; in history_total_bytes()
1759 history_offset--; in previous_history()
1794 return -1; in history_search()
1795 curr_num = ev.num; in history_search()
1799 return (int)(strp - ev.str); in history_search()
1804 return -1; in history_search()
1833 off = (pos > 0) ? pos : -pos; in history_search_pos()
1834 pos = (pos > 0) ? 1 : -1; in history_search_pos()
1837 return -1; in history_search_pos()
1838 curr_num = ev.num; in history_search_pos()
1841 return -1; in history_search_pos()
1854 return -1; in history_search_pos()
1904 && text[0] == pass->pw_name[0] in username_completion_function()
1905 && strcmp(text, pass->pw_name) == 0) in username_completion_function()
1912 return strdup(pass->pw_name); in username_completion_function()
1917 * el-compatible wrapper to send TSTP on ^Z
2007 * bind key c to readline-type function func
2012 int retval = -1; in rl_bind_key()
2019 e->el_map.key[c] = ED_INSERT; in rl_bind_key()
2027 * read one key from input - handles chars pushed back
2068 /* XXX - int -> char conversion can lose on multichars */ in rl_insert()
2072 for (; count > 0; count--) in rl_insert()
2098 * Readline-4.0 appears to ignore the args. in rl_newline()
2126 return -1; in rl_add_defun()
2142 if (buf == NULL || count-- <= 0) in rl_callback_read_char()
2144 if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF]) in rl_callback_read_char()
2184 a[0] = (char)e->el_tty.t_c[TS_IO][C_REPRINT]; in rl_redisplay()
2196 while (count--) in rl_get_previous_history()
2241 return el_set(e, EL_BIND, "", var, value, NULL) == -1 ? 1 : 0; in rl_variable_bind()
2269 if (ioctl(el->el_infd, FIONREAD, &n) < 0) in _rl_event_read_char()
2270 return -1; in _rl_event_read_char()
2272 num_read = read(el->el_infd, &ch, (size_t)1); in _rl_event_read_char()
2276 if ((n = fcntl(el->el_infd, F_GETFL, 0)) < 0) in _rl_event_read_char()
2277 return -1; in _rl_event_read_char()
2278 if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0) in _rl_event_read_char()
2279 return -1; in _rl_event_read_char()
2280 num_read = read(el->el_infd, &ch, 1); in _rl_event_read_char()
2281 if (fcntl(el->el_infd, F_SETFL, n)) in _rl_event_read_char()
2282 return -1; in _rl_event_read_char()
2284 /* not non-blocking, but what you gonna do? */ in _rl_event_read_char()
2285 num_read = read(el->el_infd, &ch, 1); in _rl_event_read_char()
2286 return -1; in _rl_event_read_char()
2306 rl_point = (int)(li->cursor - li->buffer); in _rl_update_pos()
2307 rl_end = (int)(li->lastchar - li->buffer); in _rl_update_pos()
2326 if (li->buffer + from > li->lastchar) in rl_copy_text()
2327 from = (int)(li->lastchar - li->buffer); in rl_copy_text()
2329 if (li->buffer + to > li->lastchar) in rl_copy_text()
2330 to = (int)(li->lastchar - li->buffer); in rl_copy_text()
2332 len = (size_t)(to - from); in rl_copy_text()
2336 (void)strlcpy(out, li->buffer + from , len); in rl_copy_text()
2364 rl_get_screen_size(int *rows, int *cols) in rl_get_screen_size() argument
2368 if (cols) in rl_get_screen_size()
2369 el_get(e, EL_GETTC, "co", cols); in rl_get_screen_size()
2388 rl_set_screen_size(int rows, int cols) in rl_set_screen_size() argument
2393 (void)snprintf(buf, sizeof(buf), "%d", cols); in rl_set_screen_size()
2408 while ((match = (*fun)(str, (int)(len - 1))) != NULL) { in rl_completion_matches()
2426 qsort(&list[1], len - 1, sizeof(*list), in rl_completion_matches()
2429 for (i = 1, a = list[i]; i < len - 1; i++, a = b) { in rl_completion_matches()
2485 hs->length = history_length; in history_get_history_state()
2583 if (c == -1) in rl_echo_signal_char()