"Debarshi 'Rishi' Ray" <[EMAIL PROTECTED]> 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 _______________________________________________ bug-inetutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-inetutils
