xref: /titanic_41/usr/src/man/man3c/getusershell.3c (revision 3fb330b78c0911247d5eee86f7997a64a9a743e5)
te
Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
Copyright (c) 1985 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution.
Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
GETUSERSHELL 3C "Nov 1, 2007"
NAME
getusershell, setusershell, endusershell - get legal user shells
SYNOPSIS

#include <unistd.h>

char *getusershell(void);

void setusershell(void);

void endusershell(void);
DESCRIPTION

The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place:

/bin/bash /bin/csh
/bin/jsh /bin/ksh
/bin/ksh93 /bin/pfcsh
/bin/pfksh /bin/pfsh
/bin/sh /bin/tcsh
/bin/zsh /sbin/jsh
/sbin/pfsh /sbin/sh
/usr/bin/bash /usr/bin/csh
/usr/bin/jsh /usr/bin/ksh
/usr/bin/ksh93 /usr/bin/pfcsh
/usr/bin/pfksh /usr/bin/pfsh
/usr/bin/sh /usr/bin/tcsh
/usr/bin/zsh /usr/sfw/bin/zsh
/usr/xpg4/bin/sh

The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells.

The setusershell() function rewinds the file or the list.

The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells.

RETURN VALUES

The getusershell() function returns a null pointer on EOF.

BUGS

All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved.

NOTES

Restricted shells should not be listed in /etc/shells.