err(1,netgroup);
err(1, "%s", netgroup);
main(argc, argv)	int argc;	char *argv[];{	FILE *fp;	char readbuf[LINSIZ];	struct group_entry *gcur;	struct member_entry *mcur;	char *host, *user, *domain;	int ch;	char *key = NULL, *data = NULL;	int hosts = -1, i;	if (argc < 2)		usage(argv[0]);	while ((ch = getopt(argc, argv, "uhf:")) != -1) {		switch(ch) {		case 'u':			if (hosts != -1) {				warnx("please use only one of -u or -h");				usage(argv[0]);			}			hosts = 0;			break;		case 'h':			if (hosts != -1) {				warnx("please use only one of -u or -h");				usage(argv[0]);			}			hosts = 1;			break;		case 'f':			netgroup = optarg;			break;		default:			usage(argv[0]);			break;		}	}	if (hosts == -1)		usage(argv[0]);	if (strcmp(netgroup, "-")) {		if ((fp = fopen(netgroup, "r")) == NULL) {			err(1,netgroup);		}	} else {		fp = stdin;	}	/* Stuff all the netgroup names and members into a hash table. */	while (fgets(readbuf, LINSIZ, fp)) {		if (readbuf[0] == '#')			continue;		/* handle backslash line continuations */		while(readbuf[strlen(readbuf) - 2] == '\\') {			fgets((char *)&readbuf[strlen(readbuf) - 2],					sizeof(readbuf) - strlen(readbuf), fp);		}		data = NULL;		if ((data = (char *)(strpbrk(readbuf, " \t") + 1)) < (char *)2)			continue;		key = (char *)&readbuf;		*(data - 1) = '\0';		store(gtable, key, data);	}	fclose(fp);	/*	 * Find all members of each netgroup and keep track of which	 * group they belong to.	 */	for (i = 0; i < TABLESIZE; i++) {		gcur = gtable[i];		while(gcur) {			__setnetgrent(gcur->key);			while(__getnetgrent(&host, &user, &domain) != NULL) {				if (hosts) {					if (!(host && !strcmp(host,"-"))) {						mstore(mtable,						       host ? host : "*",						       gcur->key,						       domain ? domain : "*");					}				} else {					if (!(user && !strcmp(user,"-"))) {						mstore(mtable,						       user ? user : "*",						       gcur->key,						       domain ? domain : "*");					}				}			}			gcur = gcur->next;		}	}	/* Release resources used by the netgroup parser code. */	__endnetgrent();	/* Spew out the results. */	for (i = 0; i < TABLESIZE; i++) {		mcur = mtable[i];		while(mcur) {			struct grouplist *tmp;			printf ("%s.%s\t", mcur->key, mcur->domain);			tmp = mcur->groups;			while(tmp) {				printf ("%s", tmp->groupname);				tmp = tmp->next;				if (tmp)					printf(",");			}			mcur = mcur->next;			printf ("\n");		}	}	/* Let the OS free all our resources. */	exit(0);}