HCoop
/
jackhill
/
mal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
10cd6f4
)
fix history function of C
author
Mitsuru Kariya
<kariya_mitsuru@hotmail.com>
Tue, 21 Jul 2015 06:58:17 +0000
(15:58 +0900)
committer
Mitsuru Kariya
<kariya_mitsuru@hotmail.com>
Tue, 21 Jul 2015 07:08:19 +0000
(16:08 +0900)
When the editline was used instead of the readline, the history function of C didn't work as intended.
It was caused like below.
- segmentation fault if a history is empty.
- incorrect line was added to a history file.
c/readline.c
patch
|
blob
|
blame
|
history
diff --git
a/c/readline.c
b/c/readline.c
index
1707718
..
e7da7b1
100644
(file)
--- a/
c/readline.c
+++ b/
c/readline.c
@@
-42,7
+42,7
@@
void append_to_history() {
#ifdef USE_READLINE
append_history(1, hf);
#else
- HIST_ENTRY *he = history_get(history_length-1);
+ HIST_ENTRY *he = history_get(history_
base+history_
length-1);
FILE *fp = fopen(hf, "a");
if (fp) {
fprintf(fp, "%s\n", he->line);