summaryrefslogtreecommitdiffstats
path: root/lib/libedit/map.c
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2007-03-11 18:30:22 +0000
committerstefanf <stefanf@FreeBSD.org>2007-03-11 18:30:22 +0000
commit11fa4c47513c298a58113f8fd2a473ec7f643254 (patch)
tree509b6d0c810b13835386c30b69cd13d7ebcd95d7 /lib/libedit/map.c
parent8355c667d5270a72a500fdd281ef01faca0fa571 (diff)
downloadFreeBSD-src-11fa4c47513c298a58113f8fd2a473ec7f643254.zip
FreeBSD-src-11fa4c47513c298a58113f8fd2a473ec7f643254.tar.gz
Merge the following changes from NetBSD:
chared.h 1.17, common.c 1.19, emacs.c 1.21, key.c 1.18, key.h 1.9, map.c 1.23, term.c 1.42, term.h 1.17, vi.c 1.25: # Print the actual eofc, instead of ^D\b\b. # Change internal character decoding to prevent buffer oveflows. key.c 1.19, key.h 1.10: # move declaration to header file. term.c 1.43: # Coverity CID 806: Prevent NULL deref term.c 1.44: # Coverity CID 1668: Plug memory leak. term.c 1.45: # Fix compilation. MFC after: 3 weeks
Diffstat (limited to 'lib/libedit/map.c')
-rw-r--r--lib/libedit/map.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/lib/libedit/map.c b/lib/libedit/map.c
index 76c9e4d..c4121a6 100644
--- a/lib/libedit/map.c
+++ b/lib/libedit/map.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $
+ * $NetBSD: map.c,v 1.23 2006/03/06 21:11:56 christos Exp $
*/
#if !defined(lint) && !defined(SCCSID)
@@ -1126,7 +1126,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
el_bindings_t *bp, *ep;
if (in[0] == '\0' || in[1] == '\0') {
- (void) key__decode_str(in, outbuf, "");
+ (void) key__decode_str(in, outbuf, sizeof(outbuf), "");
ep = &el->el_map.help[el->el_map.nfunc];
for (bp = el->el_map.help; bp < ep; bp++)
if (bp->func == map[(unsigned char) *in]) {
@@ -1154,40 +1154,47 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
lastbuf[0] = last;
lastbuf[1] = 0;
if (map[first] == ED_UNASSIGNED) {
- if (first == last)
+ if (first == last) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
- "%-15s-> is undefined\n",
- key__decode_str(firstbuf, unparsbuf, STRQQ));
+ "%-15s-> is undefined\n", unparsbuf);
+ }
return;
}
ep = &el->el_map.help[el->el_map.nfunc];
for (bp = el->el_map.help; bp < ep; bp++) {
if (bp->func == map[first]) {
if (first == last) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
- key__decode_str(firstbuf, unparsbuf, STRQQ),
- bp->name);
+ unparsbuf, bp->name);
} else {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) key__decode_str(lastbuf, extrabuf,
+ sizeof(extrabuf), STRQQ);
(void) fprintf(el->el_outfile,
"%-4s to %-7s-> %s\n",
- key__decode_str(firstbuf, unparsbuf, STRQQ),
- key__decode_str(lastbuf, extrabuf, STRQQ),
- bp->name);
+ unparsbuf, extrabuf, bp->name);
}
return;
}
}
#ifdef MAP_DEBUG
if (map == el->el_map.key) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
- "BUG!!! %s isn't bound to anything.\n",
- key__decode_str(firstbuf, unparsbuf, STRQQ));
+ "BUG!!! %s isn't bound to anything.\n", unparsbuf);
(void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n",
first, el->el_map.key[first]);
} else {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
- "BUG!!! %s isn't bound to anything.\n",
- key__decode_str(firstbuf, unparsbuf, STRQQ));
+ "BUG!!! %s isn't bound to anything.\n", unparsbuf);
(void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n",
first, el->el_map.alt[first]);
}
OpenPOWER on IntegriCloud