diff --git a/autogen.sh b/autogen.sh index cfe70582..de255920 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,6 +5,8 @@ gnulib_url="git://git.sv.gnu.org/gnulib.git" gnulib_hash="4084b3a1094372b960ce4a97634e08f4538c8bdd" modules=" + getdelim + getline strcase strcasestr-simple strnlen diff --git a/configure.ac b/configure.ac index 4743a1f0..639b8541 100644 --- a/configure.ac +++ b/configure.ac @@ -473,7 +473,7 @@ int main(void) dnl Checks for functions. -AC_CHECK_FUNCS(getdelim getline isblank snprintf vsnprintf) +AC_CHECK_FUNCS(isblank snprintf vsnprintf) if test "x$enable_utf8" != xno; then AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth) diff --git a/src/nano.h b/src/nano.h index 2a315296..82bb264c 100644 --- a/src/nano.h +++ b/src/nano.h @@ -137,12 +137,6 @@ #ifndef HAVE_ISWBLANK #define iswblank niswblank #endif -#ifndef HAVE_GETDELIM -#define getdelim ngetdelim -#endif -#ifndef HAVE_GETLINE -#define getline ngetline -#endif /* If we aren't using ncurses with mouse support, turn the mouse support * off, as it's useless then. */ diff --git a/src/proto.h b/src/proto.h index 302d8180..2891c865 100644 --- a/src/proto.h +++ b/src/proto.h @@ -652,14 +652,6 @@ void snuggly_fit(char **str); void null_at(char **data, size_t index); void unsunder(char *str, size_t true_len); void sunder(char *str); -#if !defined(NANO_TINY) && !defined(DISABLE_NANORC) -#ifndef HAVE_GETLINE -ssize_t ngetline(char **lineptr, size_t *n, FILE *stream); -#endif -#ifndef HAVE_GETDELIM -ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream); -#endif -#endif #ifdef HAVE_REGEX_H const char *fixbounds(const char *r); #endif diff --git a/src/utils.c b/src/utils.c index a3fb0513..136d7d61 100644 --- a/src/utils.c +++ b/src/utils.c @@ -170,93 +170,6 @@ void sunder(char *str) } } -/* These functions, ngetline() (originally getline()) and ngetdelim() - * (originally getdelim()), were adapted from GNU mailutils 0.5 - * (mailbox/getline.c). Here is the notice from that file, after - * converting to the GPL via LGPL clause 3, and with the Free Software - * Foundation's address and the copyright years updated: - * - * GNU Mailutils -- a suite of utilities for electronic mail - * Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007 - * Free Software Foundation, Inc. - * - * This library 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. - * - * This library 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 this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. */ - -#ifndef DISABLE_NANORC - -#ifndef HAVE_GETDELIM -/* This function is equivalent to getdelim(). */ -ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream) -{ - size_t indx = 0; - int c; - - /* Sanity checks. */ - if (lineptr == NULL || n == NULL || stream == NULL || - fileno(stream) == -1) { - errno = EINVAL; - return -1; - } - - /* Allocate the line the first time. */ - if (*lineptr == NULL) { - *n = MAX_BUF_SIZE; - *lineptr = charalloc(*n); - } - - while ((c = getc(stream)) != EOF) { - /* Check if more memory is needed. */ - if (indx >= *n) { - *n += MAX_BUF_SIZE; - *lineptr = charealloc(*lineptr, *n); - } - - /* Put the result in the line. */ - (*lineptr)[indx++] = (char)c; - - /* Bail out. */ - if (c == delim) - break; - } - - /* Make room for the null character. */ - if (indx >= *n) { - *n += MAX_BUF_SIZE; - *lineptr = charealloc(*lineptr, *n); - } - - /* Null-terminate the buffer. */ - null_at(lineptr, indx++); - *n = indx; - - /* The last line may not have the delimiter. We have to return what - * we got, and the error will be seen on the next iteration. */ - return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1; -} -#endif - -#ifndef HAVE_GETLINE -/* This function is equivalent to getline(). */ -ssize_t ngetline(char **lineptr, size_t *n, FILE *stream) -{ - return getdelim(lineptr, n, '\n', stream); -} -#endif -#endif /* !DISABLE_NANORC */ - #ifdef HAVE_REGEX_H /* Fix the regex if we're on platforms which require an adjustment * from GNU-style to BSD-style word boundaries. */