Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

standards/145517: POSIX getline() missing

9 views
Skip to first unread message

Rémi Denis-Courmont

unread,
Apr 8, 2010, 11:25:27 AM4/8/10
to freebsd-gn...@freebsd.org

>Number: 145517
>Category: standards
>Synopsis: POSIX getline() missing
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Apr 08 15:30:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Rémi Denis-Courmont
>Release: Not known
>Organization:
VideoLAN project
>Environment:
Not provided
>Description:
VLC media player compilation reportedly fails due to getline() not being defined.

Forwarded from https://trac.videolan.org/vlc/ticket/3503:

| gmake[4]: Entering directory `/usr/home/igor/vlc-1.1.0-pre1/src'
| CC config/libvlccore_la-dirs_xdg.lo
| config/dirs_xdg.c: In function 'config_GetTypeDir': config/dirs_xdg.c:141: | error: implicit declaration of function 'getline'
| FreeBSD have not getline().

getline() and getdelim() are specified by POSIX here:
http://www.opengroup.org/onlinepubs/9699919799/functions/getline.html
>How-To-Repeat:
C-compile the following test case:

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
char *line = NULL;
size_t linesize = 0;
ssize_t linelen;

while ((linelen = getline(&line, &linesize, stdin)) != -1)
fwrite(line, 1, linelen, stdout);

free(line);

if (ferror(stdin))
{
perror("Standard input");
return 1;
}
return 0;
}

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:

Andrey Chernov

unread,
Apr 8, 2010, 4:20:02 PM4/8/10
to freebsd-...@freebsd.org
The following reply was made to PR standards/145517; it has been noted by GNATS.

From: Andrey Chernov <ac...@nagual.pp.ru>
To: =?koi8-r?Q?R=E9mi?= Denis-Courmont <r...@videolan.org>
Cc: freebsd-gn...@FreeBSD.ORG
Subject: Re: standards/145517: POSIX getline() missing
Date: Fri, 9 Apr 2010 00:10:01 +0400

> http://www.opengroup.org/onlinepubs/9699919799/functions/getline.html
> >How-To-Repeat:
> C-compile the following test case:

man 3 getline
(in FreeBSD-current for sure)

--
http://ache.pp.ru/

David Schultz

unread,
Apr 9, 2010, 5:30:04 PM4/9/10
to freebsd-...@freebsd.org
The following reply was made to PR standards/145517; it has been noted by GNATS.

From: David Schultz <d...@FreeBSD.ORG>
To: RXmi Denis-Courmont <r...@videolan.org>
Cc: freebsd-gn...@FreeBSD.ORG
Subject: Re: standards/145517: POSIX getline() missing

Date: Fri, 9 Apr 2010 16:43:40 -0400

On Thu, Apr 08, 2010, RXmi Denis-Courmont wrote:
> VLC media player compilation reportedly fails due to getline() not being defined.

The relevant caveat here is the one described in the COMPATIBILITY
section of the manpage:

COMPATIBILITY
Many application writers used the name getline before the getline() func-
tion was introduced in IEEE Std 1003.1 ("POSIX.1"), so a prototype is not
provided by default in order to avoid compatibility problems. Applica-
tions that wish to use the getline() function described herein should
either request a strict IEEE Std 1003.1-2008 ("POSIX.1") environment by
defining the macro _POSIX_C_SOURCE to the value 200809 or greater, or by
defining the macro _WITH_GETLINE, prior to the inclusion of <stdio.h>.
For compatibility with GNU libc, defining either _BSD_SOURCE or
_GNU_SOURCE prior to the inclusion of <stdio.h> will also make getline()
available.

0 new messages