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