__res_nopt(res_state statp,
	   int n0,                /* current offset in buffer */
	   u_char *buf,           /* buffer to put query */
	   int buflen,            /* size of buffer */
	   int anslen)            /* UDP answer buffer size */
{
	u_int16_t flags = 0;

#ifdef DEBUG
	if ((statp->options & RES_DEBUG) != 0U)
		printf(";; res_nopt()\n");
#endif

	HEADER *hp = (HEADER *) buf;
	u_char *cp = buf + n0;
	u_char *ep = buf + buflen;

	if ((ep - cp) < 1 + RRFIXEDSZ)
		return -1;

	*cp++ = 0;	/* "." */

	NS_PUT16(T_OPT, cp);	/* TYPE */
	NS_PUT16(MIN(anslen, 0xffff), cp);	/* CLASS = UDP payload size */
	*cp++ = NOERROR;	/* extended RCODE */
	*cp++ = 0;		/* EDNS version */

	if (statp->options & RES_USE_DNSSEC) {
#ifdef DEBUG
		if (statp->options & RES_DEBUG)
			printf(";; res_opt()... ENDS0 DNSSEC\n");
#endif
		flags |= NS_OPT_DNSSEC_OK;
	}

	NS_PUT16(flags, cp);
	NS_PUT16(0, cp);	/* RDLEN */
	hp->arcount = htons(ntohs(hp->arcount) + 1);

	return cp - buf;
}
__res_nopt(res_state statp,
	   int n0,                 
	   u_char *buf,            
	   int buflen,             
	   int anslen)             
{
	u_int16_t flags = 0;

#ifdef DEBUG
	if ((statp->options & RES_DEBUG) != 0U)
		printf(";; res_nopt()\n");
#endif

	HEADER *hp = (HEADER *) buf;
	u_char *cp = buf + n0;
	u_char *ep = buf + buflen;

	if ((ep - cp) < 1 + RRFIXEDSZ)
		return -1;

	*cp++ = 0;	 

	NS_PUT16(T_OPT, cp);	 
	NS_PUT16(MIN(anslen, 0xffff), cp);	 
	*cp++ = NOERROR;	 
	*cp++ = 0;		 

	if (statp->options & RES_USE_DNSSEC) {
#ifdef DEBUG
		if (statp->options & RES_DEBUG)
			printf(";; res_opt()... ENDS0 DNSSEC\n");
#endif
		flags |= NS_OPT_DNSSEC_OK;
	}

	NS_PUT16(flags, cp);
	NS_PUT16(0, cp);	 
	hp->arcount = htons(ntohs(hp->arcount) + 1);

	return cp - buf;
}