diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-05-08 13:34:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-05-08 13:34:36 +0000 |
commit | 20caff463c958ba7ab9dd40c68f397ab11849499 (patch) | |
tree | b004933aaf4d5668264401d7017b28a468e60ec9 /lib | |
parent | 52fab67a4900333d713a6af3d9db82566134584a (diff) |
Make the history_set_pos() return values agree with the GNU implementation.
Patch from Bastian Maerkisch <bmaerkisch at web dot de>
with a minor tweak from Christos Zoulas.
Fixes the test_set_pos_return_values() regression test.
OK czarkoff@,
also proofread by zhuk@ and by Christian Heckendorf <mbie at ulmus dot me>.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libedit/readline.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index c2666869bc3..51901891582 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readline.c,v 1.21 2016/05/06 13:12:52 schwarze Exp $ */ +/* $OpenBSD: readline.c,v 1.22 2016/05/08 13:34:35 schwarze Exp $ */ /* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */ /*- @@ -1544,7 +1544,7 @@ history_set_pos(int pos) int curr_num; if (pos >= history_length || pos < 0) - return -1; + return 0; (void)history(h, &ev, H_CURR); curr_num = ev.num; @@ -1555,9 +1555,9 @@ history_set_pos(int pos) */ if (history(h, &ev, H_DELDATA, pos, (void **)-1)) { (void)history(h, &ev, H_SET, curr_num); - return -1; + return 0; } - return 0; + return 1; } @@ -1640,7 +1640,7 @@ history_search_pos(const char *str, return -1; curr_num = ev.num; - if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0) + if (!history_set_pos(off) || history(h, &ev, H_CURR) != 0) return -1; for (;;) { |