bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-inetutils] Re: ftp: command processing


From: Simon Josefsson
Subject: [bug-inetutils] Re: ftp: command processing
Date: Wed, 15 Aug 2007 13:06:12 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

"Debarshi 'Rishi' Ray" <address@hidden> writes:

>> Have you considered using getline instead of fgets?
>
> In fact I had not, but now that I look I find:
>
> 1. According to the online manual page, getline is a GNU extension
> available since libc 4.6.27. Since we will be mostly using it on
> non-readline (possibly non-GNU too) systems, would it be a good idea
> to use it instead of fgets which conforms to C89 and C99? Yes, we do
> have gnulib, but even then.
>
> 2. getline resizes the buffer if it is insufficient to hold the data.
> Currently in non-readline cases we read the data into a statically
> allocated array, and trying to resize it will lead to problems.
> Of-course we can change to using 'char *line' for non-readline cases
> too, but that will require a number of changes all throughout the
> code. Do we want to have those changes in this patch?

Good points.  My concern is the MAXLINE limit, it seems it would
restrict how long file names the tool can handle?

However, I just remembered that there is a readline module in gnulib
(which, incidentally, uses getline).  Wouldn't using that module
simplify your code a lot?  Then you can forget about the non-readline
situation, and let gnulib take care of that.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]