aboutsummaryrefslogtreecommitdiff
path: root/misc/getusershell.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-09 19:30:57 +0000
committerRoland McGrath <roland@gnu.org>1996-05-09 19:30:57 +0000
commit05d4c982198805983d6d7a39b08b1d75eac79387 (patch)
tree3ea219f6741c13e194718865051989f81cbea3d9 /misc/getusershell.c
parent3e2632b62d7633b44458d023b32706229e58a31c (diff)
downloadglibc-05d4c982198805983d6d7a39b08b1d75eac79387.tar
glibc-05d4c982198805983d6d7a39b08b1d75eac79387.tar.gz
glibc-05d4c982198805983d6d7a39b08b1d75eac79387.tar.bz2
glibc-05d4c982198805983d6d7a39b08b1d75eac79387.zip
* Makerules (versioned): Strip whitespace.
* Rules (static-only-routines rule): Remove spurious space in dep. * misc/getusershell.c: Undo changes of 7 May 96 (rev 1.6). Cast string constants to char *. * posix/glob/SMakefile, posix/glob/SCOPTIONS, posix/glob/Makefile.ami: New files, AmigaDOS support from Aaron Digulla. * posix/Makefile (glob.tar): Add AmigaDOS support files.
Diffstat (limited to 'misc/getusershell.c')
-rw-r--r--misc/getusershell.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 3816e1e784..6b210b68ff 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -49,9 +49,10 @@ static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
* /etc/shells.
*/
-static const char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
-static const char **curshell, **shells, *strings;
-static const char **initshells __P((void));
+static char *okshells[] = { (char *) _PATH_BSHELL, (char *) _PATH_CSHELL,
+ NULL };
+static char **curshell, **shells, *strings;
+static char **initshells __P((void));
/*
* Get a list of shells from _PATH_SHELLS, if it exists.
@@ -59,20 +60,20 @@ static const char **initshells __P((void));
char *
getusershell()
{
- const char *ret;
+ char *ret;
if (curshell == NULL)
curshell = initshells();
ret = *curshell;
if (ret != NULL)
curshell++;
- return (char *) ret; /* Cast away `const' for history reasons. */
+ return (ret);
}
void
endusershell()
{
-
+
if (shells != NULL)
free(shells);
shells = NULL;
@@ -89,7 +90,7 @@ setusershell()
curshell = initshells();
}
-static const char **
+static char **
initshells()
{
register char **sp, *cp;
@@ -97,10 +98,10 @@ initshells()
struct stat statb;
if (shells != NULL)
- free((char *) shells);
+ free(shells);
shells = NULL;
if (strings != NULL)
- free((char *) strings);
+ free(strings);
strings = NULL;
if ((fp = fopen(_PATH_SHELLS, "r")) == NULL)
return (okshells);
@@ -119,8 +120,8 @@ initshells()
strings = NULL;
return (okshells);
}
- sp = (char *) shells;
- cp = (char *) strings;
+ sp = shells;
+ cp = strings;
while (fgets(cp, statb.st_size - (cp - strings), fp) != NULL) {
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;