bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fixes for examples


From: 林宏雄
Subject: fixes for examples
Date: Mon, 17 Jun 2024 23:46:59 +0900

Hi,

make -C examples causes several errors and warnings.
And I read and executed each sample code and found some issues.
The attached diff file includes fixes for them.

Thanks.
--
Hiroo Hayashi

--------------------------------------------
excallback.c

This code was contributed for readline-4.0.
change_prompt() can be implemented using rl_set_prompt(), introduced by readline-4.2.
I have updated it to allow selection by rl_readline_version.

The code to save and restore terminal settings can be removed by using rl_callback_handler_remove().
I have made it selectable with the USE_RL_CALLBACK_HANDLER_REMOVE macro.
--------------------------------------------
histexamp.c

before fix: "delete 2" deletes "3: baz"
$ ./histexamp
history$ foo
history$ bar
history$ baz
history$ list
1: Sun 11:58: foo
2: Sun 11:58: bar
3: Sun 11:58: baz
4: Sun 11:58: list
history$ delete 2
history$ list
1: Sun 11:58: foo
2: Sun 11:58: bar
3: Sun 11:58: list
4: Sun 11:58: delete 2
5: Sun 11:58: list
history$

after fix: "delete 2" deletes "2: bar"
$ ./histexamp
history$ foo
history$ bar
history$ baz
history$ list
1: Sun 11:54: foo
2: Sun 11:55: bar
3: Sun 11:55: baz
4: Sun 11:55: list
history$ delete 2
history$ list
1: Sun 11:54: foo
2: Sun 11:55: baz
3: Sun 11:55: list
4: Sun 11:55: delete 2
5: Sun 11:55: list
history$

--------------------------------------------
rl-callbacktest.c

Fixed to be consistent with the sample code in "2.4.14 Alternative Interface Examples".
In addition, this modification simplifies the comparison of this code with rl-callbacktest3.c.

doc/rltech.texi

add missing #include <errno.h>

--------------------------------------------
.gitignore

add history.pc and executable files under examples/

--------------------------------------------
configure.ac

add pty.h on AC_CHECK_HEADERS for examples/rlptytest

rlptytest.c
add HAVE_PTY_H check and include sys/ioctl.h (for macOS)

--------------------------------------------
excallback.c
fileman.c
histexamp.c
rl-callbacktest2.c
rlptytest.c

fixes for compile errors and warnings

--
Hiroo Hayashi

Attachment: examples.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]