Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit term -> terminal
details: https://anonhg.NetBSD.org/src/rev/4de7cea59915
branches: trunk
changeset: 767704:4de7cea59915
user: christos <christos%NetBSD.org@localhost>
date: Thu Jul 28 00:49:18 2011 +0000
description:
term -> terminal
eliminate MAXPATHLEN
diffstat:
lib/libedit/el.c | 53 +++++++++++++++++++++++++++--------------------------
1 files changed, 27 insertions(+), 26 deletions(-)
diffs (175 lines):
diff -r 4416fae6f46e -r 4de7cea59915 lib/libedit/el.c
--- a/lib/libedit/el.c Thu Jul 28 00:48:21 2011 +0000
+++ b/lib/libedit/el.c Thu Jul 28 00:49:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.63 2011/07/26 21:03:17 christos Exp $ */
+/* $NetBSD: el.c,v 1.64 2011/07/28 00:49:18 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.63 2011/07/26 21:03:17 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.64 2011/07/28 00:49:18 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -92,7 +92,7 @@
}
#endif
- if (term_init(el) == -1) {
+ if (terminal_init(el) == -1) {
el_free(el->el_prog);
el_free(el);
return NULL;
@@ -124,7 +124,7 @@
el_reset(el);
- term_end(el);
+ terminal_end(el);
key_end(el);
map_end(el);
tty_end(el);
@@ -196,7 +196,7 @@
}
case EL_TERMINAL:
- rv = term_set(el, va_arg(ap, char *));
+ rv = terminal_set(el, va_arg(ap, char *));
break;
case EL_EDITOR:
@@ -231,17 +231,17 @@
case EL_TELLTC:
argv[0] = STR("telltc");
- rv = term_telltc(el, i, argv);
+ rv = terminal_telltc(el, i, argv);
break;
case EL_SETTC:
argv[0] = STR("settc");
- rv = term_settc(el, i, argv);
+ rv = terminal_settc(el, i, argv);
break;
case EL_ECHOTC:
argv[0] = STR("echotc");
- rv = term_echotc(el, i, argv);
+ rv = terminal_echotc(el, i, argv);
break;
case EL_SETTY:
@@ -351,7 +351,7 @@
case EL_REFRESH:
re_clear_display(el);
re_refresh(el);
- term__flush(el);
+ terminal__flush(el);
break;
default:
@@ -409,7 +409,7 @@
break;
case EL_TERMINAL:
- term_get(el, va_arg(ap, const char **));
+ terminal_get(el, va_arg(ap, const char **));
rv = 0;
break;
@@ -426,7 +426,7 @@
switch (op) {
case EL_GETTC:
argv[0] = name;
- rv = term_gettc(el, i, argv);
+ rv = terminal_gettc(el, i, argv);
break;
default:
@@ -506,24 +506,24 @@
FILE *fp;
size_t len;
char *ptr;
-#ifdef HAVE_ISSETUGID
- char path[MAXPATHLEN];
-#endif
+ char *path = NULL;
const Char *dptr;
+ int error = 0;
fp = NULL;
if (fname == NULL) {
#ifdef HAVE_ISSETUGID
static const char elpath[] = "/.editrc";
+ size_t len = sizeof(elpath);
if (issetugid())
return (-1);
if ((ptr = getenv("HOME")) == NULL)
return (-1);
- if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path))
+ len += strlen(ptr);
+ if ((path = malloc(len)) == NULL)
return (-1);
- if (strlcat(path, elpath, sizeof(path)) >= sizeof(path))
- return (-1);
+ (void)snprintf(path, len, "%s%s", ptr, elpath);
fname = path;
#else
/*
@@ -536,8 +536,10 @@
}
if (fp == NULL)
fp = fopen(fname, "r");
- if (fp == NULL)
+ if (fp == NULL) {
+ el_free(path);
return (-1);
+ }
while ((ptr = fgetln(fp, &len)) != NULL) {
if (*ptr == '\n')
@@ -553,14 +555,13 @@
dptr++;
if (*dptr == '#')
continue; /* ignore, this is a comment line */
- if (parse_line(el, dptr) == -1) {
- (void) fclose(fp);
- return (-1);
- }
+ if ((error = parse_line(el, dptr)) == -1)
+ break;
}
+ el_free(path);
(void) fclose(fp);
- return (0);
+ return (error);
}
@@ -578,8 +579,8 @@
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
/* get the correct window size */
- if (term_get_size(el, &lins, &cols))
- term_change_size(el, lins, cols);
+ if (terminal_get_size(el, &lins, &cols))
+ terminal_change_size(el, lins, cols);
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
}
@@ -592,7 +593,7 @@
el_beep(EditLine *el)
{
- term_beep(el);
+ terminal_beep(el);
}
Home |
Main Index |
Thread Index |
Old Index