Deleted Added
full compact
getusershell.c (90030) getusershell.c (90045)
1/* $NetBSD: getusershell.c,v 1.17 1999/01/25 01:09:34 lukem Exp $ */
2
3/*
4 * Copyright (c) 1985, 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

--- 17 unchanged lines hidden (view full) ---

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
1/*
2 * Copyright (c) 1985, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
36#if 0
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
40#endif
37/* $NetBSD: getusershell.c,v 1.17 1999/01/25 01:09:34 lukem Exp $ */
41#include <sys/cdefs.h>
38#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/lib/libc/gen/getusershell.c 90030 2002-01-31 17:26:37Z obrien $");
39__FBSDID("$FreeBSD: head/lib/libc/gen/getusershell.c 90045 2002-02-01 01:32:19Z obrien $");
43
44#include <sys/param.h>
45#include <sys/file.h>
46
47#include <ctype.h>
48#include <errno.h>
49#include <nsswitch.h>
50#include <paths.h>

--- 16 unchanged lines hidden (view full) ---

67 * Local shells should NOT be added here. They should be added in
68 * /etc/shells.
69 */
70
71static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
72static const char *const *curshell;
73static StringList *sl;
74
40
41#include <sys/param.h>
42#include <sys/file.h>
43
44#include <ctype.h>
45#include <errno.h>
46#include <nsswitch.h>
47#include <paths.h>

--- 16 unchanged lines hidden (view full) ---

64 * Local shells should NOT be added here. They should be added in
65 * /etc/shells.
66 */
67
68static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
69static const char *const *curshell;
70static StringList *sl;
71
75static const char *const *initshells __P((void));
72static const char *const *initshells(void);
76
77/*
78 * Get a list of shells from "shells" nsswitch database
79 */
80char *
81getusershell(void)
82{
83 char *ret;

--- 19 unchanged lines hidden (view full) ---

103void
104setusershell(void)
105{
106
107 curshell = initshells();
108}
109
110
73
74/*
75 * Get a list of shells from "shells" nsswitch database
76 */
77char *
78getusershell(void)
79{
80 char *ret;

--- 19 unchanged lines hidden (view full) ---

100void
101setusershell(void)
102{
103
104 curshell = initshells();
105}
106
107
111static int _local_initshells __P((void *, void *, va_list));
108static int _local_initshells(void *, void *, va_list);
112
113/*ARGSUSED*/
114static int
115_local_initshells(rv, cb_data, ap)
116 void *rv;
117 void *cb_data;
118 va_list ap;
119{

--- 20 unchanged lines hidden (view full) ---

140 *cp++ = '\0';
141 sl_add(sl, strdup(sp));
142 }
143 (void)fclose(fp);
144 return NS_SUCCESS;
145}
146
147#ifdef HESIOD
109
110/*ARGSUSED*/
111static int
112_local_initshells(rv, cb_data, ap)
113 void *rv;
114 void *cb_data;
115 va_list ap;
116{

--- 20 unchanged lines hidden (view full) ---

137 *cp++ = '\0';
138 sl_add(sl, strdup(sp));
139 }
140 (void)fclose(fp);
141 return NS_SUCCESS;
142}
143
144#ifdef HESIOD
148static int _dns_initshells __P((void *, void *, va_list));
145static int _dns_initshells(void *, void *, va_list);
149
150/*ARGSUSED*/
151static int
152_dns_initshells(rv, cb_data, ap)
153 void *rv;
154 void *cb_data;
155 va_list ap;
156{

--- 27 unchanged lines hidden (view full) ---

184 }
185 }
186 hesiod_end(context);
187 return (r);
188}
189#endif /* HESIOD */
190
191#ifdef YP
146
147/*ARGSUSED*/
148static int
149_dns_initshells(rv, cb_data, ap)
150 void *rv;
151 void *cb_data;
152 va_list ap;
153{

--- 27 unchanged lines hidden (view full) ---

181 }
182 }
183 hesiod_end(context);
184 return (r);
185}
186#endif /* HESIOD */
187
188#ifdef YP
192static int _nis_initshells __P((void *, void *, va_list));
189static int _nis_initshells(void *, void *, va_list);
193
194/*ARGSUSED*/
195static int
196_nis_initshells(rv, cb_data, ap)
197 void *rv;
198 void *cb_data;
199 va_list ap;
200{

--- 80 unchanged lines hidden ---
190
191/*ARGSUSED*/
192static int
193_nis_initshells(rv, cb_data, ap)
194 void *rv;
195 void *cb_data;
196 va_list ap;
197{

--- 80 unchanged lines hidden ---