ngrps = getgroups(pw->pw_gid, grps);
main(argc, argv)	int argc;	char **argv;{	extern int optind;	int ch;	struct iovec iov;	struct utmp utmp;	FILE *fp;	char *p, *ttymsg();	struct passwd *pep = getpwnam("nobody");	char line[sizeof(utmp.ut_line) + 1];	struct wallgroup *g;	while ((ch = getopt(argc, argv, "ng:")) != -1)		switch (ch) {		case 'n':			/* undoc option for shutdown: suppress banner */			if (geteuid() == 0 || (pep && getuid() == pep->pw_uid))				nobanner = 1;			break;		case 'g':			g = (struct wallgroup *)malloc(sizeof *g);			g->next = grouplist;			g->name = optarg;			g->gid = -1;			grouplist = g;			break;		case '?':		default:usage:			(void)fprintf(stderr, "usage: wall [-g group] [file]\n");			exit(1);		}	argc -= optind;	argv += optind;	if (argc > 1)		goto usage;	for (g = grouplist; g; g = g->next) {		struct group *grp;		grp = getgrnam(g->name);		if (grp)			g->gid = grp->gr_gid;	}	makemsg(*argv);	if (!(fp = fopen(_PATH_UTMP, "r")))		errx(1, "cannot read %s.", _PATH_UTMP);	iov.iov_base = mbuf;	iov.iov_len = mbufsize;	/* NOSTRICT */	while (fread((char *)&utmp, sizeof(utmp), 1, fp) == 1) {		if (!utmp.ut_name[0] ||		    !strncmp(utmp.ut_name, IGNOREUSER, sizeof(utmp.ut_name)))			continue;		if (grouplist) {			int ingroup = 0, ngrps, i;			char username[MAXLOGNAME];			struct passwd *pw;			gid_t grps[NGROUPS_MAX];			bzero(username, sizeof username);			strncpy(username, utmp.ut_name, sizeof utmp.ut_name);			pw = getpwnam(username);			if (!pw)				continue;			ngrps = getgroups(pw->pw_gid, grps);			for (g = grouplist; g && ingroup == 0; g = g->next) {				if (g->gid == -1)					continue;				if (g->gid == pw->pw_gid)					ingroup = 1;				for (i = 0; i < ngrps && ingroup == 0; i++)					if (g->gid == grps[i])						ingroup = 1;			}			if (ingroup == 0)				continue;		}		strncpy(line, utmp.ut_line, sizeof(utmp.ut_line));		line[sizeof(utmp.ut_line)] = '\0';		if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL)			warnx("%s", p);	}	exit(0);}