r = yp_master(Domain, ypmap, &master);
r = yp_master(Domain, ypmap, &master); if (r != 0) { fprintf(stderr, "yppush: could not get ypservers map\n"); exit(1); }
main(argc, argv)int  argc;char **argv;{	struct ypall_callback ypcb;	extern char *optarg;	extern int optind;	char	*domain,*map,*hostname,*parallel,*timeout;	int c, r, i;	char *ypmap = "ypservers";	CLIENT *client;	static char map_path[MAXPATHLEN];	struct stat finfo;	DBM *yp_databas;	char order_key[YP_LAST_LEN] = YP_LAST_KEY;	datum o;        yp_get_default_domain(&domain);	hostname = NULL;/*	while( (c=getopt(argc, argv, "d:h:p:t:v?")) != -1)*/	while( (c=getopt(argc, argv, "d:h:v?")) != -1)		switch(c) {		case 'd':                        domain = optarg;			break;		case 'h':			hostname = optarg;			break;		case 'p':			parallel = optarg;			break;		case 't':			timeout = optarg;			break;                case 'v':                        Verbose = 1;                        break;                case '?':                        usage();                        /*NOTREACHED*/		}	if(optind + 1 != argc )		usage();	map = argv[optind];	strncpy(Domain,domain,sizeof(Domain)-1);	Domain[sizeof(Domain)-1] = '\0';	strncpy(Map,map,sizeof(Map)-1);	Map[sizeof(Map)-1] = '\0';	/* Check domain */	snprintf(map_path,sizeof map_path,"%s/%s",YP_DB_PATH,domain);	if (!((stat(map_path, &finfo) == 0) &&	      ((finfo.st_mode & S_IFMT) == S_IFDIR))) {	  	fprintf(stderr,"yppush: Map does not exist.\n");		exit(1);	}			/* Check map */	snprintf(map_path,sizeof map_path,"%s/%s/%s%s",	    YP_DB_PATH,domain,Map,YPDB_SUFFIX);	if (!(stat(map_path, &finfo) == 0)) {		fprintf(stderr,"yppush: Map does not exist.\n");		exit(1);	}			snprintf(map_path,sizeof map_path,"%s/%s/%s",YP_DB_PATH,domain,Map);	yp_databas = ypdb_open(map_path,0,O_RDONLY);	OrderNum=0xffffffff;	if (yp_databas == 0) {		fprintf(stderr, "yppush: %s%s: Cannot open database\n",			map_path, YPDB_SUFFIX);	} else {		o.dptr = (char *) &order_key;		o.dsize = YP_LAST_LEN;		o=ypdb_fetch(yp_databas,o);		if (o.dptr == NULL) {			fprintf(stderr,				"yppush: %s: Cannot determine order number\n",				Map);		} else {			OrderNum=0;			for(i=0; i<o.dsize-1; i++) {				if (!isdigit(o.dptr[i])) {					OrderNum=0xffffffff;				}			}			if (OrderNum != 0) {				fprintf(stderr,					"yppush: %s: Invalid order number '%s'\n",					Map,					o.dptr);			} else {				OrderNum = atoi(o.dptr);			}		}        }		yp_bind(Domain);        r = yp_master(Domain, ypmap, &master);	if (hostname != NULL) {	  push(strlen(hostname), hostname);	} else {	  	  if (Verbose) {		printf("Contacting master for ypservers (%s).\n", master);	  }	  client = yp_bind_host(master, YPPROG, YPVERS, 0, 1);	  ypcb.foreach = pushit;	  ypcb.data = NULL;	  r = yp_all_host(client,Domain, ypmap, &ypcb);	}                exit(0);}