xref: /dflybsd-src/lib/libc/stdio/getline.c (revision e0f95098eeba0176864b9cafe6d69b5b7bc0e73f)
1*e0f95098SPeter Avalos /*-
2*e0f95098SPeter Avalos  * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
3*e0f95098SPeter Avalos  * All rights reserved.
4*e0f95098SPeter Avalos  *
5*e0f95098SPeter Avalos  * Redistribution and use in source and binary forms, with or without
6*e0f95098SPeter Avalos  * modification, are permitted provided that the following conditions
7*e0f95098SPeter Avalos  * are met:
8*e0f95098SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
9*e0f95098SPeter Avalos  *    notice, this list of conditions and the following disclaimer.
10*e0f95098SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
11*e0f95098SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
12*e0f95098SPeter Avalos  *    documentation and/or other materials provided with the distribution.
13*e0f95098SPeter Avalos  *
14*e0f95098SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*e0f95098SPeter Avalos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*e0f95098SPeter Avalos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*e0f95098SPeter Avalos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*e0f95098SPeter Avalos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*e0f95098SPeter Avalos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*e0f95098SPeter Avalos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*e0f95098SPeter Avalos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*e0f95098SPeter Avalos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*e0f95098SPeter Avalos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*e0f95098SPeter Avalos  * SUCH DAMAGE.
25*e0f95098SPeter Avalos  *
26*e0f95098SPeter Avalos  * $FreeBSD: src/lib/libc/stdio/getline.c,v 1.1 2009/02/28 06:00:58 das Exp $
27*e0f95098SPeter Avalos  */
28*e0f95098SPeter Avalos 
29*e0f95098SPeter Avalos #define	_WITH_GETLINE
30*e0f95098SPeter Avalos #include <stdio.h>
31*e0f95098SPeter Avalos 
32*e0f95098SPeter Avalos ssize_t
33*e0f95098SPeter Avalos getline(char ** __restrict linep, size_t * __restrict linecapp,
34*e0f95098SPeter Avalos 	FILE * __restrict fp)
35*e0f95098SPeter Avalos {
36*e0f95098SPeter Avalos 	return (getdelim(linep, linecapp, '\n', fp));
37*e0f95098SPeter Avalos }
38