summaryrefslogtreecommitdiff
path: root/cmd-line-utils/libedit/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-line-utils/libedit/hist.c')
-rw-r--r--cmd-line-utils/libedit/hist.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/cmd-line-utils/libedit/hist.c b/cmd-line-utils/libedit/hist.c
index 59c2f39dd34..e8f5c0f39ba 100644
--- a/cmd-line-utils/libedit/hist.c
+++ b/cmd-line-utils/libedit/hist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hist.c,v 1.12 2003/01/21 18:40:23 christos Exp $ */
+/* $NetBSD: hist.c,v 1.15 2003/11/01 23:36:39 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -15,11 +15,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.
*
@@ -36,14 +32,7 @@
* SUCH DAMAGE.
*/
-#include "config.h"
-#if !defined(lint) && !defined(SCCSID)
-#if 0
-static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: hist.c,v 1.12 2003/01/21 18:40:23 christos Exp $");
-#endif
-#endif /* not lint && not SCCSID */
+#include <config.h>
/*
* hist.c: History access functions
@@ -157,7 +146,6 @@ hist_get(EditLine *el)
* process a history command
*/
protected int
-/*ARGSUSED*/
hist_command(EditLine *el, int argc, const char **argv)
{
const char *str;
@@ -167,7 +155,7 @@ hist_command(EditLine *el, int argc, const char **argv)
if (el->el_history.ref == NULL)
return (-1);
- if (argc == 0 || strcmp(argv[0], "list") == 1) {
+ if (argc == 1 || strcmp(argv[1], "list") == 0) {
/* List history entries */
for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
@@ -176,15 +164,15 @@ hist_command(EditLine *el, int argc, const char **argv)
return (0);
}
- if (argc != 2)
+ if (argc != 3)
return (-1);
- num = (int)strtol(argv[1], NULL, 0);
+ num = (int)strtol(argv[2], NULL, 0);
- if (strcmp(argv[0], "size") == 0)
+ if (strcmp(argv[1], "size") == 0)
return history(el->el_history.ref, &ev, H_SETSIZE, num);
- if (strcmp(argv[0], "unique") == 0)
+ if (strcmp(argv[1], "unique") == 0)
return history(el->el_history.ref, &ev, H_SETUNIQUE, num);
return -1;