-setglent() {
- if (glp == NULL)
- glp = fopen(GLDRS, "r");
- else
- rewind(glp);
-
- return (glp != NULL);
-}
-
-
-endglent() {
- if (glp != NULL) {
- fclose(glp);
- glp = NULL;
- }
-
- return 1;
-}
-
-struct grpldr *getglent() {
- register char *cp, **q;
-
- if (glp == NULL && !setglent())
- return NULL;
- if ((cp = fgets(line, BUFSIZ, glp)) == NULL)
- return NULL;
-
- grpldr.gl_name = cp;
- grpldr.gl_ldr = q = gl_ldr;
-
- while (*cp) {
- while (*cp && !isspace(*cp))
- cp++;
- while (*cp && isspace(*cp))
- *cp++ = '\0';
- if (*cp == '\0')
- break;
- if (q < gl_ldr + MAXGLS)
- *q++ = cp;
- else
- break;
- }
- *q = NULL;
-
- return (&grpldr);
-}
-
-struct grpldr *getglnam(name)
-char *name;
-{
- register struct grpldr *gl = NULL;
-
- setglent();
- while (gl = getglent())
- if (strcmp(name, gl->gl_name) == 0)
- break;
- endglent();
-
- return gl;
-}
-
-ldr_names() {
- register int gp, hit = 0;
- char *gldrs[NGRPS];
- register struct grpldr *gl;
-
- gldrs[0] = NULL;
- setglent();
- while (gl = getglent()) {
- if (getgrnam(gl->gl_name) == NULL) {
- setup();
- fprintf(out, "unknown group %s in group leaders file\n",
- gl->gl_name);
- hit++;
- }
- for (gp = 0; gldrs[gp]; gp++)
- if (strcmp(gldrs[gp], gl->gl_name) == 0) {
- setup();
- fprintf(out, "duplicate group %s in group leaders file\n", gl->gl_name);
- hit++;
- break;
- }
- if (gldrs[gp] == NULL)
- if (gp < NGRPS) {
- gldrs[gp++] = getcpy(gl->gl_name);
- gldrs[gp] = NULL;
- } else {
- setup();
- fprintf(out, "more than %d groups in group leaders file (time to recompile)\n", NGRPS - 1);
- hit++;
- }
- }
- endglent();
-
- for (gp = 0; gldrs[gp]; gp++)
- free(gldrs[gp]);
-
- if (!hit && out && !mail)
- fprintf(out, "all groups in group leaders file accounted for\n");
-}
-
-
-ldr_ship() {
- register int hit = 0;
- register char **cp, **dp;
- register struct grpldr *gl;
-
- setglent();
- while (gl = getglent())
- for (cp = gl->gl_ldr; *cp; cp++) {
- if (!check(*cp)) {
- setup();
- fprintf(out, "group %s has unknown leader %s\n", gl->gl_name, *cp);
- hit++;