summaryrefslogtreecommitdiff
path: root/net/tnftp/files/libedit/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tnftp/files/libedit/term.c')
-rw-r--r--net/tnftp/files/libedit/term.c57
1 files changed, 42 insertions, 15 deletions
diff --git a/net/tnftp/files/libedit/term.c b/net/tnftp/files/libedit/term.c
index 4705a538bfb..e722b8870c3 100644
--- a/net/tnftp/files/libedit/term.c
+++ b/net/tnftp/files/libedit/term.c
@@ -1,4 +1,5 @@
-/* $NetBSD: term.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* NetBSD: term.c,v 1.4 2005/05/11 01:17:39 lukem Exp */
+/* from NetBSD: term.c,v 1.40 2004/05/22 23:21:28 christos Exp */
/*-
* Copyright (c) 1992, 1993
@@ -15,11 +16,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -39,6 +36,17 @@
#include "tnftp.h"
#include "sys.h"
+#if 0
+#include "config.h"
+#if !defined(lint) && !defined(SCCSID)
+#if 0
+static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
+#else
+__RCSID("NetBSD: term.c,v 1.4 2005/05/11 01:17:39 lukem Exp");
+#endif
+#endif /* not lint && not SCCSID */
+#endif
+
/*
* term.c: Editor/termcap-curses interface
* We have to declare a static variable here, since the
@@ -337,6 +345,7 @@ term_init(EditLine *el)
term_init_arrow(el);
return (0);
}
+
/* term_end():
* Clean up the terminal stuff
*/
@@ -353,6 +362,8 @@ term_end(EditLine *el)
el->el_term.t_str = NULL;
el_free((ptr_t) el->el_term.t_val);
el->el_term.t_val = NULL;
+ el_free((ptr_t) el->el_term.t_fkey);
+ el->el_term.t_fkey = NULL;
term_free_display(el);
}
@@ -629,7 +640,8 @@ mc_again:
* from col 0
*/
if (EL_CAN_TAB ?
- (-del > (((unsigned int) where >> 3) +
+ ((unsigned int)-del >
+ (((unsigned int) where >> 3) +
(where & 07)))
: (-del > where)) {
term__putc('\r'); /* do a CR */
@@ -857,6 +869,12 @@ term_clear_to_bottom(EditLine *el)
}
#endif
+protected void
+term_get(EditLine *el, const char **term)
+{
+ *term = el->el_term.t_name;
+}
+
/* term_set():
* Read in the terminal capabilities from the requested terminal
@@ -918,8 +936,11 @@ term_set(EditLine *el, const char *term)
/* Get the size */
Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li");
- for (t = tstr; t->name != NULL; t++)
- term_alloc(el, t, tgetstr(t->name, &area));
+ for (t = tstr; t->name != NULL; t++) {
+ /* XXX: some systems tgetstr needs non const */
+ term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
+ &area));
+ }
}
if (Val(T_co) < 2)
@@ -938,6 +959,7 @@ term_set(EditLine *el, const char *term)
return (-1);
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
term_bind_arrow(el);
+ el->el_term.t_name = term;
return (i <= 0 ? -1 : 0);
}
@@ -1227,7 +1249,8 @@ term__flush(void)
*/
protected int
/*ARGSUSED*/
-term_telltc(EditLine *el, int argc, const char **argv)
+term_telltc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv __attribute__((__unused__)))
{
const struct termcapstr *t;
char **ts;
@@ -1262,7 +1285,8 @@ term_telltc(EditLine *el, int argc, const char **argv)
*/
protected int
/*ARGSUSED*/
-term_settc(EditLine *el, int argc, const char **argv)
+term_settc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv)
{
const struct termcapstr *ts;
const struct termcapval *tv;
@@ -1338,7 +1362,8 @@ term_settc(EditLine *el, int argc, const char **argv)
*/
protected int
/*ARGSUSED*/
-term_echotc(EditLine *el, int argc, const char **argv)
+term_echotc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv)
{
char *cap, *scap, *ep;
int arg_need, arg_cols, arg_rows;
@@ -1397,7 +1422,7 @@ term_echotc(EditLine *el, int argc, const char **argv)
}
(void) fprintf(el->el_outfile, fmtd, 0);
#else
- (void) fprintf(el->el_outfile, fmtd, el->el_tty.t_speed);
+ (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed);
#endif
return (0);
} else if (strcmp(*argv, "rows") == 0 || strcmp(*argv, "lines") == 0) {
@@ -1416,8 +1441,10 @@ term_echotc(EditLine *el, int argc, const char **argv)
scap = el->el_term.t_str[t - tstr];
break;
}
- if (t->name == NULL)
- scap = tgetstr(*argv, &area);
+ if (t->name == NULL) {
+ /* XXX: some systems tgetstr needs non const */
+ scap = tgetstr(strchr(*argv, **argv), &area);
+ }
if (!scap || scap[0] == '\0') {
if (!silent)
(void) fprintf(el->el_errfile,