summaryrefslogtreecommitdiff
path: root/lib/libedit/key.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-03-14 05:13:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-03-14 05:13:12 +0000
commit792987ae58d7eb73cd9316b0db73298133aedd0a (patch)
treedf20288853f454d9c1b380583a13a9be108bbabd /lib/libedit/key.c
parent2619c4c4532a4d864fb1ca726290a4181e754cc3 (diff)
fix el_source() - a block needed braces around it (from NetBSD)
Some strcpy() -> strncpy (from NetBSD) Some KNF Add current NetBSD tags
Diffstat (limited to 'lib/libedit/key.c')
-rw-r--r--lib/libedit/key.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/libedit/key.c b/lib/libedit/key.c
index 2fd5703d0a6..5a81521e52f 100644
--- a/lib/libedit/key.c
+++ b/lib/libedit/key.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: key.c,v 1.2 1997/01/16 05:18:36 millert Exp $ */
+/* $OpenBSD: key.c,v 1.3 1997/03/14 05:12:52 millert Exp $ */
+/* $NetBSD: key.c,v 1.2 1997/01/11 06:47:58 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -40,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: key.c,v 1.2 1997/01/16 05:18:36 millert Exp $";
+static char rcsid[] = "$OpenBSD: key.c,v 1.3 1997/03/14 05:12:52 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -201,13 +202,13 @@ key_add(el, key, val, ntype)
int ntype;
{
if (key[0] == '\0') {
- (void) fprintf(el->el_errfile,
+ (void)fprintf(el->el_errfile,
"key_add: Null extended-key not allowed.\n");
return;
}
if (ntype == XK_CMD && val->cmd == ED_SEQUENCE_LEAD_IN) {
- (void) fprintf(el->el_errfile,
+ (void)fprintf(el->el_errfile,
"key_add: sequence-lead-in command not allowed\n");
return;
}
@@ -217,7 +218,7 @@ key_add(el, key, val, ntype)
el->el_key.map = node__get(key[0]); /* it is properly initialized */
/* Now recurse through el->el_key.map */
- (void) node__try(el->el_key.map, key, val, ntype);
+ (void)node__try(el->el_key.map, key, val, ntype);
return;
}
@@ -236,7 +237,7 @@ key_clear(el, map, in)
el->el_map.alt[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN) ||
(map == el->el_map.alt &&
el->el_map.key[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN)))
- (void) key_delete(el, in);
+ (void)key_delete(el, in);
}
@@ -250,7 +251,7 @@ key_delete(el, key)
char *key;
{
if (key[0] == '\0') {
- (void) fprintf(el->el_errfile,
+ (void)fprintf(el->el_errfile,
"key_delete: Null extended-key not allowed.\n");
return -1;
}
@@ -258,7 +259,7 @@ key_delete(el, key)
if (el->el_key.map == NULL)
return 0;
- (void) node__delete(&el->el_key.map, key);
+ (void)node__delete(&el->el_key.map, key);
return 0;
}
@@ -279,7 +280,7 @@ key_print(el, key)
el->el_key.buf[0] = '"';
if (node_lookup(el, key, el->el_key.map, 1) <= -1)
/* key is not bound */
- (void) fprintf(el->el_errfile, "Unbound extended key \"%s\"\n", key);
+ (void)fprintf(el->el_errfile, "Unbound extended key \"%s\"\n", key);
return;
}
@@ -385,7 +386,7 @@ node__try(ptr, str, val, ntype)
/* still more chars to go */
if (ptr->next == NULL)
ptr->next = node__get(*str); /* setup new node */
- (void) node__try(ptr->next, str, val, ntype);
+ (void)node__try(ptr->next, str, val, ntype);
}
return 0;
}
@@ -514,7 +515,7 @@ node_lookup(el, str, ptr, cnt)
if (*str == 0) {
/* no more chars in str. node_enum from here. */
- (void) node_enum(el, ptr, cnt);
+ (void)node_enum(el, ptr, cnt);
return 0;
}
else {
@@ -563,15 +564,15 @@ node_enum(el, ptr, cnt)
if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */
el->el_key.buf[++cnt] = '"';
el->el_key.buf[++cnt] = '\0';
- (void) fprintf(el->el_errfile,
+ (void)fprintf(el->el_errfile,
"Some extended keys too long for internal print buffer");
- (void) fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf);
+ (void)fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf);
return 0;
}
if (ptr == NULL) {
#ifdef DEBUG_EDIT
- (void) fprintf(el->el_errfile, "node_enum: BUG!! Null ptr passed\n!");
+ (void)fprintf(el->el_errfile, "node_enum: BUG!! Null ptr passed\n!");
#endif
return -1;
}
@@ -585,11 +586,11 @@ node_enum(el, ptr, cnt)
key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
}
else
- (void) node_enum(el, ptr->next, ncnt + 1);
+ (void)node_enum(el, ptr->next, ncnt + 1);
/* go to sibling if there is one */
if (ptr->sibling)
- (void) node_enum(el, ptr->sibling, cnt);
+ (void)node_enum(el, ptr->sibling, cnt);
return 0;
}
@@ -613,19 +614,19 @@ key_kprint(el, key, val, ntype)
switch (ntype) {
case XK_STR:
case XK_EXE:
- (void) fprintf(el->el_errfile, fmt, key,
+ (void)fprintf(el->el_errfile, fmt, key,
key__decode_str(val->str, unparsbuf,
ntype == XK_STR ? "\"\"" : "[]"));
break;
case XK_CMD:
for (fp = el->el_map.help; fp->name; fp++)
if (val->cmd == fp->func) {
- (void) fprintf(el->el_errfile, fmt, key, fp->name);
+ (void)fprintf(el->el_errfile, fmt, key, fp->name);
break;
}
#ifdef DEBUG_KEY
if (fp->name == NULL)
- (void) fprintf(el->el_errfile, "BUG! Command not found.\n");
+ (void)fprintf(el->el_errfile, "BUG! Command not found.\n");
#endif
break;
@@ -634,7 +635,7 @@ key_kprint(el, key, val, ntype)
break;
}
else
- (void) fprintf(el->el_errfile, fmt, key, "no input");
+ (void)fprintf(el->el_errfile, fmt, key, "no input");
}