reindent-20030715
[openafs.git] / src / ftpd43+ / getusershell.c
index d70afb7..ca0a01d 100644 (file)
@@ -27,8 +27,7 @@
 /*
  * Do not add local shells here.  They should be added in /etc/shells
  */
-static char *okshells[] =
-    { "/bin/sh", "/bin/csh", 0 };
+static char *okshells[] = { "/bin/sh", "/bin/csh", 0 };
 
 static char **shells, *strings;
 static char **curshell = NULL;
@@ -40,14 +39,14 @@ static char **initshells();
 char *
 getusershell()
 {
-       char *ret;
+    char *ret;
 
-       if (curshell == NULL)
-               curshell = initshells();
-       ret = *curshell;
-       if (ret != NULL)
-               curshell++;
-       return (ret);
+    if (curshell == NULL)
+       curshell = initshells();
+    ret = *curshell;
+    if (ret != NULL)
+       curshell++;
+    return (ret);
 }
 
 #ifdef AFS_AIX42_ENV
@@ -55,62 +54,62 @@ void
 #endif
 endusershell()
 {
-       
-       if (shells != NULL)
-               free((char *)shells);
-       shells = NULL;
-       if (strings != NULL)
-               free(strings);
-       strings = NULL;
-       curshell = NULL;
+
+    if (shells != NULL)
+       free((char *)shells);
+    shells = NULL;
+    if (strings != NULL)
+       free(strings);
+    strings = NULL;
+    curshell = NULL;
 }
 
 static char **
 initshells()
 {
-       register char **sp, *cp;
-       register FILE *fp;
-       struct stat statb;
-       extern char *malloc(), *calloc();
-
-       if (shells != NULL)
-               free((char *)shells);
-       shells = NULL;
-       if (strings != NULL)
-               free(strings);
-       strings = NULL;
-       if ((fp = fopen(SHELLS, "r")) == (FILE *)0)
-               return(okshells);
-       if (fstat(fileno(fp), &statb) == -1) {
-               (void)fclose(fp);
-               return(okshells);
-       }
-       if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
-               (void)fclose(fp);
-               return(okshells);
-       }
-       shells = (char **)calloc((unsigned)statb.st_size / 3, sizeof (char *));
-       if (shells == NULL) {
-               (void)fclose(fp);
-               free(strings);
-               strings = NULL;
-               return(okshells);
-       }
-       sp = shells;
-       cp = strings;
-       while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
-               while (*cp != '#' && *cp != '/' && *cp != '\0')
-                       cp++;
-               if (*cp == '#' || *cp == '\0')
-                       continue;
-               *sp++ = cp;
-               while (!isspace(*cp) && *cp != '#' && *cp != '\0')
-                       cp++;
-               *cp++ = '\0';
-       }
-       *sp = NULL;
+    register char **sp, *cp;
+    register FILE *fp;
+    struct stat statb;
+    extern char *malloc(), *calloc();
+
+    if (shells != NULL)
+       free((char *)shells);
+    shells = NULL;
+    if (strings != NULL)
+       free(strings);
+    strings = NULL;
+    if ((fp = fopen(SHELLS, "r")) == (FILE *) 0)
+       return (okshells);
+    if (fstat(fileno(fp), &statb) == -1) {
+       (void)fclose(fp);
+       return (okshells);
+    }
+    if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
        (void)fclose(fp);
-       return (shells);
+       return (okshells);
+    }
+    shells = (char **)calloc((unsigned)statb.st_size / 3, sizeof(char *));
+    if (shells == NULL) {
+       (void)fclose(fp);
+       free(strings);
+       strings = NULL;
+       return (okshells);
+    }
+    sp = shells;
+    cp = strings;
+    while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
+       while (*cp != '#' && *cp != '/' && *cp != '\0')
+           cp++;
+       if (*cp == '#' || *cp == '\0')
+           continue;
+       *sp++ = cp;
+       while (!isspace(*cp) && *cp != '#' && *cp != '\0')
+           cp++;
+       *cp++ = '\0';
+    }
+    *sp = NULL;
+    (void)fclose(fp);
+    return (shells);
 }
 
 #ifdef AFS_AIX42_ENV
@@ -119,11 +118,5 @@ void
 setusershell()
 {
 
-       curshell = initshells();
+    curshell = initshells();
 }
-
-
-
-
-
-