1 Star 0 Fork 9

openeuler-embedded/readline

forked from src-openEuler/readline 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
reading-history-entries-with-timestamps-can-result-i.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
From f5720c8cabbdb2387b4dc9e36633a73df6a634da Mon Sep 17 00:00:00 2001
From: Chet Ramey <[email protected]>
Date: Fri, 7 Feb 2020 14:57:47 -0500
Subject: [PATCH 3/4] reading history entries with timestamps can result in
joined entries
---
histfile.c | 15 ++++++++++++++-
patchlevel | 2 +-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/histfile.c b/histfile.c
index a8a92aa..6c3adc9 100644
--- a/histfile.c
+++ b/histfile.c
@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to)
}
has_timestamps = HIST_TIMESTAMP_START (buffer);
- history_multiline_entries += has_timestamps && history_write_timestamps;
+ history_multiline_entries += has_timestamps && history_write_timestamps;
/* Skip lines until we are at FROM. */
+ if (has_timestamps)
+ last_ts = buffer;
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
{
@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to)
line. We should check more extensively here... */
if (HIST_TIMESTAMP_START(p) == 0)
current_line++;
+ else
+ last_ts = p;
line_start = p;
+ /* If we are at the last line (current_line == from) but we have
+ timestamps (has_timestamps), then line_start points to the
+ text of the last command, and we need to skip to its end. */
+ if (current_line >= from && has_timestamps)
+ {
+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
+ ;
+ line_start = (*line_end == '\n') ? line_end + 1 : line_end;
+ }
}
/* If there are lines left to gobble, then gobble them now. */
diff --git a/patchlevel b/patchlevel
index 7cbda82..ce3e355 100644
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-2
+3
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler-embedded/readline.git
[email protected]:openeuler-embedded/readline.git
openeuler-embedded
readline
readline
openEuler-embedded

搜索帮助