Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libc / gen / getusershell.3
1 .\"     $NetBSD: getusershell.3,v 1.6 1999/03/22 19:44:42 garbled Exp $
2 .\"     $FreeBSD: src/lib/libc/gen/getusershell.3,v 1.5.2.4 2003/03/13 18:05:37 trhodes Exp $
3 .\"
4 .\" Copyright (c) 1985, 1991, 1993
5 .\"     The Regents of the University of California.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)getusershell.3      8.1 (Berkeley) 6/4/93
36 .\" $FreeBSD: src/lib/libc/gen/getusershell.3,v 1.5.2.4 2003/03/13 18:05:37 trhodes Exp $
37 .\"
38 .Dd June 4, 1993
39 .Dt GETUSERSHELL 3
40 .Os
41 .Sh NAME
42 .Nm getusershell ,
43 .Nm setusershell ,
44 .Nm endusershell
45 .Nd get legal user shells
46 .Sh LIBRARY
47 .Lb libc
48 .Sh SYNOPSIS
49 .In unistd.h
50 .Ft char *
51 .Fn getusershell void
52 .Ft void
53 .Fn setusershell void
54 .Ft void
55 .Fn endusershell void
56 .Sh DESCRIPTION
57 The
58 .Fn getusershell
59 function
60 returns a pointer to a valid user shell as defined by the
61 system manager in the shells database as described in
62 .Xr shells 5 .
63 If the shells database is not available,
64 .Fn getusershell
65 behaves as if
66 .Pa /bin/sh
67 and
68 .Pa /bin/csh
69 were listed.
70 .Pp
71 The
72 .Fn getusershell
73 function
74 reads the next
75 line (opening the file if necessary);
76 .Fn setusershell
77 rewinds the file;
78 .Fn endusershell
79 closes it.
80 .Sh FILES
81 .Bl -tag -width /etc/shells -compact
82 .It Pa /etc/shells
83 .El
84 .Sh DIAGNOSTICS
85 The routine
86 .Fn getusershell
87 returns a null pointer (0) on
88 .Dv EOF .
89 .Sh SEE ALSO
90 .Xr shells 5
91 .Sh HISTORY
92 The
93 .Fn getusershell
94 function appeared in
95 .Bx 4.3 .
96 .Sh BUGS
97 The
98 .Fn getusershell
99 function leaves its result in an internal static object and returns
100 a pointer to that object.
101 Subsequent calls to
102 .Fn getusershell
103 will modify the same object.