Minix editline v0.2.1

=====================

Fix Debian batch mode reader, read_redirected(), which is activated
when input comes from a file rather than a tty.  

The implementation of read_redirected() did not support lines longer
than 64 chars.  It tried to realloc(), but goofed up and instead
truncated all the first 64 chars.  The result was that each read
line only contained the reminder of a a division with 64... :-)
This commit is contained in:
Joachim Nilsson 2008-06-09 22:55:13 +02:00
parent 64cc1b5325
commit b935808b7d
3 changed files with 22 additions and 15 deletions

20
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for Minix editline 0.2.0.
# Generated by GNU Autoconf 2.61 for Minix editline 0.2.1.
#
# Report bugs to <joachim@vmlinux.org>.
#
@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='Minix editline'
PACKAGE_TARNAME='minix-editline'
PACKAGE_VERSION='0.2.0'
PACKAGE_STRING='Minix editline 0.2.0'
PACKAGE_VERSION='0.2.1'
PACKAGE_STRING='Minix editline 0.2.1'
PACKAGE_BUGREPORT='joachim@vmlinux.org'
ac_unique_file="src/editline.c"
@ -1208,7 +1208,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures Minix editline 0.2.0 to adapt to many kinds of systems.
\`configure' configures Minix editline 0.2.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1274,7 +1274,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Minix editline 0.2.0:";;
short | recursive ) echo "Configuration of Minix editline 0.2.1:";;
esac
cat <<\_ACEOF
@ -1358,7 +1358,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Minix editline configure 0.2.0
Minix editline configure 0.2.1
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1372,7 +1372,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Minix editline $as_me 0.2.0, which was
It was created by Minix editline $as_me 0.2.1, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@ -2067,7 +2067,7 @@ fi
# Define the identity of the package.
PACKAGE='minix-editline'
VERSION='0.2.0'
VERSION='0.2.1'
cat >>confdefs.h <<_ACEOF
@ -5382,7 +5382,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Minix editline $as_me 0.2.0, which was
This file was extended by Minix editline $as_me 0.2.1, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5435,7 +5435,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
Minix editline config.status 0.2.0
Minix editline config.status 0.2.1
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(Minix editline, 0.2.0, joachim@vmlinux.org)
AC_INIT(Minix editline, 0.2.1, joachim@vmlinux.org)
AC_CONFIG_SRCDIR([src/editline.c])
AC_CONFIG_HEADER([config.h])

View File

@ -988,18 +988,24 @@ hist_add(p)
}
STATIC char *
read_redirected()
read_redirected(void)
{
int size;
int size = MEM_INC;
char *p;
char *line;
char *end;
for (size = MEM_INC, p = line = NEW(char, size), end = p + size; ; p++) {
if (p == end) {
size += MEM_INC;
p = line = realloc(line, size);
p = line = NEW(char, size);
end = p + size;
while (1) {
if (p == end) {
int oldpos = end - line;
size += MEM_INC;
p = RENEW(line, char, size);
end = p + size;
p += oldpos; /* Continue where we left off... */
}
if (read(0, p, 1) <= 0) {
/* Ignore "incomplete" lines at EOF, just like we do for a tty. */
@ -1008,6 +1014,7 @@ read_redirected()
}
if (*p == '\n')
break;
p++;
}
*p = '\0';
return line;