xref: /minix3/lib/libc/stdio/getline.c (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras /* $NetBSD: getline.c,v 1.3 2009/12/02 08:46:33 roy Exp $ */
2*2fe8fb19SBen Gras 
3*2fe8fb19SBen Gras /*
4*2fe8fb19SBen Gras  * Copyright (c) 2009 The NetBSD Foundation, Inc.
5*2fe8fb19SBen Gras  *
6*2fe8fb19SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
7*2fe8fb19SBen Gras  * by Roy Marples.
8*2fe8fb19SBen Gras  *
9*2fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
10*2fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
11*2fe8fb19SBen Gras  * are met:
12*2fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
13*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
14*2fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
15*2fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
16*2fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
17*2fe8fb19SBen Gras  *
18*2fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19*2fe8fb19SBen Gras  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20*2fe8fb19SBen Gras  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21*2fe8fb19SBen Gras  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22*2fe8fb19SBen Gras  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23*2fe8fb19SBen Gras  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24*2fe8fb19SBen Gras  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25*2fe8fb19SBen Gras  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26*2fe8fb19SBen Gras  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27*2fe8fb19SBen Gras  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*2fe8fb19SBen Gras  */
29*2fe8fb19SBen Gras 
30*2fe8fb19SBen Gras #include <sys/cdefs.h>
31*2fe8fb19SBen Gras __RCSID("$NetBSD: getline.c,v 1.3 2009/12/02 08:46:33 roy Exp $");
32*2fe8fb19SBen Gras 
33*2fe8fb19SBen Gras #include "namespace.h"
34*2fe8fb19SBen Gras 
35*2fe8fb19SBen Gras #include <stdio.h>
36*2fe8fb19SBen Gras 
37*2fe8fb19SBen Gras #ifdef __weak_alias
__weak_alias(getline,_getline)38*2fe8fb19SBen Gras __weak_alias(getline, _getline)
39*2fe8fb19SBen Gras #endif
40*2fe8fb19SBen Gras 
41*2fe8fb19SBen Gras ssize_t
42*2fe8fb19SBen Gras getline(char **__restrict buf, size_t *__restrict buflen, FILE *__restrict fp)
43*2fe8fb19SBen Gras {
44*2fe8fb19SBen Gras 	return getdelim(buf, buflen, '\n', fp);
45*2fe8fb19SBen Gras }
46