Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getusershell(3) [minix man page]

GETUSERSHELL(3) 					     Linux Programmer's Manual						   GETUSERSHELL(3)

NAME
getusershell, setusershell, endusershell - get permitted user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getusershell(), setusershell(), endusershell(): Since glibc 2.21: _DEFAULT_SOURCE In glibc 2.19 and 2.20: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) Up to and including glibc 2.19: _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) DESCRIPTION
The getusershell() function returns the next line from the file /etc/shells, opening the file if necessary. The line should contain the pathname of a valid user shell. If /etc/shells does not exist or is unreadable, getusershell() behaves as if /bin/sh and /bin/csh were listed in the file. The setusershell() function rewinds /etc/shells. The endusershell() function closes /etc/shells. RETURN VALUE
The getusershell() function returns NULL on end-of-file. FILES
/etc/shells ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +--------------------------------+---------------+-----------+ |Interface | Attribute | Value | +--------------------------------+---------------+-----------+ |getusershell(), setusershell(), | Thread safety | MT-Unsafe | |endusershell() | | | +--------------------------------+---------------+-----------+ CONFORMING TO
4.3BSD. SEE ALSO
shells(5) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2016-03-15 GETUSERSHELL(3)

Check Out this Related Man Page

getusershell(3) 					     Library Functions Manual						   getusershell(3)

NAME
getusershell, getusershell_r, setusershell, setusershell_r, endusershell, endusershell_r - Get the names of legal user shells LIBRARY
Standard C Library (libc.a) SYNOPSIS
char *getusershell(void); int setusershell(void); int endusershell(void); The following obsolete functions are supported in order to maintain backward compatibility with previous versions of the operating system. You should not use them in new designs. int getusershell_r( char *shell, int len unsigned int *state); int setusershell_r( unsigned int *state); int endusershell_r( unsigned int *state); PARAMETERS
Points to a buffer for the shell name. Specifies the length of the shell parameter. Points to a variable which stores information about the contents of the /etc/shells file. DESCRIPTION
The getusershell() function returns a pointer to a string that contains the name of a legal user shell as defined by the system manager in the /etc/shells file. If the /etc/shells file does not exist, the standard system shells are returned. On subsequent calls, the getusershell() function returns the next shell. The endusershell() function resets the list so that subsequent calls of getusershell() reread the list from /etc/shells. The setusershell() function rereads the list from /etc/shells and subsequent calls of getusershell() start from the beginning. NOTES
The getusershell() function returns a pointer to thread-specific data. Subsequent calls to the function from the same thread overwrite this data. The getusershell_r(), setusershell_r(), and endusershell_r() functions are obsolete reentrant versions of the getusershell(), setuser- shell(), and endusershell() functions. They are supported in order to maintain backward compatibility with previous versions of the oper- ating system and should not be used in new designs. Note that you must initialize the state parameter to 0 (zero) before its first access by any of these functions. RETURN VALUES
Upon successful completion, the getusershell() function returns a pointer to a character string. If it fails or reaches the end of the shell file, it returns a null pointer. Upon successful completion, the getusershell_r() function stores a pointer to the shell name in shell and returns a value of 0 (zero). Upon failure, it returns a value of -1 and places an appropriate value in the errno variable. Upon successful completion, the setusershell_r() function returns a value of 0 (zero). Upon failure, it returns a value of -1 and places an appropriate value in the errno variable. The endusershell_r() function always returns a value of 0 (zero). ERRORS
If any of the following conditions occurs, the getusershell_r() function sets errno to the corresponding value: Either the shell parameter is invalid, the len parameter is too small, or the state parameter is a null pointer. The end of the shell list has been reached (EOF). If the following condition occurs, the setusershell_r() function sets errno to the corresponding value: Unable to allocate memory for the reread list of shells. FILES
Contains the names of legal user shells. RELATED INFORMATION
Files: shells(4). delim off getusershell(3)
Man Page