readline library to be linked against a shared termcap/curses library
that configure finds. If the argument begins with `-l', use that
library instead; updated INSTALL accordingly
+
+ 11/25/2022
+ ----------
+gettimeofday.c
+ - add file from bash's lib/sh/gettimeofday.c, only compiled in if
+ HAVE_GETTIMEOFDAY is not defined
+
+Makefile.in
+ - gettimeofday.o: link in, it will not define any symbols if
+ HAVE_GETTIMEOFDAY is defined. This is for systems like _WIN32 that
+ don't have gettimeofday()
+
vi_mode.c f
xfree.c f
xmalloc.c f
+gettimeofday.c f
history.c f
histexpand.c f
histfile.c f
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
$(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
- $(srcdir)/mbutil.c
+ $(srcdir)/mbutil.c $(srcdir)/gettimeofday.c
# The header files for this library.
HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) $(COLORSOBJ) \
- xmalloc.o xfree.o compat.o
+ xmalloc.o xfree.o compat.o gettimeofday.o
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
xmalloc.o: ${BUILD_DIR}/config.h
xmalloc.o: ansi_stdlib.h
+gettimeofday.o: ${BUILD_DIR}/config.h
+gettimeofday.o: posixtime.h
+
colors.o: ${BUILD_DIR}/config.h colors.h
colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
colors.o: rlconf.h
puts_face (&last_line[_rl_screenwidth - 1 + woff],
&last_face[_rl_screenwidth - 1 + woff], 1);
}
- _rl_vis_botlin = 0;
- if (botline_length > 0 || _rl_last_c_pos > 0)
+ if ((_rl_vis_botlin == 0 && botline_length == 0) || botline_length > 0 || _rl_last_c_pos > 0)
rl_crlf ();
+ _rl_vis_botlin = 0;
fflush (rl_outstream);
rl_display_fixed++;
}
--- /dev/null
+/* gettimeofday.c - gettimeofday replacement using time() */
+
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Bash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "config.h"
+
+#if !defined (HAVE_GETTIMEOFDAY)
+
+#include "posixtime.h"
+
+/* A version of gettimeofday that just sets tv_sec from time(3) */
+int
+gettimeofday (struct timeval *restrict tv, void *restrict tz)
+{
+ tv->tv_sec = (time_t) time ((time_t *)0);
+ tv->tv_usec = 0;
+ return 0;
+}
+#endif
chars_avail = 0;
#endif
+ if (result == -1 && rl_input_available_hook)
+ {
+ result = (*rl_input_available_hook) ();
+ if (result == 0)
+ result = -1;
+ }
+
#if defined (O_NDELAY)
if (result == -1)
{
/* A special paste command for Windows users. */
#if defined (_WIN32)
+#define WIN32_LEAN_AND_MEAN
+
#include <windows.h>
int
# include <unistd.h>
#endif
+#include "rlstdc.h"
#include "posixselect.h"
#if defined (HAVE_STRING_H)
#ifndef _POSIXSELECT_H_
#define _POSIXSELECT_H_
-#if defined (FD_SET) && !defined (HAVE_SELECT)
+#if defined (FD_SET) && !defined (HAVE_SELECT) && !defined (_WIN32)
# define HAVE_SELECT 1
#endif
#endif
#if !HAVE_GETTIMEOFDAY
-extern int gettimeofday PARAMS((struct timeval *, void *));
+extern int gettimeofday PARAMS((struct timeval * restrict, void * restrict));
#endif
/* These exist on BSD systems, at least. */
if (RL_ISSTATE (RL_STATE_TIMEOUT))
{
RL_SETSTATE (RL_STATE_DONE);
- rl_done = 1;
- return 1;
+ return (rl_done = 1);
}
/* If we get here, we're not being called from something dispatched
extern int _rl_timeout_init (void);
extern int _rl_timeout_handle_sigalrm (void);
-#if defined (_POSIXSELECT_H_) && !defined (__MINGW32__)
+#if defined (_POSIXSELECT_H_) && !defined (__MINGW32__) && (defined (HAVE_SELECT) || defined (HAVE_PSELECT))
/* use as a sentinel for fd_set, struct timeval, and sigset_t definitions */
extern int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
#endif