summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/libc/gen/common/getusershell.c
diff options
context:
space:
mode:
authormuffin <none@none>2005-10-20 11:47:44 -0700
committermuffin <none@none>2005-10-20 11:47:44 -0700
commit5d54f3d8999eac1762fe0a8c7177d20f1f201fae (patch)
tree65c7761c305dbd97609e64517f5781b433efa980 /usr/src/lib/libbc/libc/gen/common/getusershell.c
parent1b42782e10f177b2bd092559506a96dbbefefa54 (diff)
downloadillumos-gate-5d54f3d8999eac1762fe0a8c7177d20f1f201fae.tar.gz
6309237 gcc and libbc don't get along
Diffstat (limited to 'usr/src/lib/libbc/libc/gen/common/getusershell.c')
-rw-r--r--usr/src/lib/libbc/libc/gen/common/getusershell.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/usr/src/lib/libbc/libc/gen/common/getusershell.c b/usr/src/lib/libbc/libc/gen/common/getusershell.c
index f03c328a8d..f164bea8e4 100644
--- a/usr/src/lib/libbc/libc/gen/common/getusershell.c
+++ b/usr/src/lib/libbc/libc/gen/common/getusershell.c
@@ -1,16 +1,17 @@
-#pragma ident "%Z%%M% %I% %E% SMI"
- /* from UCB 5.4 7/25/86 */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
+#pragma ident "%Z%%M% %I% %E% SMI"
+
#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
+#include <malloc.h>
#define SHELLS "/etc/shells"
@@ -22,13 +23,14 @@ static char *okshells[] =
static char **shells, *strings;
static char **curshell;
-extern char **initshells();
+
+static char **initshells(void);
/*
* Get a list of shells from SHELLS, if it exists.
*/
char *
-getusershell()
+getusershell(void)
{
char *ret;
@@ -40,7 +42,8 @@ getusershell()
return (ret);
}
-endusershell()
+void
+endusershell(void)
{
if (shells != NULL)
@@ -52,19 +55,19 @@ endusershell()
curshell = NULL;
}
-setusershell()
+void
+setusershell(void)
{
curshell = initshells();
}
static char **
-initshells()
+initshells(void)
{
- register char **sp, *cp;
- register FILE *fp;
+ char **sp, *cp;
+ FILE *fp;
struct stat statb;
- extern char *malloc(), *calloc();
if (shells != NULL)
free((char *)shells);
@@ -73,21 +76,21 @@ initshells()
free(strings);
strings = NULL;
if ((fp = fopen(SHELLS, "r")) == (FILE *)0)
- return(okshells);
+ return (okshells);
if (fstat(fileno(fp), &statb) == -1) {
(void)fclose(fp);
- return(okshells);
+ return (okshells);
}
if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) {
(void)fclose(fp);
- return(okshells);
+ return (okshells);
}
shells = (char **)calloc((unsigned)statb.st_size / 3, sizeof (char *));
if (shells == NULL) {
(void)fclose(fp);
free(strings);
strings = NULL;
- return(okshells);
+ return (okshells);
}
sp = shells;
cp = strings;