-.\" $OpenBSD: editline.3,v 1.46 2016/05/22 22:08:42 schwarze Exp $
+.\" $OpenBSD: editline.3,v 1.47 2021/08/12 10:31:15 schwarze Exp $
.\" $NetBSD: editline.3,v 1.88 2016/02/25 14:59:22 wiz Exp $
.\"
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 22 2016 $
+.Dd $Mdocdate: August 12 2021 $
.Dt EDITLINE 3
.Os
.Sh NAME
.Pp
The
.Nm
+library is designed to work with blocking I/O only.
+If the
+.Dv FIONBIO
+.Xr ioctl 2
+is set on
+.Ar fin ,
+.Fn el_gets
+and
+.Fn el_wgets
+will almost certainly fail with
+.Ar EAGAIN .
+.Pp
+The
+.Nm
library respects the
.Ev LC_CTYPE
locale set by the application program and never uses
-/* $OpenBSD: read.c,v 1.47 2021/08/11 15:13:46 martijn Exp $ */
+/* $OpenBSD: read.c,v 1.48 2021/08/12 10:31:15 schwarze Exp $ */
/* $NetBSD: read.c,v 1.100 2016/05/24 19:31:27 christos Exp $ */
/*-
int read_errno;
};
-static int read__fixio(int, int);
static int read_char(EditLine *, wchar_t *);
static int read_getcmd(EditLine *, el_action_t *, wchar_t *);
static void read_clearmacros(struct macros *);
}
-/* read__fixio():
- * Try to recover from a read error
- */
-static int
-read__fixio(int fd, int e)
-{
- int zero = 0;
-
- switch (e) {
- case EAGAIN:
- if (ioctl(fd, FIONBIO, &zero) == -1)
- return -1;
- return 0;
-
- default:
- return -1;
- }
-}
-
-
/* el_push():
* Push a macro
*/
read_char(EditLine *el, wchar_t *cp)
{
ssize_t num_read;
- int tried = 0;
char cbuf[MB_LEN_MAX];
int cbp = 0;
- int save_errno = errno;
again:
el->el_signal->sig_no = 0;
while ((num_read = read(el->el_infd, cbuf + cbp, 1)) == -1) {
- int e = errno;
if (errno == EINTR) {
switch (el->el_signal->sig_no) {
case SIGCONT:
break;
}
}
- if (!tried && read__fixio(el->el_infd, e) == 0) {
- errno = save_errno;
- tried = 1;
- } else {
- errno = e;
- *cp = L'\0';
- return -1;
- }
+ *cp = L'\0';
+ return -1;
}
/* Test for EOF */