Subject: getline and _GNU_SORCE

From: Jakson Aquino <[email-masked]>
Date: Sun, 14 Aug 2005 09:11:45 -0300

Hi,

I'm trying to avoid the use of the option "rlen". The 
buffer size for reading lines will be dynamically 
determined by GNU extension to libc, the function 
getline. However, I have to add #define _GNU_SOURCE 
before #include <stdio.h>. Will this cause any 
problem?

Anyway, I will create a substitute getline() for MinGW, 
and CygWin which don't have GNU getline. Under 
Windows, statist will be able to read at most a fixed 
amount of bytes (50000) from a line. Under Linux, 
there will be no limit, and no need of the "rlen" 
option. The invocation of Statist becomes simpler, and 
the help on the usage of --xcols and --xsample becomes 
less verbose.

Best,

Jakson

		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. 
Instale o discador agora! http://br.acesso.yahoo.com/

---

From: Bernhard Reiter <[email-masked]>
Date: Mon, 15 Aug 2005 13:19:30 +0200

Am 14. Aug 2005 um 09:11:45 schrieb Jakson Aquino:
> I'm trying to avoid the use of the option "rlen". 

Good idea, it is always best to have this dynamically.

> The buffer size for reading lines will be dynamically 
> before #include <stdio.h>. Will this cause any problem?

In general I would hope to conform to C-standards
for a simple application like statist.

> and CygWin which don't have GNU getline. 

If you do this anyway, why not use this routine by default,
this would avoid the _GNU_SOURCE extensions.

	Bernhard

---

From: Jakson Aquino <[email-masked]>
Date: Mon, 15 Aug 2005 22:00:45 -0300

Hi Bernhard,

Em Monday 15 August 2005 08:19, Bernhard Reiter
> this would avoid the _GNU_SOURCE extensions.

The substitute getline function wasn't allocating
memory dynamically.

But now it is. I included into data.c the function
getndelim2() from gnucoreutil/lib/getndelim2.c with
some changes and added the following commentary above
the function:

/* Adapted from GNU coretutils 5.2.1 getndelim2.c */
int getline(char **lineptr, int *linesize, FILE *F){

Can I use the function, and is the above commentary
enough? (I already commited the changes into cvs.)

Best,

Jakson

---

From: Bernhard Reiter <[email-masked]>
Date: Tue, 16 Aug 2005 16:45:22 +0200

Hi Jakson,

> Can I use the function, 

yes, the licences seem to be compatible.

> and is the above commentary

Yes, but you might want to add it to the copyright statement of data.c
and the readme, so it is properly documented.

Best,
	Bernhard