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 |
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 */ |
37/* $NetBSD: getusershell.c,v 1.17 1999/01/25 01:09:34 lukem Exp $ */ |
38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/lib/libc/gen/getusershell.c 90045 2002-02-01 01:32:19Z obrien $"); |
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 |
72static const char *const *initshells(void); |
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 |
108static int _local_initshells(void *, void *, va_list); |
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 |
145static int _dns_initshells(void *, void *, va_list); |
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 |
189static int _nis_initshells(void *, void *, va_list); |
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 --- |