fixes for glibc time/gettimeofday issue; fix issue with history file containing one line too few if saving timestamps; fix for signal arriving while displaying readline completions

This commit is contained in:
Chet Ramey
2023-03-27 09:28:12 -04:00
parent f539a75606
commit 64b2b7c08d
25 changed files with 344 additions and 125 deletions
+5 -5
View File
@@ -32,9 +32,7 @@
#include <string.h>
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
char line[1024], *t;
int len, done;
@@ -91,6 +89,7 @@ main (argc, argv)
register HIST_ENTRY **the_list;
register int i;
time_t tt;
struct tm *tm;
char timestr[128];
the_list = history_list ();
@@ -98,8 +97,9 @@ main (argc, argv)
for (i = 0; the_list[i]; i++)
{
tt = history_get_time (the_list[i]);
if (tt)
strftime (timestr, sizeof (timestr), "%a %R", localtime(&tt));
tm = tt ? localtime (&tt) : 0;
if (tm)
strftime (timestr, sizeof (timestr), "%a %R", tm);
else
strcpy (timestr, "??");
printf ("%d: %s: %s\n", i + history_base, timestr, the_list[i]->line);