On Sep 12, 10:59 am, Friar Tuck <nos...@invalid.com> wrote:
> On 11 Sep 2007 at 23:30, Ben Pfaff wrote:
>
> > Friar Tuck <nos...@invalid.com> writes:
>
> >> I believe I have found a bug in Dr Sosman's getline_test program, which
> >> is one of the official newsgroup programs.
>
> > There is no such thing as an "official newsgroup program", at
> > least not in comp.lang.c
>
> Well, it's listed on the group website, so I'd say that's official.
What's the group website?
> >> (gdb) bt
> >> #0 0x4008febf in getdelim () from /lib/tls/libc.so.6
> >> #1 0x4008d844 in getline () from /lib/tls/libc.so.6
> >> #2 0x080486b2 in verify (file=0x804a008, st=0xbfffee70, special=0) at
> >> getline_test.c:44
> >> #3 0x0804891d in main () at getline_test.c:103
> >> (gdb) f 2
> >> #2 0x080486b2 in verify (file=0x804a008, st=0xbfffee70, special=0) at
> >> getline_test.c:44
> >> 44 buff = getline(file);
>
> > It seems very unlikely that Eric would have written his code to
> > call into the "getline" function in the GNU C library, which is
> > what this backtrace is showing. I think that you did not compile
> > and link the test program correctly.
>
> > GNU lib'c getline and Eric's getline evidently have different
> > interfaces, judging from the line of source code above.
>
> I don't believe there's a standard library function called getline.
There isn't. But there is a GNU version that is very popular among
POSIX platforms.
http://www.gnu.org/software/libc/man...ine-Input.html
> If
> there is, wouldn't it be better if Dr Sosman's version either had a
> different name, or followed the same interface?
Right. But there isn't a standard C function called getline(). There
is a popular one, so it still might be a good idea to change the name
a bit.