tweaks: start searching at a better place

Taking the terminating newline into account, and that there is
at least one digit per number.
master
Benno Schulenberg 2016-12-19 09:52:30 +01:00
parent cd705a7c4c
commit 2bcc6d7f66
1 changed files with 5 additions and 5 deletions

View File

@ -3186,13 +3186,13 @@ void load_poshistory(void)
poshiststruct *record_ptr = NULL, *newrecord;
/* Read and parse each line, and store the extracted data. */
while ((read = getline(&line, &buf_len, hist)) > 2) {
/* Decode nulls as newlines. */
while ((read = getline(&line, &buf_len, hist)) > 5) {
/* Decode nulls as embedded newlines. */
unsunder(line, read);
/* Find where x index and line number are in the line. */
xptr = revstrstr(line, " ", line + read);
lineptr = revstrstr(line, " ", xptr - 1);
/* Find where the x index and line number are in the line. */
xptr = revstrstr(line, " ", line + read - 3);
lineptr = revstrstr(line, " ", xptr - 2);
/* Now separate the three elements of the line. */
*(xptr++) = '\0';