getline.c revision 189136
1149144Sphk/*- 2149144Sphk * Copyright (c) 2009 David Schultz <das@FreeBSD.org> 3149144Sphk * All rights reserved. 4149144Sphk * 5149144Sphk * Redistribution and use in source and binary forms, with or without 6149144Sphk * modification, are permitted provided that the following conditions 7149144Sphk * are met: 8149144Sphk * 1. Redistributions of source code must retain the above copyright 9149144Sphk * notice, this list of conditions and the following disclaimer. 10149144Sphk * 2. Redistributions in binary form must reproduce the above copyright 11149144Sphk * notice, this list of conditions and the following disclaimer in the 12149144Sphk * documentation and/or other materials provided with the distribution. 13149144Sphk * 14149144Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15149144Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16149144Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17149144Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18149144Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19149144Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20149144Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21149144Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22149144Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23149144Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24149144Sphk * SUCH DAMAGE. 25149144Sphk */ 26149144Sphk 27149144Sphk#include <sys/cdefs.h> 28149144Sphk__FBSDID("$FreeBSD: head/lib/libc/stdio/getline.c 189136 2009-02-28 06:00:58Z das $"); 29149144Sphk 30149144Sphk#define _WITH_GETLINE 31149144Sphk#include <stdio.h> 32149144Sphk 33149144Sphkssize_t 34149144Sphkgetline(char ** __restrict linep, size_t * __restrict linecapp, 35149144Sphk FILE * __restrict fp) 36149144Sphk{ 37149144Sphk 38149144Sphk return (getdelim(linep, linecapp, '\n', fp)); 39149144Sphk} 40150342Sphk