1 /* getusershell.c: minimal implementation of the getusershell() and
2 endusershell() library routines for systems that don't have them.
4 %%% portions-copyright-cmetz
5 Portions of this software are Copyright 1996 by Craig Metz, All Rights
6 Reserved. The Inner Net License Version 2 applies to these portions of
8 You should have received a copy of the license with this software. If
9 you didn't get a copy, you may request one from <license@inner.net>.
11 Portions of this software are Copyright 1995 by Randall Atkinson and Dan
12 McDonald, All Rights Reserved. All Rights under this copyright are assigned
13 to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
14 License Agreement applies to this software.
18 Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
19 Modified at NRL for OPIE 2.1. Remove trailing newlines from
20 /etc/shells entries. Fixed infinite loop. Fixed a bug
21 where second invocation on would fail.
22 Written at NRL for OPIE 2.0.
28 #endif /* HAVE_STRING_H */
31 static FILE *fh
= NULL
;
32 static char *internal
[] = {"/bin/sh", "/bin/csh", NULL
};
34 static char buffer
[1024];
36 char *getusershell FUNCTION_NOARGS
41 fh
= fopen("/etc/shells", "r");
44 if (fgets(buffer
, sizeof(buffer
), fh
)) {
45 if (c
= strchr(buffer
, '\n'))
60 VOIDRET endusershell FUNCTION_NOARGS