Re: Alternative for getline() function in AIX 5.3

2010-07-28 Thread Nadav Har'El
On Wed, Jul 28, 2010, Etzion Bar-Noy wrote about Re: Alternative for getline() function in AIX 5.3: IBM supply a set of GNU utilities, including GCC-related software (and GCC, as well, if I recall correctly, but an old one) in an additional CD supplied with AIX. This is called something around

Alternative for getline() function in AIX 5.3

2010-07-27 Thread Israel Shikler
Hi, I have a C program that reads one line of text from the keyboard. The original program was written 10 years ago and was compiled with cc on AIX 4.x. I used the gets() function which was the only option available at the time. Recently, I had to port the program to gcc on Linux, but I was

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Nadav Har'El
On Tue, Jul 27, 2010, Israel Shikler wrote about Alternative for getline() function in AIX 5.3: I am looking for an alternative to getline(), that would be portable to both Linux and AIX. The first obvious alternative is to use fgets(). fgets(), unlike gets(), is secure because you give

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Shlomi Fish
On Tuesday 27 Jul 2010 13:15:13 Israel Shikler wrote: Hi, I have a C program that reads one line of text from the keyboard. The original program was written 10 years ago and was compiled with cc on AIX 4.x. I used the gets() function which was the only option available at the time.

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Omer Zak
On Tue, 2010-07-27 at 14:02 +0300, Nadav Har'El wrote: On Tue, Jul 27, 2010, Israel Shikler wrote about Alternative for getline() function in AIX 5.3: I am looking for an alternative to getline(), that would be portable to both Linux and AIX. [... snipped ...] The second alternative

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Oleg Goldshmidt
Nadav Har'El n...@math.technion.ac.il writes: The second alternative is to make use of the wonderful fact that Linux is free software, and just take the source code of getline() and incorporate it in your program! I can't imagine that getline() is more than a couple of dozen lines - it's not

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Oleg Goldshmidt
Omer Zak w...@zak.co.il writes: #ifdef __GNUC__ // use getline() #else /* __GNUC__ */ // use gets() or fgets() #endif /* __GNUC__ */ I am not sure what you meant here, Omer, but IIRC __GNUC__ means gcc-specific code, and the OP does not have gcc on AIX. I am probably missing

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Omer Zak
What I mean is to use whatever preprocessor symbol that is defined when building using gcc, but undefined on AIX; or vice versa. On Tue, 2010-07-27 at 21:53 +0300, Oleg Goldshmidt wrote: Omer Zak w...@zak.co.il writes: #ifdef __GNUC__ // use getline() #else /* __GNUC__ */ // use

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Oleg Goldshmidt
Omer Zak w...@zak.co.il writes: What I mean is to use whatever preprocessor symbol that is defined when building using gcc, but undefined on AIX; or vice versa. I see. I suspect you may need both __GNUC__ and _GNU_SOURCE to be defined for getline() to work in the context though: the first will

Re: Alternative for getline() function in AIX 5.3

2010-07-27 Thread Etzion Bar-Noy
IBM supply a set of GNU utilities, including GCC-related software (and GCC, as well, if I recall correctly, but an old one) in an additional CD supplied with AIX. This is called something around Utilities for Linux or some other lie. So you do not need to force gcc to compile under AIX, but only